Forum Moderators: open
$tbl_name = "name";
$sql_query = "SELECT * FROM $tbl_name...etc. Now, I am rewriting the script by using an array to hold all my predefined variables, but I keep on getting a
"mysql_num_rows(): supplied argument is not a valid MySQL result resource" error. What am I doing wrong? Here is the line that causes the error:
$sql_query = "SELECT * FROM $safe[db][tbl_name] WHERE username = '$safe[user][myusername]'"; thanks for any help!
The best way to check the syntax of your query is to dump it to the browser and have a look at the statement. Also, when using array values in strings I tend to stick to the braces syntax:
$sql_query = "SELECT * FROM {$safe['db']['tbl_name']} WHERE username = '{$safe['user']['myusername']}'";