View Single Post
Old 05-25-2006, 06:34 AM   #1 (permalink)
transfield
Code Monkey
 
Join Date: Mar 2006
Posts: 35
transfield is on a distinguished road
JOIN Syntax Help

Hello,

My Situation:
I want to use the query results of my code below to query another table in the same database. Then I want to display the results of that(the second) query. How do I do this? I believe I'm supposed to use some sort of JOIN statement. I've read the MySql manuals but I don't understand what they are talking about.

Additional Information:
The other table is called developer & there are 3 fields in it. The field names are NAME, PROJECT & TYPE. So the results of field company should query NAME. The results of field project should query PROJECT. The results of field property should query TYPE.

The 1st part of my code is below. I don't know how to write the 2nd part. I appreciate your help on this matter.
PHP Code:
<?php 
$username
="abc23"
$password="abc23"
$database="abc23"
$host="localhost"

mysql_connect ("$host","$username","$password"); 
mysql_select_db($database) or die( "Where's the database man?"); 

$mktime date('Y-m-d'); 

$query1=("SELECT * FROM developer_log WHERE expiry > '$mktime'"); 
     
$result1=mysql_query($query1); 
$num=mysql_num_rows($result1); 

while (
$row1 mysql_fetch_array($result1)) 

echo
"<b>Main Location: </b> ".$row1['id']. 
"<p><b>Sub Location: </b> ".$row1['company']. 
"<p><b>Percentage of Malays: </b> ".$row1['project']. 
"<p><b>Percentage of Chinese: </b> ".$row1['property']. 
"<p><b>Percentage of Indians: </b> ".$row1['email']. 
"<p><b>Percentage of Others: </b> ".$row1['cc_email']. 
"<p>" 


?>
transfield is offline   Reply With Quote