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 [EMAIL PROTECTED] so others may also contribute.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php