Jump to content

Recommended Posts

Hello,
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.

[code]<?php
$username="abc123";
$password="abc123";
$database="abc123";
$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 THIS IS WHERE I NEED HELP, I GUESS");

$result1=mysql_query($query1);
$num=mysql_num_rows($result1);

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'].
"<p>"
;
}
?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/10515-query-help/
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
Link to comment
https://forums.phpfreaks.com/topic/10515-query-help/#findComment-39563
Share on other sites

@poirot
[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]

Link to comment
https://forums.phpfreaks.com/topic/10515-query-help/#findComment-39661
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.