mysql_query not returning values

Codes here !

Moderators: macek, egami, gesf

mdc
New php-forum User
New php-forum User
Posts: 2
Joined: Wed Oct 16, 2002 11:05 am
Location: Illinois

mysql_query not returning values

Postby mdc » Tue Oct 22, 2002 10:00 am

I am sure that I am making a simple mistake of some sort, however, I cannot seem to catch it. I have a website that is connected to a mysql database. With the following lines of code

$query = "SELECT * FROM static_info WHERE s_num = '$sys_num'";
$result = mysql_query($query);

I only get values back if I have $sys_num set to an integer. If I type in a string value for $sys_num, all the fields are returned blank. Any suggestions from the experts out there :wink:

Thanks in advance,
mdc

DoppyNL

Postby DoppyNL » Tue Oct 22, 2002 11:48 am

probably because mysql can't find any record wich field "s_num" has the value of the string you supply.
When you enter a number you get some records back, because in some records "s_num" has that numerical value.

Greetz Daan

mdc
New php-forum User
New php-forum User
Posts: 2
Joined: Wed Oct 16, 2002 11:05 am
Location: Illinois

Postby mdc » Tue Oct 22, 2002 12:04 pm

What you say makes sense, however, I echo the query value onto the screen and then copy and paste it to the mysql command line, where it then works and returns the values I want.

-mdc


Return to “mySQL & php coding”

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests