Hi All
I am kinda new to php… I am entering in the website using student id. If student id does not exist in mysql database, it gives me error. That works fine.
But If I try to echo StudentID on 2nd page, it is not displaying anything. Second problem is I want to display student first and last name using StudentID. But it is not displaying anything using StudentID. Why? I have been trying to solve it, but no success
Following is the code for both problems -
[php]if(!$db_selected)
{
die(“Can not use”.DB_NAME.’:’.mysql_err());
}
@$Stud_ID = $_POST[‘Stud_ID’];
?>
Welcome to Undergraduate Student Main Page
Student ID <?php echo "is:" ." ". @$Stud_ID; ?> | Degree: Computer Science |
Student Name: <?php
$query2 =mysql_query("SELECT Stud_Lastname, Stud_Firstname FROM Student WHERE Stud_ID='$Stud_ID'") or die('wrong query'.mysql_error());
while($row = mysql_fetch_array($query2))
{
echo $row['Stud_Lastname'] . " " . $row['Stud_Firstname'];
} [/php]
Moderator Edit (jSherz): Placed code into PHP tags and then put the statements in bold below: [php]<?php echo "is:" ." ". @$Stud_ID; ?>[/php] |