i having some serious problems in getting the information out of a query. i have put up sufficient flags to know if the database is containing any information and to determine which path the code is taking. however i just cant get the information out
here is the code
if (!$_POST['submit'])
{
$hostname = "localhost";
$username = "root";
$password = "hayden";
$database = "ecng3020";
$con = mysql_connect("$hostname","$username","$password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("$database", $con);
// $sql= "SELECT * FROM rules WHERE type='prerequisite' ";
//$result=mysql_query($sql);
// first access to form
// checking if the record is in the database
//$sql= "SELECT * FROM rules WHERE type='prerequisite' ";
$q = "SELECT first_name,last_name,password FROM students WHERE id_no='$c' ";
//if ($result=mysql_query($sql))
if (!$result_1=mysql_query($q))
{
//extract($row);
//$_POST['id']=$id_no;
echo '<p>$row[0]</p>';
//echo "error: user with id {$_GET['id']} does not exist, <a href=\"{$_SERVER['PHP_SELF']}\">click here to continue </a>";
//exit;
}
else
{
if (mysql_num_rows($result_1)!=0){
echo "Found Information!";
}else{
echo "No Information Found!";}
echo '<p>shit</p>';
$row_1 = mysql_fetch_row($result_1);
//extract($row_1);
echo '<p>$row_1[0]</p>';
$_POST['id']=$row['id_no'];
$_POST['firstname']=$first_name;
$_POST['last_name']=$last_name;
$_POST['password']=$password;
//$_POST['repassword']=$password;
echo "<p>$row[id_no]</p>";
}
the query in line 28 is giving me the echo statement that there in information in the database however this echo '<p>$row_1[0]</p>'; statement is just returning $row[0] on the screen which indicates to me it is empty
can some help me as to y this is so