Okay, I've been working with php and mysql, and right now I CANNOT get this script to work. This is my "hours2.php page, and on the previous page, people would submit their student ID number.. which is the variable $id2.
I was able to get people to enter all of the information into the database, but I wanted for them to be able to look up their CAS hours ONLY if they typed in their student number, thus the script below. It has been giving me the "Warning: Supplied argument is not a valid MySQL result resource in /home/nguyenhv/public_html/hours2.php on line 18 error", which is the line that the "WHILE command starts on
Here is my script......
If you want to see my page, it's @ 216.173.213.132/~nguyenhv/cas.html ..... and hours.php
You can test the database by entering some info on the cas.html page, and then visiting the hours.php page.
<html>
<body>
<?
$student == $id2;
mysql_pconnect("localhost","nguyenhv","password"
OR DIE
("Unable to connec to the SQL server" .mysql_error());
mysql_select_db("nguyenhv"
;
if ($student == $id2)
{
$member = mysql_query("SELECT * FROM CAS WHERE ID='$student';"
OR DIE
("Quack. You Screwed up:".mysql_error());
$data = mysql_fetch_array($member);
}
echo "<table align=center border=1>";
echo "<br>";
WHILE ($data=mysql_fetch_array($member)) {
echo "<font color=black>"
."<tr>"
."<td>$data[Last]</td>"
."<td>$data[First]</td>"
."<td>$data[ID]</td>"
."<td>$data[Hours]</td>"
."<td>$data[Month]</td>"
."<td>$data[Year]</td>"
."<td>$data[Org]</td>";
}
echo "</table>";
?>
</body>
</html>
If you guys could give me ANY help, it would be greatly appreciated.
Thanks,
arod324
I was able to get people to enter all of the information into the database, but I wanted for them to be able to look up their CAS hours ONLY if they typed in their student number, thus the script below. It has been giving me the "Warning: Supplied argument is not a valid MySQL result resource in /home/nguyenhv/public_html/hours2.php on line 18 error", which is the line that the "WHILE command starts on
Here is my script......
If you want to see my page, it's @ 216.173.213.132/~nguyenhv/cas.html ..... and hours.php
You can test the database by entering some info on the cas.html page, and then visiting the hours.php page.
<html>
<body>
<?
$student == $id2;
mysql_pconnect("localhost","nguyenhv","password"
("Unable to connec to the SQL server" .mysql_error());
mysql_select_db("nguyenhv"
if ($student == $id2)
{
$member = mysql_query("SELECT * FROM CAS WHERE ID='$student';"
("Quack. You Screwed up:".mysql_error());
$data = mysql_fetch_array($member);
}
echo "<table align=center border=1>";
echo "<br>";
WHILE ($data=mysql_fetch_array($member)) {
echo "<font color=black>"
."<tr>"
."<td>$data[Last]</td>"
."<td>$data[First]</td>"
."<td>$data[ID]</td>"
."<td>$data[Hours]</td>"
."<td>$data[Month]</td>"
."<td>$data[Year]</td>"
."<td>$data[Org]</td>";
}
echo "</table>";
?>
</body>
</html>
If you guys could give me ANY help, it would be greatly appreciated.
Thanks,
arod324