Member • Jun 17, 2008
PHP- SQL utility
i'm developing a site 4 my college.... theres a link onthe site to checkur results...
there's this backend datbase(MySQL), the front end being HTML+PHP+CSS....
the database table(called result) contains columns (Roll NUmber, subject 1, subj2 etc)...
i ask the user to enter his roll number via a HTML form(POST method).... and on the target page of the form, i retreive the roll number he had entered....
i then compare the eneterd value with entries in the 'Roll NUmber' column of the databsae table.... and when a match is found, i print the entire record for that roll number...
plain and simple..
but i'm facing a problem...
when i try to retrieve the record (of the enetered roll number) using mysql_fetch_array($xyz), i get an error...
here's the source code...
the user form (collecting the roll number)
processing the form(comparing with database)
$rno = $_POST["Roll Number"];
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("database", $con);
$data = mysql_query("SELECT * FROM result WHERE 'Roll Number' = $rno ");
while(mysql_fetch_row($data))
{
echo "HI";
}
mysql_close($con)
?>
please help me figure out the error.... i'll be really grateful...