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
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to