View Single Post
  #2  
Old 08-08-2006, 02:32 PM
snorter snorter is offline
Junior Member
 
Join Date: Jul 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
snorter is on a distinguished road
Default

first you should use your first idea

to pull the data out you'll be wanting to use a bit of code like

PHP Code:
$sql = "SELECT * FROM question";
$result = mysql_connect("localhost", $sql);
$row = mysql_fetch_assoc($result);



that way you can pull question data by calling on the variable $row['name of row here'];

then to pull from the solution table use

PHP Code:
$question_id = $row['question_id'];
$sql2 = "SELECT * FROM solution WHERE question_id = '$question_id'";
$result2 = mysql_connect("localhost", $sql2);
$row2 = mysql_fetch_assoc($result2);


and then display the data from there with $row2['enter row name here']; -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
  Webmaster Forums - View Single Post - online quiz query
View Single Post
  #2  
Old 08-08-2006, 02:32 PM
snorter snorter is offline
Junior Member
 
Join Date: Jul 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
snorter is on a distinguished road
Default

first you should use your first idea

to pull the data out you'll be wanting to use a bit of code like

PHP Code:
$sql = "SELECT * FROM question";
$result = mysql_connect("localhost", $sql);
$row = mysql_fetch_assoc($result);



that way you can pull question data by calling on the variable $row['name of row here'];

then to pull from the solution table use

PHP Code:
$question_id = $row['question_id'];
$sql2 = "SELECT * FROM solution WHERE question_id = '$question_id'";
$result2 = mysql_connect("localhost", $sql2);
$row2 = mysql_fetch_assoc($result2);


and then display the data from there with $row2['enter row name here']; -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote