Re: REsource Identifier( PHP_MYSQL)
| From: | Burhan Khalid | Date: | Sat, 27 Mar 2004 06:36:51 +0000 |
| Subject: | Re: REsource Identifier( PHP_MYSQL) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-181607@lists.php.net to get a copy of this message | ||
Gimic wrote:
Hey y'all, I'm having problems trying to get the MySql_Query() function to return the resource ID when using a $string as the argument to pass to it. It returns when I hard code the argument but not the string. Any ideas? here is what the function looks like: function GetVals() { $db = mysql_connect("localhost", "root"); $str_Query=("Select * from " . $subject); mysql_select_db("books",$db); $result = mysql_query($str_Query); echo $result; } but when I use the query: $result=mysql_query("Select * from math") it works. Am I setting my string up wrong? Because it's not running into any errors when I do this.First thing, how would you know if it was returning any errors or not? Try mysql_errno() and mysql_error(). Secondly, I suspect that your "string" is not what you think. print_r($str_Query); and see what its giving you.