Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP+MySQL join statement arrange multiple values as row in mysql_fetch array
    primarykey
    data
    text
    <p>I am using a MySQL INNER JOIN statement which returns various results for one distinct record in the main table from the joins, similar to <a href="https://stackoverflow.com/questions/1038653/how-to-join-multiple-joins-yet-return-distinct-values">How to Join Multiple Joins yet return Distinct Values</a> My query is </p> <pre><code>SELECT cl.*, dep.dept_name FROM epapers.clientelle cl INNER JOIN epapers.dept_staff_users depu ON depu.user_id=cl.user_id INNER JOIN epapers.dept dep ON dep.dept_id=depu.dept_id group by cl.user_id ORDER BY cl.user_name ASC, </code></pre> <p>I would like to display the above in a table shown below</p> <pre><code>echo "&lt;tr bgcolor='#CCCCCC'&gt; &lt;td &gt;$num&lt;/td&gt;&lt;td &gt;".$row[user_id]."&lt;/td&gt;&lt;td&gt;".$row[user_name]."&lt;/td&gt; &lt;td &gt;".$row[fname]."&lt;/td&gt;&lt;td &gt;".$row[lname]."&lt;/td&gt; &lt;td &gt;".$row[dept_name]."&lt;/td&gt; &lt;td &gt;".$row[dept_name]."&lt;/td&gt; &lt;td &gt;".$row[dept_name]."&lt;/td&gt; &lt;td &gt;".$row[email]."&lt;/td&gt;"; $TrID = "$row[user_id]"; echo "&lt;td &gt;"; echo '&lt;form name="activate" action="activate_acc.php" method="POST" ;"&gt;'; echo "&lt;input type='hidden' name='TrID' value='$TrID'&gt;"; echo "&lt;input type='checkbox' name='active' value='$row[active]'&gt;"; echo '&lt;input type="submit" name="Submit" value="Delete"&gt;'; echo '&lt;/form&gt;'; echo "&lt;/td &gt;"; ... </code></pre> <p>Note the the departments can be upto 3 departments. How do I return the mysql query results in a single row for the departments?</p>
    singulars
    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.
    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