Note that there are some explanatory texts on larger screens.

plurals
  1. POdisplaying accurate results
    primarykey
    data
    text
    <p>I'm creating a web site directory for my mobile site (<a href="http://www.xclo.mobi/xclo2" rel="nofollow">FOUND HERE</a>)</p> <p>I have figured out how to display listings from my mysql table to my home page from my tables promo_cat list. </p> <p>The thing im having trouble with is this: </p> <p>once clicking on one of the catagories it leads me to my list.php page. </p> <p>How do I get this page to display results related to the category clicked and not others?</p> <p>For example:when clicking on "FREE" brings up this page: <a href="http://www.xclo.mobi/xclo2/list.php?id=FREE" rel="nofollow">http://www.xclo.mobi/xclo2/list.php?id=FREE</a>. Which displays all results. it should only display results that have a promo_cat field as "FREE" and should not display any other results as it does currently. </p> <p><strong>My list.php code:</strong></p> <pre><code>&lt;?php include_once('include/connection.php'); include_once('include/article.php'); $article = new article; $articles = $article-&gt;fetch_all(); ?&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;xclo mobi&lt;/title&gt; &lt;link rel="stylesheet" href="other.css" /&gt; &lt;/head&gt; &lt;body&gt; &lt;?php include_once('header.html'); ?&gt; &lt;div class="container"&gt; &lt;a href="index.php" id="logo"&gt;Category = ???&lt;/a&gt; &lt;ol&gt; &lt;?php foreach ($articles as $article) { ?&gt; &lt;div class="border"&gt; &lt;a href="single.php?id=&lt;?php echo $article['promo_title']; ?&gt;" style="text-decoration: none"&gt; &lt;img src="&lt;?php echo $article['promo_image']; ?&gt;" border="0" class="img" align="left"&gt;&lt;br /&gt; &lt;a href="&lt;?php echo $data['promo_link']; ?&gt;" target="_blank"&gt;&lt;img alt="" title="" src="GO.png" height="50" width="50" align="right" /&gt;&lt;/a&gt; &lt;font class="title"&gt;&lt;em&gt;&lt;center&gt;&lt;?php echo $article['promo_title']; ?&gt;&lt;/center&gt;&lt;/em&gt;&lt;/font&gt; &lt;br /&gt;&lt;br /&gt; &lt;font class="content"&gt;&lt;em&gt;&lt;center&gt;&lt;?php echo $article['promo_content']; ?&gt;&lt;/center&gt;&lt;/em&gt;&lt;/font&gt; &lt;/div&gt;&lt;br/&gt;&lt;br /&gt; &lt;/a&gt; &lt;?php } ?&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><strong>/include/article.php</strong></p> <pre><code>&lt;?php class article { public function fetch_all(){ global $pdo; $query = $pdo-&gt;prepare("SELECT * FROM mobi"); $query-&gt;execute(); return $query-&gt;fetchAll(); } public function fetch_data($promo_title) { global $pdo; $query = $pdo-&gt;prepare("SELECT * FROM mobi WHERE promo_title = ?"); $query-&gt;bindValue(1, $promo_title); $query-&gt;execute(); return $query-&gt;fetch(); } } ?&gt; </code></pre>
    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.
 

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