Re: Can a variable being use twise?

From: Date: Wed, 14 May 2003 08:38:37 +0000
Subject: Re: Can a variable being use twise?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-147555@lists.php.net to get a copy of this message
your code: $sql=mysql_query("select * from data_user where sign_date='$row->sign_date'"); my code: $sql=mysql_query("select * from data_user where sign_date='".$row->sign_date."'"); should work better. I havent tried using objects in strings, but I know it doesnt work with arrays. So I guess you also have to get the objects out of the string. Jack <nedcor4@nedcor.com.hk> schrieb in im Newsbeitrag: 20030514042121.57973.qmail@pb1.pair.com... > Dear all > First of all, please have a look on my source code : > > <? > while ($row=mysql_fetch_object($select_temp_date)) > { > print $row->sign_date; > $create_joindatauser_query=mysql_query("create temporary table data_user > select temp_control_form.name as signed,temp_control_form.sign_date > ,temp_signoff_user.name as name temp_signoff_user.department as dept from > temp_signoff_user left join temp_control_form on > temp_signoff_user.name=temp_control_form.name",$link); > $sql=mysql_query("select * from data_user where > sign_date='$row->sign_date'"); > <<<<<<<<<<<<<<<<<<<< > while($row1=mysql_fetch_object($sql)) > { > $sql_temp=mysql_query("delete from data_user where > name='$row1->signed'"); > } > $sql2=mysql_query("select * from data_user order by name"); > > <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< > while($row2=mysql_fetch_object($sql2)) > { > print ("<TR>\n"); > print ("<TD><font face='Arial, Helvetica, sans-serif' > size='1'>".$row2->name."</font></TD><TD><font > face='Arial, Helvetica, > sans-serif' > size='1'>".$row->sign_date."</font></TD>"); > print ("</TR>\n"); > } > $drop_datauser_query=mysql_query("drop table data_user"); > > } > ?> > > > When i run this code, it says there is an error on line where i marked > "<<<<<" on it. > To what i understand is $sql and $sql2 is being used twise, for the first > time it is fine, but when comes to the second time, it look like it can't > get through! > > Can anyone pls tell me is there possible way that a variable can be assign > twise when running a loop condition? > > Thx alot! > > Jack > > > >

« previous php.general (#147555) next »