RE: [PHP] If you ever had a Vic20
| From: | Jay Blanchard | Date: | Mon, 18 Aug 2003 12:17:37 +0000 |
| Subject: | RE: [PHP] If you ever had a Vic20 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-159907@lists.php.net to get a copy of this message | ||
[snip]
:) Tried that:
[/snip]
Let's be more verbose and see what happens....
if(!($myconnection = mysql_pconnect($server,$user,$pass))){
print("Failed to connect to database!\n");
exit();
}
if(!mysql_select_db($db,$myconnection)){
print("Failed to select database!\n");
exit();
}
$query = "select StudentId from" . $table . "where StudentID = '" .
$StudentID . "' ";
if(!($news = mysql_query($query, $myconnection))){
print("ERROR! " . mysql_error() . "\n");
exit();
}
$howmany = mysql_num_rows($news);
echo "$howmany \n";
if ($howmany == 1){
include ("/the/full/path/to/html/access_error.htm");
} else {
include ("/the/full/path/to/html/registration.htm");
}
It is my guess that your query is failing, so $news is not a valid
resource. Anytime you do a query you should also do a mysql_error()
statement so that a better clue might be printed out.