I need help ... can someone help me check for errors
Posted: Sun Dec 28, 2003 1:13 pm
I have these codes on my site but they are not retrieving anything from the mysql database nore ids the php page showing anything. Please are there any errors there:
This one checks for birthday celebrants of the day (there is a Month and Day column in the table in 2 digit format):
<html>
<head>
<title>LVCU Member Database</title>
</head>
<body link="#000080" vlink="#008000" alink="#008000" bgproperties="fixed" background="lvcuback.jpg">
<?php
$scriptdt = Now();
<p><font face="Trebuchet MS" font size="3"><b>
Today is echo "$scriptdt";
</b></font></p>
$db = mysql_connect("localhost", "mydbname", "mydbpassword");
if (!$db) {
echo( "<p>Unable to connect to the " .
"database server at this time.</p>" );
exit();
}
mysql_select_db("lvcudb",$db);
$dt = Now();
$mth = date('%m', $dt);
$dy = date('%d', $dt);
$result = mysql_query("SELECT * FROM members WHERE Month=$mth AND Day=$dy",$db);
echo "<DIV ALIGN="CENTER">";
echo "<CENTER>";
echo "<TABLE BORDER=2>";
echo "<font face="Trebuchet MS" size="2">";
echo"<TR><TD><B>ID</B><TD><B>Surname</B><TD><B>Other_Name</B><TD><B>Sex</B><TD><B>Birthday</B><TD><B>Status</B></TR>";
while ($myrow = mysql_fetch_array($result))
{
echo "<TR><TD>";
echo $myrow["ID"];
echo "<TD>";
echo $myrow["Surname"];
echo "<TD>";
echo $myrow["Other_Name"];
echo"<TD>";
echo $myrow["Sex"];
echo "<TD>";
echo $myrow["Day"];
echo "<TD>";
echo $myrow["Data1"];
}
echo "</font>";
echo "</TABLE>";
echo "</CENTER>";
echo "</DIV>";
?>
</body>
</html>
This one retrives members of a particular family from the database (the string $searchstringf is posted from another page)
<html>
<head>
<title>LVCU Member Database</title>
</head>
<body link="#000080" vlink="#008000" alink="#008000" bgproperties="fixed" background="lvcuback.jpg">
<?php
$db = @mysql_connect("localhost", "mydbusername", "mydbpassword");
if (!$db) {
echo( "<p>Unable to connect to the " .
"database server at this time.</p>" );
exit();
}
mysql_select_db("lvcudb",$db);
$result = mysql_query("SELECT * FROM members WHERE Family LIKE '%" . $_POST['searchstringf'] . "%' ORDER BY Surname",$db);
echo "<DIV ALIGN="CENTER">";
echo "<CENTER>";
echo "<TABLE BORDER=2>";
echo "<font face="Trebuchet MS" size="2">";
echo"<TR><TD><B>ID</B><TD><B>Surname</B><TD><B>Other_Name</B><TD><B>Sex</B><TD><B>Status</B></TR>";
while ($myrow = mysql_fetch_array($result))
{
echo "<TR><TD>";
echo $myrow["Surname"];
echo "<TD>";
echo $myrow["Other_Name"];
echo "<TD>";
echo $myrow["Sex"];
echo "<TD>";
echo $myrow["Data1"];
}
echo "</font>";
echo "</TABLE>";
echo "</CENTER>";
echo "</DIV>";
?>
</body>
</HTML>
Please help fing the errors in this
This one checks for birthday celebrants of the day (there is a Month and Day column in the table in 2 digit format):
<html>
<head>
<title>LVCU Member Database</title>
</head>
<body link="#000080" vlink="#008000" alink="#008000" bgproperties="fixed" background="lvcuback.jpg">
<?php
$scriptdt = Now();
<p><font face="Trebuchet MS" font size="3"><b>
Today is echo "$scriptdt";
</b></font></p>
$db = mysql_connect("localhost", "mydbname", "mydbpassword");
if (!$db) {
echo( "<p>Unable to connect to the " .
"database server at this time.</p>" );
exit();
}
mysql_select_db("lvcudb",$db);
$dt = Now();
$mth = date('%m', $dt);
$dy = date('%d', $dt);
$result = mysql_query("SELECT * FROM members WHERE Month=$mth AND Day=$dy",$db);
echo "<DIV ALIGN="CENTER">";
echo "<CENTER>";
echo "<TABLE BORDER=2>";
echo "<font face="Trebuchet MS" size="2">";
echo"<TR><TD><B>ID</B><TD><B>Surname</B><TD><B>Other_Name</B><TD><B>Sex</B><TD><B>Birthday</B><TD><B>Status</B></TR>";
while ($myrow = mysql_fetch_array($result))
{
echo "<TR><TD>";
echo $myrow["ID"];
echo "<TD>";
echo $myrow["Surname"];
echo "<TD>";
echo $myrow["Other_Name"];
echo"<TD>";
echo $myrow["Sex"];
echo "<TD>";
echo $myrow["Day"];
echo "<TD>";
echo $myrow["Data1"];
}
echo "</font>";
echo "</TABLE>";
echo "</CENTER>";
echo "</DIV>";
?>
</body>
</html>
This one retrives members of a particular family from the database (the string $searchstringf is posted from another page)
<html>
<head>
<title>LVCU Member Database</title>
</head>
<body link="#000080" vlink="#008000" alink="#008000" bgproperties="fixed" background="lvcuback.jpg">
<?php
$db = @mysql_connect("localhost", "mydbusername", "mydbpassword");
if (!$db) {
echo( "<p>Unable to connect to the " .
"database server at this time.</p>" );
exit();
}
mysql_select_db("lvcudb",$db);
$result = mysql_query("SELECT * FROM members WHERE Family LIKE '%" . $_POST['searchstringf'] . "%' ORDER BY Surname",$db);
echo "<DIV ALIGN="CENTER">";
echo "<CENTER>";
echo "<TABLE BORDER=2>";
echo "<font face="Trebuchet MS" size="2">";
echo"<TR><TD><B>ID</B><TD><B>Surname</B><TD><B>Other_Name</B><TD><B>Sex</B><TD><B>Status</B></TR>";
while ($myrow = mysql_fetch_array($result))
{
echo "<TR><TD>";
echo $myrow["Surname"];
echo "<TD>";
echo $myrow["Other_Name"];
echo "<TD>";
echo $myrow["Sex"];
echo "<TD>";
echo $myrow["Data1"];
}
echo "</font>";
echo "</TABLE>";
echo "</CENTER>";
echo "</DIV>";
?>
</body>
</HTML>
Please help fing the errors in this