Possible Duplicate:
PHP Error: mysql_fetch_array() expects parameter 1 to be resource, boolean given
So heres what my error is:
Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given in /home/content/12/8781812/html/internal/domain/property/process.php on line 17
The code is:
function checkTOS($username){
include("includes/opendb.php");
$user2check = mysql_real_escape_string($_POST['username']);
$query = "SELECT * FROM user WHERE username=".$user2check;
$result = mysql_query($query);
while($row = mysql_fetch_row($result)){
$TOS = $row[11];
}
if($TOS == 1){
return true;
}else{
return false;
}
}
Line 17 is:
while($row = mysql_fetch_row($result)){
This is basically checking to see if the user accepted the terms of service in the main user db.
EDIT:
So I fixed it but now I get nothing when I try to print my row... Heres the new code.
function checkTOS($preusergrab){
include("includes/opendb.php");
$query = "SELECT * FROM users WHERE username='".$preusergrab."'";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_row($result)){
$TOS = $row[11];
}
// echo $query;
print_r($row);
die();