Hello All,
I am new... to the site and to PHP in general. Please forgive my ineptitude.
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.
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.
I have navigation to filter those results by first letter like "../name.php?bbname=a" but due to my incompetence, it doesn't work.
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
Sorry if my question posing methods are off... THANK YOU!
<?php include "header.php";?>
<?php include "wrap.php";?>
<?php include "left.php";?>
<div id="content">
<div id="ad728x90">
<?php include "ad728x90.php";?>
</div>
<?php include "utilplaces.php";?>
<h1>Places by Name</h1>
<div id="horizon"><a href="?bbname=a">A</a> <a href="?bbname=b">B</a> <a href="?bbname=c">C</a> <a href="?bbname=d">D</a> <a href="?bbname=e">E</a> <a href="?bbname=f">F</a> <a href="?bbname=g">G</a> <a href="?bbname=h">H</a> <a href="?bbname=i">I</a> <a href="?bbname=j">J</a> <a href="?bbname=k">K</a> <a href="?bbname=l">L</a> <a href="?bbname=m">M</a> <a href="?bbname=n">N</a> <a href="?bbname=o">O</a> <a href="?bbname=p">P</a> <a href="?bbname=q">Q</a> <a href="?bbname=r">R</a> <a href="?bbname=s">S</a> <a href="?bbname=t">T</a> <a href="?bbname=u">U</a> <a href="?bbname=v">V</a> <a href="?bbname=w">W</a> <a href="?bbname=x">X</a> <a href="?bbname=y">Y</a> <a href="?bbname=z">Z</a> <a href="?bbname=0">0-9</a></div>
<div class="cnp"></div>
</div>
<div id="biggun">
<?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 "<table id=\"placesstable\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
echo " <col id=\"bbNAME\" />\n";
echo " <col id=\"bbIMG\" />\n";
echo " <col id=\"bbDETAILS\" />\n";
echo " <col id=\"bbHOURS\" />\n";
echo " <col id=\"bbTYPE\" />\n";
echo " <col id=\"bplacesEA\" />\n";
echo " <col id=\"bbRATING\" />\n";
echo " <thead>\n";
echo " <tr>\n";
echo " <th style=\"border: none;\">Name</th>\n";
echo " <th> </th>\n";
echo " <th>Details </th>\n";
echo " <th>Hours</th>\n";
echo " <th>Type</th>\n";
echo " <th>Area</th>\n";
echo " <th> Rating</th>\n";
echo " </tr>\n";
echo " </thead>\n";
echo " <tbody>\n";
while($info = mysql_fetch_array( $data ))
{
echo "<tr>";
echo "<td><p class=\"placesnametable\"><a href=\"#\">".$info['name'] . "</a></p></td> ";
echo "<td><img src=\"".$info['tmbimg']."\" alt=\"\" name=\"placesthumb\" width=\"100\" height=\"67\" class=\"placesthumb\" /></td> ";
echo "<td>".$info['address'] . "<br />\n" .$info['phonenumber'] . "</td>";
echo "<td>".$info['hours'] . "</td> ";
echo "<td>".$info['type'] . "</td> ";
echo "<td>".$info['district'] . "</td> ";
echo "<td>Pending<!--RATING--></td></tr>";
}
echo "</tbody>";
echo "</table>";
?>
</div>
<?php include "feetie.php";?>