urtrivedi 276 Nearly a Posting Virtuoso

are you able to run page.
If yes then you must view source and look where the quotes are misplaced.

urtrivedi 276 Nearly a Posting Virtuoso

if you are sure that value of $session_unitidgrouping will always like x,y,z where x y z are integers (not characters).

I mean separted by comma, then you must use IN keyword, not LIKE.

Here is your new query

$query="select meetings.meeting_date, meetings.unit_id as unitid	from meetings	where meetings.status_id = '20' and  

meetings.unit_id	in ($session_unitidgrouping) 

Order by meetings.meeting_date asc";
urtrivedi 276 Nearly a Posting Virtuoso

follow this post I think you will get your answer

http://www.daniweb.com/web-development/php/threads/287110

urtrivedi 276 Nearly a Posting Virtuoso

as I said you can not use LIKE keyword, as you know that once "user_name" votes, then all having starting with "user_name23", "user_name64", "user_name4tg", will not able to vote.

so best way is use = sign

rated  = '$_SESSION[username]'

LIKE is used only when you are searching something that you are not much sure.

urtrivedi 276 Nearly a Posting Virtuoso
<input type=checkbox name=chk1 id=chk1 value='Yes' 
<?php 
   if ($_SESSION['last_data']['chk1']=='Yes')
    echo "checked";
?>   > Check here


<input type=radiobutton name=rad1 id=rad1 value='No' 
<?php 
   if ($_SESSION['last_data']['rad1']=='No')
    echo "checked";
?>   > No


<select name=sel id=sel >
<option value='v1' <?php echo ($_SESSION['last_data']['sel']=='v1'?"selected":"") ?>     > One</option>

<option value='v2' <?php echo ($_SESSION['last_data']['sel']=='v2'?"selected":"") ?>     > Two</option>


<option value='v3' <?php echo ($_SESSION['last_data']['sel']=='v3'?"selected":"") ?>     > Three</option>

</select>
urtrivedi 276 Nearly a Posting Virtuoso

it should not show <br/> is it part of your note

urtrivedi 276 Nearly a Posting Virtuoso

You will always find that username or userid or loginid are always unique for that particular website.
If username of your site is not unique (I am sure it is unique) then then you should find another unique column to rate it distinctly.

do not use

rated  LIKE '%$_SESSION[username]%'

instead use

rated  = '$_SESSION[username]'
karthik_ppts commented: useful post +6
urtrivedi 276 Nearly a Posting Virtuoso

on display page add function nl2br as shown here

<td><textarea rows="15" style="width: 99%" readonly><?php echo nl2br($row_Recordset1['Notes']); ?></textarea></td>

You should also change way you update note, new line must be between old note and new note

CONCAT_WS( Notes,'\r\n\r\n', %s)
urtrivedi 276 Nearly a Posting Virtuoso

You are displaing link to note, where and how you display note?

<a href="test5.php?Id=<?php echo $row_Recordset1['Id']; ?>" class="submodal"><img src="Images/editnote.png" /></a>
urtrivedi 276 Nearly a Posting Virtuoso

you must replace $note with variable of your data fetch array

urtrivedi 276 Nearly a Posting Virtuoso

1 removed () around echo
2 merged two lines,
3 changed " to '

echo "<br>You left out some required dields. <STRONG>Record NOT added</STRONG>. Enter this record again, please <P align='center'><A HREF='http://www.kotw.net'><STRONG>Go Back</STRONG></A></P> ";
urtrivedi 276 Nearly a Posting Virtuoso

two lines after note and then add current note

CONCAT_WS( Notes,'\r\n\r\n', %s)

then when you display note in html page. you may use
nl2br function to convert new line to html break
<?php
echo nl2br ($note);
?>

urtrivedi 276 Nearly a Posting Virtuoso
Still a small problem

I am not able to understand your problem.

urtrivedi 276 Nearly a Posting Virtuoso

try to do without sprintf,

$notes=addslashes($_POST['Notes']);
$updateSQL = "UPDATE Leads SET Notes = CONCAT_WS(Notes,'\r\n', '{$notes}') WHERE Id='{$_POST['Id']}'";
urtrivedi 276 Nearly a Posting Virtuoso

in your post handler form you check errors

<?php
unset($_SESSION['last_data']);
unset($_SESSION['errors']);
if(errors)
{
//set error session here
$_SESSION['last_data']=$_POST;
}
else
{
//update/insert database
}

