Re: My SQL not getting row

From: Date: Wed, 11 Jun 2003 07:56:55 +0000
Subject: Re: My SQL not getting row
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-151022@lists.php.net to get a copy of this message
On Wednesday 11 June 2003 13:31, Ben Houlton wrote: > The bit of my code that I'm working on is here: > if ($submit) { > > if ($id) { > > $sql = "UPDATE pages SET sub='$sub' > msg='$msg',name='$name',email='$email',newday='$newday' > WHERE id=$id"; > > } else { > > $sql = "INSERT INTO pages (sub,msg,name,email,date,time,newday) VALUES > > ('$sub','$msg','$name','$email','$date','$time','$newday')"; > > } In your IF structure you have defined $sql, but have not used it, and below you're defining it again: > $sql = "SELECT * FROM pages WHERE id=$id"; > > $result = mysql_query($sql); > > $myrow = mysql_fetch_array($result); After most mysql_*() functions you should check for errors using mysql_error(). -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* At no time is freedom of speech more precious than when a man hits his thumb with a hammer. -- Marshall Lumsden */

« previous php.general (#151022) next »