hi, php beginner here.
problem: below coding only linkable to header('Location:dr_fatimah_3111.php'); but can't link to -- header('Location:dr_fatimah_4303.php');.
why? whr the problem?
looking for someone who know the problem resolution to help me solve the problem.
thanks.
<?php
include 'Connections/myConnection.php';
mysql_select_db($database_myConnection, $myConnection)
or die("Unable to connect to MySQL");
$query = "SELECT code, name FROM dr_fatimah";
$result = mysql_query($query);
//text field
if(mysql_num_rows($result)) {
$result = mysql_query("SELECT name FROM dr_fatimah WHERE code='SMM3111' AND name='Multimedia Programming' ");
header('Location:dr_fatimah_3111.php');
}
else header('Location:dr_fatimah_4303.php');
?>
header link problem
Moderator: General Moderators
- greyhoundcode
- Forum Regular
- Posts: 613
- Joined: Mon Feb 11, 2008 4:22 am
Re: header link problem
Code: Select all
// The following condition is presumably evaluating as true
if(mysql_num_rows($result))
{
// I'm not too sure what purpose this next line serves...
$result = mysql_query(
"SELECT name FROM dr_fatimah WHERE code='SMM3111' AND name='Multimedia Programming' ");
// ... as you are then redirecting, regardless of the outcome
header('Location:dr_fatimah_3111.php');
}
// This is the other half of your if/else logic. It will not execute if
// the initial if (...) condition has been met
else
header('Location:dr_fatimah_4303.php');
Re: header link problem
$result (variable) to get the selected data -->(code='SMM3111' AND name='Multimedia Programming') from (dr_fatimah) table
- Bill H
- DevNet Resident
- Posts: 1136
- Joined: Sat Jun 01, 2002 10:16 am
- Location: San Diego CA
- Contact:
Re: header link problem
When you say it "can't link to..." what do you mean? What happens? What is not happening? Is the script merely linking to the one location all the time and never going to the other? Maybe it's because the "if" clause is always evaluating as FALSE?
You are not giving us enough information, and this question should be in the "Code" forum anyway, not here in the forum that says "not for posting programming related questions."
You are not giving us enough information, and this question should be in the "Code" forum anyway, not here in the forum that says "not for posting programming related questions."
- greyhoundcode
- Forum Regular
- Posts: 613
- Joined: Mon Feb 11, 2008 4:22 am
Re: header link problem
Ahhh ... I get it now. It was posted on 1 April.
Just kidding. What Bill H said.
Just kidding. What Bill H said.