header("location:myform.php");
exit;
?>

Now in your main form
you can diplay session errors if session errors is set, and use last data to set back values

<?php
if(isset($_SESSIONS['errors'])
{
//display errorrs at the top of page
}

.
.
.
.
<input type=text name=txt1 id=txt1 value='?php echo  $_SESSION['last_data']['txt1']?>' >
.
.
.
.
?>
AngelicOne commented: Redirecting a form is something new to me using PHP! Thank you very much! +3
urtrivedi 276 Nearly a Posting Virtuoso

TRY CHANGE FOLLOWING LINES

LINE 26

$querymain="SELECT substrING(C1.GroupID,1,3) GroupID,

LINE 42

GROUP BY  substrING(C1.GroupID,1,3) ";

LINE 100

where  groupID like '{$rowmain['GroupID']}%'
urtrivedi 276 Nearly a Posting Virtuoso

if database is readonly for you then. there is not alternative, if you can update triagroup column with some data then it could be fine.

But in case of readonly database we do following.

Identify common pattern in groupname. like lets take first 3 character from group name
so hopefully we get ABP, CIB, BAF (not BAFF as we take only 3 chars)
then this way we can expected output.
but are you sure first 3 letters will be our required master groups?

urtrivedi 276 Nearly a Posting Virtuoso

i will say ABP, CIB, BAFF as CATEGORY
and ABP(JUN-2010), BAFF -JUN-JUL-10 AS GROUPID.

in your reg_group table you do not have category, so for precise report, you must add one column to reg_group that is CATEGORY.

groupid, groupname, category
ABP(JUNJUL10), ABP(JUNJUL10), ABP
BAFF-JUL 10, BAFF-JUL 10, BAFF


IF YOU DO NOT WANT TO ADD MORE COLUMN THEN you may use trialgroup column if it is blank. you can add ABP, BAFF in trialgroup column.

Then we have to just modify query at few places.

So tell me what are you going to do now.

urtrivedi 276 Nearly a Posting Virtuoso

check this

urtrivedi 276 Nearly a Posting Virtuoso

wait this is very poor query. We will get the optimzed one soon.

urtrivedi 276 Nearly a Posting Virtuoso

I was in impression that you are using MYSQL. In MSSQL "if" will not work, we need to change it to "case when then". Ok let me check and I will come back soon.

urtrivedi 276 Nearly a Posting Virtuoso

copy this and see are you able to run this query in your phpmyadmin, I do not have all data as you so it is not giving any error to me.

urtrivedi 276 Nearly a Posting Virtuoso

echo the query and post its output here

echo $querymain;
$resultmain=mysql_query($querymain);
urtrivedi 276 Nearly a Posting Virtuoso

You please simply run my original e3.php(do not add anything except orgname and mysql login values), it is already formatted in that format. You do not have to worry about query.

PLEASE DO NOT CHANAGE ANYTHING (except orgname and mysql login values).

Here is output(output.jpg) for what you send me in sql file and main php file (e3.txt)(attaching again).

urtrivedi 276 Nearly a Posting Virtuoso

Now you have changed the query drastically, Now don't you want output in 12 months columns.
whenever you get error, post output query with your post.

urtrivedi 276 Nearly a Posting Virtuoso

I hope you have not changed the code, because it is working here

before this like

$resultsub=mysql_query($querysub);

add one more line it shold look like this

echo $querysub;
 $resultsub=mysql_query($querysub);

post that generated query here

urtrivedi 276 Nearly a Posting Virtuoso

have you used file i have attached in my previous post.

http://www.daniweb.com/web-development/php/threads/374124/1610733#post1610733

urtrivedi 276 Nearly a Posting Virtuoso

we must practise to do it in correct format. Better you use <br /> <img />. Though it will not change layout, if you do not add space and slash.

urtrivedi 276 Nearly a Posting Virtuoso

I have tried to create a query like it is expected in excel file

give mysql login parameter to this file

save that file as php and run it

urtrivedi 276 Nearly a Posting Virtuoso

can you post your mysql table(S) structure with sample data in sql query format. NOT EXCEL

urtrivedi 276 Nearly a Posting Virtuoso

I am not able to trace, but I think you must separate clientdata calling from other part.
call it separately.

Also eval() is also not working. so you must find another way of setting html elements other than eval.
I have never used jquery -ajax so I am not able to debug it,
For ajax i use XAJAX libraries

urtrivedi 276 Nearly a Posting Virtuoso

after keeping backup, i suggest you to run without where condition.

urtrivedi 276 Nearly a Posting Virtuoso

are you getting expected number of records by selecting it
say

select count(*) from quest_bank where source like '%src="~/%'

I think you might be having space in between in some records [ src = "~/ ] like that

urtrivedi 276 Nearly a Posting Virtuoso

Following is the code for expected output, it is not compiled you may have to correct syntax error if any. Before running code, check whether query runs in your phpmyadmin or not.

<?php
$orgname="SCSW";

$querymain="SELECT C1.GroupID,
sum(if(MONTH(C1.logtime)=1,1,0))  Jan, 
sum(if(MONTH(C1.logtime)=2,1,0))  Feb, 
sum(if(MONTH(C1.logtime)=3,1,0))  Mar, 
sum(if(MONTH(C1.logtime)=4,1,0))  Apr, 
sum(if(MONTH(C1.logtime)=5,1,0))  May, 
sum(if(MONTH(C1.logtime)=6,1,0))  Jun, 
sum(if(MONTH(C1.logtime)=7,1,0))  Jul, 
sum(if(MONTH(C1.logtime)=8,1,0))  Aug, 
sum(if(MONTH(C1.logtime)=9,1,0))  Sep, 
sum(if(MONTH(C1.logtime)=10,1,0))  Oct, 
sum(if(MONTH(C1.logtime)=11,1,0))  Nov, 
sum(if(MONTH(C1.logtime)=12,1,0))  Dec,
count(*) total
tablename as C1
where orgname='{$orgname}'
GROUP BY  C1.GroupID ";

$resultmain=mysql_query($querymain);
echo "<table>";
echo "<tr><td>group</td>  <td>jan</td>  <td>feb</td>................. <td>Grand total</td>  </tr>";
while($rowmain=mysql_fetch_array($resultmain))
{


   echo "<tr><td>{$rowmain['GroupId']}</td>  <td>{$rowmain['Jan']}</td>  <td>{$rowmain['Feb']}</td>.................<td>{$rowmain['total']}</td>   </tr>";

   $querysub="SELECT C1.GroupName ,
   sum(if(MONTH(C1.logtime)=1,1,0))  Jan, 
   sum(if(MONTH(C1.logtime)=2,1,0))  Feb, 
   sum(if(MONTH(C1.logtime)=3,1,0))  Mar, 
   sum(if(MONTH(C1.logtime)=4,1,0))  Apr, 
   sum(if(MONTH(C1.logtime)=5,1,0))  May, 
   sum(if(MONTH(C1.logtime)=6,1,0))  Jun, 
   sum(if(MONTH(C1.logtime)=7,1,0))  Jul, 
   sum(if(MONTH(C1.logtime)=8,1,0))  Aug, 
   sum(if(MONTH(C1.logtime)=9,1,0))  Sep, 
   sum(if(MONTH(C1.logtime)=10,1,0))  Oct, 
   sum(if(MONTH(C1.logtime)=11,1,0))  Nov, 
   sum(if(MONTH(C1.logtime)=12,1,0))  Dec,
   count(*) total

   tablename as C1
   where orgname='{$orgname}' and groupID='{$rowmain['GroupID']}'
   GROUP BY  C1.GroupName ";



   $resultsub=mysql_query($querysub);
   while($rowsub=mysql_fetch_array($resultsub))
   {
	   echo "<tr><td>{$rowsub['GroupName']}</td>  <td>{$rowsub['Jan']}</td>  <td>{$rowsub['Feb']}</td>.................<td>{$rowsub['total']}</td>   </tr>";	 

   }
}
echo "</table>";
?>
urtrivedi 276 Nearly a Posting Virtuoso

Now you know that your script is giving code, so now stop echoing sql and other variables only you should echo javascript statement, because when u eval(response), it will expect javascript code not any other. so comment unwanted things.

also you upload your whole form page that is having ajax funtion here, I will give a try.

urtrivedi 276 Nearly a Posting Virtuoso

this is expected output
groupname jan feb march....
A 3 1 2
B 1 4 5

then post table structure and sample data here

urtrivedi 276 Nearly a Posting Virtuoso

rename for
function all
to
function allnew (i think all is inbuilt keyword)

urtrivedi 276 Nearly a Posting Virtuoso

I have tested this code, its running fine here
make sure you pass getClientId and your post method is get, Be sure about case sensitivity of variable name C and I should be capital and rest letters in small

when I open link

http://server/folder/page.php?getClientId=DG9642

It gives following output

MY SQL = SELECT ad.firstname, ad.lastname, ad.address, ad.city, ad.state, ad.zipcode, ad.dhtmlgoodies_category, ad.dhtmlgoodies_subcategory, ad.caryear, ad.customerid, ad.servicedesc, aj.email, aj.areacode, aj.phoneprefix, ad.clientID, aj.phonesufix, aj.cellareacode, aj.cellprefix, aj.cellsufix, aj.commentonclient FROM additional_cars as ad, ajax_client as aj WHERE ad.clientID='DG9642' group by ad.clientID
formObj.firstname.value = 'Mossa'; formObj.lastname.value = 'Barandao'; formObj.lastname1.value = 'Barandao'; formObj.address.value = '6572 Park Fifth Ave'; formObj.zipcode.value = '22384'; formObj.city.value = 'New York'; formObj.state.value = 'NY'; formObj.dhtmlgoodies_category.value = 'JAGUAR'; formObj.dhtmlgoodies_subcategory.value = 'X-TYPE'; formObj.caryear.value = '1988'; formObj.servicedesc.value = '\nOn June 30, 2011, 9:55 am\nWe performed the following:\nServiced Area: Exhaust \nService Details:\n\nexshaust\n\nMileage @ Service: 4334\n\n----End of Service Report----\n\nOn June 24, 2011, 2:48 pm\nWe performed the following:\nServiced Area: Driveshaft & Axle \nService Details:\n\ntest\n\nMileage @ Service: 5634\n\n----End of Service Report----\n\nOn June 22, 2011, 4:39 pm\nWe performed the following:\nServiced Area: Clutch , Driveshaft & Axle , Suspension \nService Details:\n\ntest\n\nMileage @ Service: 6377\n\n----End of Service Report----\n\nOn June 21, 2011, 12:31 pm\nWe performed the following:\nServiced Area: Air Intake , Brake , Oil Change , Engine Mechanical , Steering , Transmission \nService Details:\n\ntest\n\nMileage @ Service: 4343\n\n----End of Service Report----\n\nOn June 20, 2011, 11:05 am\nWe performed the following:\nServiced Area: Clutch , Engine Mechanical , Steering \nService Details:\n\ntest\n\nMileage @ Service: 4343\n\n----End of Service Report----\n\nOn April 18, 2011, 9:43 am\nWe performed …

urtrivedi 276 Nearly a Posting Virtuoso

when you run this page in browser, then, if you right click on broswer, it will show VIEW SOURCE OPTION (THAT WILL SHOW HTML CODE). depending on browser one or another way you will find such menu.

when you loook at html code in search text type MY SQL =

then following you will find query, copy it then run it in phpymadmin
this is to check whether your php page is builing query properly or not

urtrivedi 276 Nearly a Posting Virtuoso

after running page view souce and search for MY SQL =
I think you should find real query text around it in source. then run that query in myadmin.

urtrivedi 276 Nearly a Posting Virtuoso

I have merged template in your code, I think following 3 variable are important for your payment gateway. Do not include template code now. (its already in your code now)

$sngTotal=0.0;
$strBasket="";
$iBasketItems=0;

Final code

<?php 		

$sngTotal=0.0;
$strBasket="";
$iBasketItems=0;
$total=0;

foreach($_SESSION['cart'] as $product_id => $quantity) 
{
	$query = sprintf("SELECT * FROM all_products WHERE part_number = '%s';",$product_id);  
									
	$result = mysql_query($query)or die(mysql_error());
	$num = mysql_num_rows($result); 
									
	if(mysql_num_rows($result) > 0) 
	{
	  list($id, $part_number, $price) = mysql_fetch_row($result);
	
	  $iBasketItems=$iBasketItems+1;							
	  $line_cost = $price * $quantity;
	  $total = $total + $line_cost;	

	  $strBasket=$strBasket . ":" . $product_id . ":" . $quantity;
   	  $strBasket=$strBasket . ":" . number_format($price,2); /** Item price **/
	  $strBasket=$strBasket . ":" . number_format($price*$quantity,2); /** Line total **/
								
	}
}
$sngTotal=$total;
?>
urtrivedi 276 Nearly a Posting Virtuoso

Even some database do not allow to change type especially when table having data, or it is key column.

In your case if it is PK then when u change PK's datatype you will also have to change datatype of its foreign key reference.

I suggest if it is going to cross SMALLINT range then better to use MEDIUMINT in the begining.

urtrivedi 276 Nearly a Posting Virtuoso

carefully use this code, before running this query, keep back up of table

mysql_query("UPDATE narr_weinachtfeier SET albumdescription='$change_name',
location=  concat('$change_name',substr(location,instr(location,'/'))) ,
location1=  concat('$change_name',substr(location1,instr(location1,'/')))
WHERE id='$idalb'"
urtrivedi 276 Nearly a Posting Virtuoso

instead of using load file, you directly read file using php and insert records directly to mysql.

while reading file in code, if you find blank country, then you may set country to country of previous record.

d5e5 commented: Good advice. Need to pre-process data with procedural language, such as php or Perl. +9
urtrivedi 276 Nearly a Posting Virtuoso

Before you upload you file, you must complete the record, you can not pass blank country. Human can read file and understand that to which country that blank city belong after looking the top row of city group. But computer can not understand that.

Try to attach following file with comma as delimiter

urtrivedi 276 Nearly a Posting Virtuoso

it needs double ==

if(mysql_result($result,0)==1)
urtrivedi 276 Nearly a Posting Virtuoso

This is little simplified.

<?php
session_start();

$connection=mysql_connect("localhost","root","");
$db=mysql_select_db("bank",$connection);

	
$username = $_POST['username'];
$password = $_POST['password'];
$newpassword = $_POST['newpassword'];
$newpassword = md5($newpassword);
$confirmnewpassword = $_POST['confirmnewpassword'];
$confirmnewpassword = md5($confirmnewpassword);	

$result = mysql_query("SELECT count(*) FROM users WHERE username='$username' and password='".md5($password)."'");
if(mysql_result($result,0)=1) //there must be one combination of user/pass
{
	if($newpassword==$confirmnewpassword) 
	{
	    $sql=mysql_query("UPDATE users SET password='$newpassword' where username='$username'"); 
	    if($sql) 
	    { 
	   	 	echo "Congratulations You have successfully changed your password"; 
	    }
	}
	else
	{ 
		echo "The new password and confirm new password fields must be the same"; 
	}   
}
else
{ 
	echo "Invalid Username/Password"; 
} 


?>
urtrivedi 276 Nearly a Posting Virtuoso

changed if ladder

<?php
session_start();

$connection=mysql_connect("localhost","root","");
$db=mysql_select_db("bank",$connection);

	
$username = $_POST['username'];
$password = $_POST['password'];
$newpassword = $_POST['newpassword'];
$newpassword = md5($newpassword);
$confirmnewpassword = $_POST['confirmnewpassword'];
$confirmnewpassword = md5($confirmnewpassword);	

$result = mysql_query("SELECT password FROM users WHERE username='$username'");
if(!$result) 
{ 
echo "The username you entered does not exist"; 
} 
else
if(md5($password)!=mysql_result($result,0))
{
echo "You entered an incorrect password";
}
else
{
 

if($newpassword==$confirmnewpassword) 
    $sql=mysql_query("UPDATE users SET password='$newpassword' where username='$username'"); 
    if($sql) 
    { 
    echo "Congratulations You have successfully changed your password"; 
    }
else
{ 
echo "The new password and confirm new password fields must be the same"; 
}   

}//i have added this brace //
?>
urtrivedi 276 Nearly a Posting Virtuoso

You may try this part, I think your query is failing. do not change executeQuery now.

function loadArrayFromQuery($query) {
		$result = $this->executeQuery($query);
                if($result)
                {
		   $return = array();
   		   while ($rows = mysqli_fetch_array($result))  //THIS IS THE LINE THAT IS FAILING
		   {	
			   $return[] = $this->loadFromArray($rows);
		   }
		   return $return;
                 }
                 else
                 {
                     echo "some error occured ".mysqli_error($this->link);;
                     die('');
                  }
	}
urtrivedi 276 Nearly a Posting Virtuoso

add $this->link as first parameter, change that line to following

while ($rows = mysqli_fetch_array($this->link,$result))