Taking the die() out may have helped your script continue but now you won't
know if there are sql problems which would cause you to not get any data. I
typically trap the error in a string variable or an array, depending on the
application, and print that out in a nice way to see why my query didn't
return data.

In your case, missing the quotes on $user, you won't return data from the
query because the query is in error.

Steve
----- Original Message ----- 
From: "Robert Sossomon" <[EMAIL PROTECTED]>
To: "'PHP List'" <[EMAIL PROTECTED]>
Sent: Monday, June 14, 2004 2:53 PM
Subject: RE: [PHP] Erroring out?!


> I took out the "or die(mysql_error())" and the script seems to continue
> correctly, however as there are no results it should be loading 2
> windows in different pages, but I get only a white screen and no
> messages written to the error logs.  I am trying to use the header
> function to javascript load 2 pages.
>
> Any thoughts?
>
> -----Original Message-----
> From: Robert Sossomon [mailto:[EMAIL PROTECTED]
> Sent: Monday, June 14, 2004 2:44 PM
> To: PHP List
> Subject: [PHP] Erroring out?!
>
>
> I am trying to figure out why if there is an error in my query it throws
> an error message to the screen instead of parsing the rest of my script
> to get the rest of the information.  I have error checking in my script
> and if there is no information I want it to process and do things.
>
> I run this:
> <?
> session_start();
>
> //connect to database
> include 'db.php';
> include 'salesinfo.php';
>
> $query = "select * from quoteprefs where salesman = $user";
> $get_query_res = mysql_query($query) or die(mysql_error());
>
>
> if (mysql_num_rows($get_query_res) < 1){
> //invalid id, send away
> header("<script language=\"javascript\">parent.C.location.href =
> \"show.html\";</script>"); header("<script
> language=\"javascript\">parent.B.location.href =
> \"custn.html\";</script>"); exit; } else { //get info $title =
> mysql_result($get_query_res,0,'item_num');
> $desc = mysql_result($get_query_res,0,'description');
> $q = mysql_result($get_query_res,0,'qty');
> $p = mysql_result($get_query_res,0,'price');
> $c = mysql_result($get_query_res,0,'comments');
> $tp = mysql_result($get_query_res,0,'Tprice');
>
>
> $display_block = "<html>";
>
> }
> ?>
> <html>
> <head>
> <body>
> <center><BR>
> Choose from the following options to set your preferences:
> <? echo $display_block; ?>
> <BR></center>
> </body>
> </html>
>
> And I get:
> Unknown column 'robert' in 'where clause'
>
> ThANKS!!
>
> Robert
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
>

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

Reply via email to