Page 1 of 1

$variables in SQL query

Posted: Wed Mar 15, 2006 8:47 pm
by anticore
This Produces nothing..
dont know why :/

Code: Select all

mysql_connect($host,$user,$pass) or die("COULD NOT CONNECT TO DB");
mysql_select_db($db) or die("COULD NOT SELECT DB");
//run query
$query = "SELECT * FROM user_rides WHERE yearcat=".$_REQUEST['yearcat'];

if ($r = mysql_query($query) or die(mysql_error())
{
//print

while ($row = mysql_fetch_array ($r))
{
	print "{$row['name']}";
	
}
else {die('error');
}

Posted: Wed Mar 15, 2006 9:00 pm
by feyd
you need to turn on error_reporting (to E_ALL) and/or display_errors .. you have a parse error. hint: count the pairs of braces.

Posted: Wed Mar 15, 2006 9:08 pm
by anticore
i think theres somehting i gotta change in my PHP INI cause i never get any errors, it just returns blank pages.

Posted: Wed Mar 15, 2006 9:16 pm
by Benjamin
As feyd said, Your missing a brace or 2

Posted: Wed Mar 15, 2006 9:24 pm
by feyd
To "fix" your ini: find the entries in it for "error_reporting" and "display_errors". Make sure they are set to "E_ALL", and "On" respectively. Since there may be multiples of either in the file, make sure to alter only the uncommented line (no leading semicolon.) Restart your web server.