Re: Re: REsource Identifier( PHP_MYSQL)
| From: | Burhan Khalid | Date: | Sat, 27 Mar 2004 09:14:12 +0000 |
| Subject: | Re: Re: REsource Identifier( PHP_MYSQL) | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-181610@lists.php.net to get a copy of this message | ||
Gimic wrote:
The entire script looks like this: <?php if ($_POST["Subject"] != NULL) { echo "results for " . $_POST["Subject"]; $subject = $_POST["Subject"]; $qry = ("select * from " . $subject); $sqlQry = (string) $qry; GetVals(); } function GetVals() { $db = mysql_connect("localhost", "root"); mysql_select_db("books",$db); $result = mysql_query($sqlQry,$db); echo mysql_errno($db); echo mysql_error($db); echo $result; } ?>GetVals() has no ide what is $sqlQry because it is out of its scope. Try this instead GetVals($sqlQry); function GetVals($query) { //Trimmed rest $result = mysql_query($query,$db); //Trimmed } Please cc: your replies to php-general@lists.php.net so others may also contribute.