Jump to content


This topic is now archived and is closed to further replies.


Query help

Recommended Posts

I have 2 tables in 1 database. The table names are developer and developer_log. I want to use the keywords in developer_log to query developer. Then I want to display the results of this query. So here's how it should work:-
developer_log.company should query developer.name
developer_log.project should query developer.development
developer_log.property should query developer.type

My half written code is below. Please help me to modify it. Thank you very much.


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

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



while ($row1 = mysql_fetch_array($result1))
echo"<b>Year Approved: </b> ".$row1['year'].
"<p><b>Name of Developer: </b> ".$row1['name'].
"<p><b>Address: </b> ".$row1['development'].
"<p><b>Type of Property: </b> ".$row1['type'].
"<p><b>Levels: </b> ".$row1['levels'].
"<p><b>Number of Units: </b> ".$row1['quantity'].

Share this post

Link to post
Share on other sites
The non-telepathic amongst us would need to know the structure of those 2 tables so we know which tables contain "levels", "quantity", "year" columns and if you have any selection criteria to extract the particular developer.

Knowing stuff like that really does help to construct the query

Share this post

Link to post
Share on other sites
** OFF - TOPIC **
Barand you seem to be very good with MySQL and apparently use often MySQL only when I'd use PHP too...
How do you UPDATE tables with values retrieved from other tables? JOIN's seem to be usable only in SELECT...

Share this post

Link to post
Share on other sites
[quote]Starting with MySQL Version 4.0.4, you can also perform UPDATE operations that cover multiple tables:

UPDATE items,month SET items.price=month.price
WHERE items.id=month.id;

The example shows an inner join using the comma operator, but multiple-table UPDATE statements can use any type of join allowed in SELECT statements, such as LEFT JOIN.

Note: you cannot use ORDER BY or LIMIT with multiple-table UPDATE. [/quote]

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.