number 1 problem
Posted: Sun Apr 04, 2010 4:58 am
Hello
I am new to php and it took me hours to write a script in order to display the duty nightpharmacies in my town in accordance with the day of the week.
Although it is now complete and seems to be working I have a problem. Above the table showing the pharmacy, its phone number and address, there appears number "1" with no reason. You can see it yourself at http://dene.paniad.org/1111.php.
Here is the code
I am new to php and it took me hours to write a script in order to display the duty nightpharmacies in my town in accordance with the day of the week.
Although it is now complete and seems to be working I have a problem. Above the table showing the pharmacy, its phone number and address, there appears number "1" with no reason. You can see it yourself at http://dene.paniad.org/1111.php.
Here is the code
<?php
mysql_connect("localhost", "db-user", "password") or die(mysql_error());
mysql_select_db("db") or die(mysql_error());
mysql_query("SET NAMES 'latin5'");
echo "<table border='1'>";
$s=date("H");
$d=date("D");
if ($d=="Mon" && $s<="8") {
echo $result = mysql_query("SELECT * FROM nobetci_pazarcik
WHERE id='4'") or die(mysql_error());
}
elseif ($d=="Mon" && $s>"8") {
echo $result = mysql_query("SELECT * FROM nobetci_pazarcik
WHERE id='7'") or die(mysql_error());
}
elseif ($d=="Tue" && $s<="8") {
echo $result = mysql_query("SELECT * FROM nobetci_pazarcik
WHERE id='7'") or die(mysql_error());
}
elseif ($d=="Tue" && $s>"8") {
echo $result = mysql_query("SELECT * FROM nobetci_pazarcik
WHERE id='8'") or die(mysql_error());
}
elseif ($d=="Wed" && $s<="8") {
echo $result = mysql_query("SELECT * FROM nobetci_pazarcik
WHERE id='8'") or die(mysql_error());
}
elseif ($d=="Wed" && $s>"8") {
echo $result = mysql_query("SELECT * FROM nobetci_pazarcik
WHERE id='6'") or die(mysql_error());
}
elseif ($d=="Thu" && $s<="8") {
echo $result = mysql_query("SELECT * FROM nobetci_pazarcik
WHERE id='6'") or die(mysql_error());
}
elseif ($d=="Thu" && $s>"8") {
echo $result = mysql_query("SELECT * FROM nobetci_pazarcik
WHERE id='1'") or die(mysql_error());
}
elseif ($d=="Fri" && $s<="8") {
echo $result = mysql_query("SELECT * FROM nobetci_pazarcik
WHERE id='1'") or die(mysql_error());
}
elseif ($d=="Fri" && $s>"8") {
echo $result = mysql_query("SELECT * FROM nobetci_pazarcik
WHERE id='2'") or die(mysql_error());
}
elseif ($d=="Sat" && $s<="8") {
echo $result = mysql_query("SELECT * FROM nobetci_pazarcik
WHERE id='2'") or die(mysql_error());
}
elseif ($d=="Sat" && $s>"8") {
echo $result = mysql_query("SELECT * FROM nobetci_pazarcik
WHERE id='5'") or die(mysql_error());
}
elseif ($d=="Sun" && $s<="8") {
echo $result = mysql_query("SELECT * FROM nobetci_pazarcik
WHERE id='5'") or die(mysql_error());
}
elseif ($d=="Sun" && $s>"8") {
echo $result = mysql_query("SELECT * FROM nobetci_pazarcik
WHERE id='4'") or die(mysql_error());
}
$row = mysql_fetch_array( $result ); {
echo "<tr><td>";
echo $row['eczane']." - ".$row['telefon'];
echo "</tr></td>";
echo "<tr><td>";
echo $row['adres'];
echo "</tr></td>";
}
echo "</table>";
?>