Mysql PHP help ASAP please
Posted: Thu Oct 25, 2007 12:25 am
feyd | Please use
I have this database with 2 tables
1. students
2. subjects
both the tables have primary key as 'id'
i want to extract the primary key of the rows corresponding to the rollnumber and the subject name from these tables
ive written the above code but it doesnt seem to work
what might be the problem please help me
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]Code: Select all
$conn = connect();
$rollnumber_sql = "SELECT * FROM `studentplus`.`students` WHERE `rollnumber` = '$rollnumber';";
$rm_res = mysql_query($rollnumber_sql, $conn) or die(mysql_error());
echo $rm_res;
$rm = mysql_fetch_array($rm_res);
print_r($rm);
$student_id = $rm['id'];
$subject_sql = "SELECT * FROM `studentplus`.`subjects` WHERE `subject` = '$subject';";
$sub_res = mysql_query($subject_sql, $conn) or die(mysql_error());
$sub = mysql_fetch_array($sub_res);
$subject_id = $sub['id'];I have this database with 2 tables
1. students
2. subjects
both the tables have primary key as 'id'
i want to extract the primary key of the rows corresponding to the rollnumber and the subject name from these tables
ive written the above code but it doesnt seem to work
what might be the problem please help me
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]