Forum Moderators: coopster
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in *** on line 9
Warning: Cannot modify header information - headers already sent by (output started at \***:9) in **** on line 12
I'm pretty new to PHP so I'm thinking its a problem with syntax. Any help is appreciated. Code is below.
<?PHP
$ni = trim($_POST['ni']);
require 'db_connect.php';
$sql = "SELECT * FROM $db_table WHERE ni = '$ni'";
$query = "mysql_query($sql) or die (mysql_error())";
if (mysql_num_rows($query) < 1) {
require 'db_close.php';
header("location: DESIRED LOCATION");
}
else{
require 'db_close.php';
header("Location: EXIT ");
}
?>
<?php$ni = trim($_POST['ni']);
require 'db_connect.php';
$sql = "SELECT * FROM $db_table WHERE ni = '$ni'";
$query = mysql_query($sql) or die (mysql_error());//No quotes here!
if (mysql_num_rows($query) < 1) {require 'db_close.php';
header("location: http://www.example.com/go_on.html");//here should be url, no text
}
else{
require 'db_close.php';
header("Location: http://www.example.com/exit.html");
}
?>
Best regards
Michal Cibor