Note that there are some explanatory texts on larger screens.

plurals
  1. POLow Level PHP Variable Passing Question
    primarykey
    data
    text
    <p>I am new... to the site and to PHP in general. Please forgive my ineptitude. </p> <p>Anyway, I tried poring over the tagged posts for "passing" "variables" etc. Got some bites, but not exactly what I need. Unfortunately, I learn things by reverse engineering, so like many, I've been going around stealing snippets of PHP and adapting to my needs. Makes for some huge gaps in the learning process that I need to fill in.</p> <p>Anyway, I have a page that I put together and it's pulling a bunch of nicely ordered records from the DB I made. I have them displaying the way I like using ASC in the query.</p> <p>I have navigation to filter those results by first letter like "../name.php?bbname=a" but due to my incompetence, it doesn't work.</p> <p>I think the method I have for constructing the query may be too inflexible?? I am including my junky code below with commented out areas to show what I'm trying to get at. I donm't know why I have two queries included. It's as if I have one sitting there just "waiting" for the passed info. I assume I should just re-work the original query to lay in waiting for the GET stuff yet to still put together the large SELECT ALL</p> <p>Sorry if my question posing methods are off... THANK YOU!</p> <pre><code>&lt;?php include "header.php";?&gt; &lt;?php include "wrap.php";?&gt; &lt;?php include "left.php";?&gt; &lt;div id="content"&gt; &lt;div id="ad728x90"&gt; &lt;?php include "ad728x90.php";?&gt; &lt;/div&gt; &lt;?php include "utilplaces.php";?&gt; &lt;h1&gt;Places by Name&lt;/h1&gt; &lt;div id="horizon"&gt;&lt;a href="?bbname=a"&gt;A&lt;/a&gt; &lt;a href="?bbname=b"&gt;B&lt;/a&gt; &lt;a href="?bbname=c"&gt;C&lt;/a&gt; &lt;a href="?bbname=d"&gt;D&lt;/a&gt; &lt;a href="?bbname=e"&gt;E&lt;/a&gt; &lt;a href="?bbname=f"&gt;F&lt;/a&gt; &lt;a href="?bbname=g"&gt;G&lt;/a&gt; &lt;a href="?bbname=h"&gt;H&lt;/a&gt; &lt;a href="?bbname=i"&gt;I&lt;/a&gt; &lt;a href="?bbname=j"&gt;J&lt;/a&gt; &lt;a href="?bbname=k"&gt;K&lt;/a&gt; &lt;a href="?bbname=l"&gt;L&lt;/a&gt; &lt;a href="?bbname=m"&gt;M&lt;/a&gt; &lt;a href="?bbname=n"&gt;N&lt;/a&gt; &lt;a href="?bbname=o"&gt;O&lt;/a&gt; &lt;a href="?bbname=p"&gt;P&lt;/a&gt; &lt;a href="?bbname=q"&gt;Q&lt;/a&gt; &lt;a href="?bbname=r"&gt;R&lt;/a&gt; &lt;a href="?bbname=s"&gt;S&lt;/a&gt; &lt;a href="?bbname=t"&gt;T&lt;/a&gt; &lt;a href="?bbname=u"&gt;U&lt;/a&gt; &lt;a href="?bbname=v"&gt;V&lt;/a&gt; &lt;a href="?bbname=w"&gt;W&lt;/a&gt; &lt;a href="?bbname=x"&gt;X&lt;/a&gt; &lt;a href="?bbname=y"&gt;Y&lt;/a&gt; &lt;a href="?bbname=z"&gt;Z&lt;/a&gt; &lt;a href="?bbname=0"&gt;0-9&lt;/a&gt;&lt;/div&gt; &lt;div class="cnp"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div id="biggun"&gt; &lt;?php // Connects to the Database mysql_connect("localhost","user","password") or die(mysql_error()); mysql_select_db("databasename") or die(mysql_error()); // I AM TRYING TO GRAB THE VARIABLES FROM THE URL BUT HAVE NO CLUE $bbname = $_GET['bbname']; // THIS IS THE STANDARD DB QUERY TO SETUP THE PAGE IN DEFAULT LOAD $data = mysql_query("SELECT * FROM places ORDER BY `places`.`name` ASC LIMIT 0, 30 ") or die(mysql_error()); echo "&lt;table id=\"placesstable\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"&gt;\n"; echo " &lt;col id=\"bbNAME\" /&gt;\n"; echo " &lt;col id=\"bbIMG\" /&gt;\n"; echo " &lt;col id=\"bbDETAILS\" /&gt;\n"; echo " &lt;col id=\"bbHOURS\" /&gt;\n"; echo " &lt;col id=\"bbTYPE\" /&gt;\n"; echo " &lt;col id=\"bplacesEA\" /&gt;\n"; echo " &lt;col id=\"bbRATING\" /&gt;\n"; echo " &lt;thead&gt;\n"; echo " &lt;tr&gt;\n"; echo " &lt;th style=\"border: none;\"&gt;Name&lt;/th&gt;\n"; echo " &lt;th&gt;&amp;nbsp;&lt;/th&gt;\n"; echo " &lt;th&gt;Details &lt;/th&gt;\n"; echo " &lt;th&gt;Hours&lt;/th&gt;\n"; echo " &lt;th&gt;Type&lt;/th&gt;\n"; echo " &lt;th&gt;Area&lt;/th&gt;\n"; echo " &lt;th&gt; Rating&lt;/th&gt;\n"; echo " &lt;/tr&gt;\n"; echo " &lt;/thead&gt;\n"; echo " &lt;tbody&gt;\n"; while($info = mysql_fetch_array( $data )) { echo "&lt;tr&gt;"; echo "&lt;td&gt;&lt;p class=\"placesnametable\"&gt;&lt;a href=\"#\"&gt;".$info['name'] . "&lt;/a&gt;&lt;/p&gt;&lt;/td&gt; "; echo "&lt;td&gt;&lt;img src=\"".$info['tmbimg']."\" alt=\"\" name=\"placesthumb\" width=\"100\" height=\"67\" class=\"placesthumb\" /&gt;&lt;/td&gt; "; echo "&lt;td&gt;".$info['address'] . "&lt;br /&gt;\n" .$info['phonenumber'] . "&lt;/td&gt;"; echo "&lt;td&gt;".$info['hours'] . "&lt;/td&gt; "; echo "&lt;td&gt;".$info['type'] . "&lt;/td&gt; "; echo "&lt;td&gt;".$info['district'] . "&lt;/td&gt; "; echo "&lt;td&gt;Pending&lt;!--RATING--&gt;&lt;/td&gt;&lt;/tr&gt;"; } echo "&lt;/tbody&gt;"; echo "&lt;/table&gt;"; ?&gt; &lt;/div&gt; &lt;?php include "feetie.php";?&gt; </code></pre>
    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.
    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