Note that there are some explanatory texts on larger screens.

plurals
  1. POMySQL, PHP filtering results within displayed table?
    primarykey
    data
    text
    <p>I've searched through what "I think I should be searching for" - but not really understanding or getting anywhere, please could someone point me in the right direction? </p> <p>I'd like to be able to filter a result set using the <code>th</code> of one column (region) and although I tried the w3cs tutorial I ended up confusing myself as to "what bit of code goes where" etc and the dropdown form thingie looked very clunky.<br> All advice and help most welcome. </p> <p>This is my example website, <a href="http://www.palegallery.com/Reassessment" rel="nofollow noreferrer">myTrader</a> clicking the All Trade Regions link on the left displays as far as I've got &amp; that took me days of cobbling tutorials and guddling about in the dark.</p> <p>query.php code so far:</p> <pre><code> &lt;table id="mainTable"&gt; &lt;tr&gt;&lt;td width="300" valign="top"&gt;&lt;H1&gt;Welcome to myTrader!&lt;/H1&gt; &lt;span class="mainText"&gt;Glass &amp; Paper Recycled Commodities Trading Site&lt;/span&gt;&lt;/td&gt; &lt;td valign="top" align="right"&gt;&lt;img src="images/largeLogo.jpg" width="406" height="113" border="0"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt; &lt;P&gt;&lt;span class="paraHeadingOne"&gt;All Region Paper Sales&lt;/span&gt; &lt;/P&gt; &lt;P&gt; &lt;table class="dbTable"&gt; &lt;tr&gt; &lt;tr&gt;&lt;th&gt;Commodity&lt;/th&gt; &lt;th&gt;Region&lt;/th&gt; &lt;th&gt;Member&lt;/th&gt; &lt;th&gt;Size&lt;/th&gt; &lt;th&gt;Price&lt;/th&gt; &lt;th&gt;Date Posted&lt;/th&gt; &lt;/tr&gt; &lt;?php $link = mysql_connect('localhost', 'palegall', '******'); if (!$link) { die('Could not connect: ' . mysql_error()); } $db_selected = mysql_select_db('palegall_newTrader', $link); if (!$db_selected) { die ('cant find newTrader' . mysql_error()); } $query = mysql_query ("SELECT * FROM `sell` WHERE `commodity`='Paper' ORDER BY `price`") or die( mysql_error() ); $row=mysql_fetch_assoc($query); do { echo'&lt;table class="dbTable"&gt;'; echo '&lt;tr&gt;&lt;td&gt;'.$row['commodity'].'&lt;/td&gt; &lt;td&gt;'.$row['region'].'&lt;/td&gt; &lt;td&gt;'.$row['member'].'&lt;/td&gt; &lt;td&gt;'.$row['size'].'&lt;/td&gt; &lt;td&gt;'.$row['price'].'&lt;/td&gt; &lt;td&gt;'.$row['posted'].'&lt;/td&gt; &lt;/tr&gt;'; }while($row=mysql_fetch_assoc($query)); echo "&lt;/table&gt;"; ?&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt; &lt;/body&gt;&lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
 

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