MySQL - Select from two tables - php Form

Author Topic: MySQL - Select from two tables  (Read 3344 times)

Offline alex

  • Global Moderator
  • *****
  • Posts: 77
  • Karma: +19/-0
    • View Profile
MySQL - Select from two tables
« on: January 23, 2009, 02:04:44 AM »


Code: [Select]
<?php
$result 
mysql_query("SELECT id, text FROM base_one")
or die(
mysql_error()); 
while(
$row=mysql_fetch_array($result)){
  
$resultb mysql_query("SELECT id, text FROM base_two WHERE id=".$row['id']." ORDER by text ASC")
or die(
mysql_error()); 
while(
$link=mysql_fetch_array($resultb)){


echo 
$link[text]; 
echo 
"<BR>";
                }
 
       }
?>

« Last Edit: January 23, 2009, 02:12:45 AM by alex »