I am strugglying to write a script to direct visitors to different pages using the result of sql but am having some great difficulty, can anyone please help me am new to php.
The script below will evaluate the first statement (home.htm) irrespective of what whether the value of “&EventsID” is in the database or not if the Value of the If Statement is =1
However
If I change the value of the if statement to =0, the “else” statement (failed.php) is evaluated irrespective of whether the value of “$EventsID” is in the database or not.
Can you help or would you rather see it on Tuesday. I hope this will not take up your holiday time.
<?
include("connect.php");
$sql = "Select * From qryAwards WHERE EventsID = $EventsID";
$result = odbc_exec($connection, $sql)or die(mysql_error());
// The line below checks to see how many rows of information are returned.
$number_rows = odbc_num_rows($result);
// If 1 or more rows are returned then we have some data so print the table:
if($number_rows =1){
header("Location: [url]http://localhost/sajjadsumar/home.htm[/url]");
}
else{
header("Location: [url]http://localhost/sajjadsumar/failed.php[/url]");
}
include("disconnect.php");
?>