fish
07-06-2002, 07:48 AM
Hi. This is just a simple SQL query but its really giving me pains.. i'd appreciate any ideas.
$query = "SELECT code FROM colours WHERE ('colour' = \"$colour\");";
$result = mysql_query($query) or die("Query failed");
$line = mysql_fetch_array($result, MYSQL_ASSOC);
When I execute this then run the print statements:
print "Value of line is: $line[code]";
$temp = $line[code];
print "temp is $temp";
the script simply prints out "Value of line is: " and same for temp.
I've pretty much isolated the problem to these lines, i've tested the other variables and inputs, so my problem is somewhere with the query :/
I appreciate any suggestions!
$query = "SELECT code FROM colours WHERE ('colour' = \"$colour\");";
$result = mysql_query($query) or die("Query failed");
$line = mysql_fetch_array($result, MYSQL_ASSOC);
When I execute this then run the print statements:
print "Value of line is: $line[code]";
$temp = $line[code];
print "temp is $temp";
the script simply prints out "Value of line is: " and same for temp.
I've pretty much isolated the problem to these lines, i've tested the other variables and inputs, so my problem is somewhere with the query :/
I appreciate any suggestions!