I have a really simple function:
function experience_query($id) { $sql = @mysql_query( ' SELECT * FROM table WHERE id = $id '); return('$sql'); }
When I call this function:
$q = categories_query('1001'); while( $list = mysql_fetch_assoc($q) ) { extract($list); echo $name; }
I am getting an error’ ‘mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource…’
Am I allowed to return mysql queries from a function?
Thank you for your help.
Replace this:
With this:
By surrounding
$sqlin quotes you are returning the string representation of the MySQL resource.