Re: Error in MySQL

From: Date: Thu, 10 Aug 2000 07:34:23 +0000
Subject: Re: Error in MySQL
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-11080@lists.php.net to get a copy of this message
Jay wrote:
Hi, Where can I find the information on how to do what you mentioned?
Jay, just check to see if $id exists, then handle it appropriately. In html.php3: <?php if($id) { /* Do something with $id here */ } else { /* * It doesn't exist, so redirect using * header(), or provide alternate content. * */ } ?> Or, you can just provide a default for $id: <?php $id = $id ? $id : 'default_value'; ?> If you don't care about the above, and want to just prevent the error from showing, just place an @ on the front of your mysql function calls. Ie. @mysql_query(). But, IMO, that's not the way you shoudl handle it.
Jay Stauffer "David Robley" <huntsman@www.nisu.flinders.edu.au> wrote in message news:200008100638.QAA18388@odo.cc.flinders.edu.au...
On 10 Aug, Jay wrote: Hello, I am using PHP to call data from a database by html.php3?id=#. It works great, but if the user would go to html.php3 it pops out this error: Warning: 0 is not a MySQL result index in (absolute path)/index.php3 on
line
17 I was wondering if there was a way to redirect to user to another page,
so
that they do not see the error? Thanks, Jay Stauffer You could test in html.php3 if $id is set - if not then you could do a redirect instead of running the database query. Cheers --
David Robley                        | WEBMASTER & Mail List Admin


« previous php.general (#11080) next »