I think you need single quotes around $user.

$query = "select * from quoteprefs where salesman = '$user'";

> 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!!

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

Reply via email to