Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP/MySql - What is the correct syntax for retrieving data from two different tables?
    primarykey
    data
    text
    <p>I have two different but related tables and I want to be able to edit/update the information that is retrieved and displayed in a Form. In plain english here's what I am trying to achieve:</p> <p>SELECT colum_1, colum_2, colum_3 FROM table requests WHERE request_id = {$id}</p> <p>But at the same time, I want to: </p> <p>SELECT colum_A, colum_B, colum_C FROM table serialNumbers WHERE request_id = {$id}</p> <p>What's the correct/best way to do this all at once?</p> <p>Question Update: I have two files (1)my_request.php (which lists the details from the table requests), and (2) configuration.php (which is the form I will use to edit/update both table - mainly the serial numbers table). How do I pass on the id from my_request.php to the configuration.php... so that I can apply the instruction you provided above</p> <p>For my_request.php I have the following code. I am able to see all the requests created by the logged in user:</p> <pre><code>while ($row = mysql_fetch_assoc($results)) { $orderdate = strtotime($row['sl_date']); $fdate = strftime("%d/%m/%Y", $orderdate); echo '&lt;tr&gt;'; echo '&lt;td class="txtLeft"&gt;' . $row['request_date'] . '&lt;/td&gt;'; echo '&lt;td class="txtLeft"&gt;' . $row['client_name'] . '&lt;/td&gt;'; echo '&lt;td class="txtCenter"&gt;' . $row['client_country'] . '&lt;/td&gt;'; echo '&lt;td class="txtCenter"&gt;' . $row['opportunity_number'] . '&lt;/td&gt;'; echo '&lt;td class="txtCenter"&gt;' . $row['machine_quantity'] . '&lt;/td&gt;'; echo '&lt;td class="txtCenter"&gt;' . $row['severity'] . '&lt;/td&gt;'; echo '&lt;td class="txtCenter"&gt;' . $row['request_status']; echo '&lt;/td&gt;'; echo '&lt;td class="txtCenter" id="task1"&gt; &lt;a href="configuraion.php?request_id=' . $row['request_id'] . '"&gt; &lt;img src="images/edit.png" width="16" height="16" title="edit sale" style="margin:1px;"/&gt; &lt;/a&gt; &lt;a href="' . $row['sales_connect'] . '" onClick="return confirm(\''. $LANG['alert_sale_del'] .'\');"&gt; &lt;img src="images/s.png" width="16" height="16" title="Sales Connect" style="margin:1px;"/&gt; &lt;/a&gt; &lt;/td&gt;'; echo '&lt;/tr&gt;'; </code></pre> <p>What do I need to do on configuration.php so it understands which id to retrieve the info from? For the configuration.php I basically have the html form where I want to display the data.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload