Ameslee Posted April 2, 2007 Share Posted April 2, 2007 ok here is my code: <td id="main"> <p>Find a Service here. </p> <p> <?php for ($i = 'A'; $i != 'AA'; $i++){ echo "<a href = \"?search=$i\"> $i </a>"; } if(isset($_GET['search']) && $_GET['search'] != ''){ $hostname = localhost; $username = greenac_Admin; $password = greenac; $conn = mysql_connect($hostname, $username, $password) or die(mysql_error()); $connection = mysql_select_db("greenac_VORNExpo", $conn); $search = $_GET['search']; $sql = mysql_query("SELECT * FROM services WHERE name LIKE '$search"."%'") or die(mysql_error()); while ($row = mysql_fetch_array($sql)){ // display results echo "<br>"; echo "<br><a href=\"display_services.php?id=".$row['service2id']."\">" .$row['name']. "</a><br>"; } } ?> </p></td> </tr> <tr> <td></td> </tr> </table></td> </tr> <tr> <td id="headings" align=left width="100%" colspan=2 height=15> </td> </tr> <tr> <td> <tbody> <tr> <td id="main"><p>OR Choose a Category below:</p> <p> <?php $category = array('Employment', 'Government', 'Training', 'Rehabilitation', 'Accommodation', 'Sport and Leisure', 'Information', 'Personal Support', 'Education', 'Transition to Work', 'Community Participation'); foreach($category as $cat) { echo '<a href="?search2='.$cat.'">'.$cat.'</a> <br>'; } $hostname = localhost; $username = greenac_Admin; $password = greenac; $conn = mysql_connect($hostname, $username, $password) or die(mysql_error()); $connection = mysql_select_db("greenac_VORNExpo", $conn); if (in_array($_GET['search2'],$category)) { $sql = mysql_query("SELECT * FROM services WHERE category LIKE '%".$search2."%';") or die(mysql_error()); while ($row = mysql_fetch_array($sql)){ // display results echo "<br><a href=\"display_services.php?id=".$row['service2id']."\">" .$row['name']. "</a><br>"; } } ?></p> what i want is to display all records above the a-z.....the codes split up into a different table, so is this possible. How do i go about it? i hope u can understand what im trying to do.. thanks Quote Link to comment Share on other sites More sharing options...
Ameslee Posted April 3, 2007 Author Share Posted April 3, 2007 Any ideas? Quote Link to comment Share on other sites More sharing options...
trq Posted April 3, 2007 Share Posted April 3, 2007 i hope u can understand what im trying to do.. Nope. Your question isn't very clear. Whats the problem? Quote Link to comment Share on other sites More sharing options...
Ameslee Posted April 3, 2007 Author Share Posted April 3, 2007 Ok sorry, At the moment i have a a-z list, so the user can click on a letter and a record displays below the a-z list, i also have a list of categories that the user clicks on and it displays all records with that category under the list. what i want is for the record, what ever is click, either a letter or a category, for the record to be displayed above the a-z list or in a different section. does this make sense? Quote Link to comment Share on other sites More sharing options...
Ameslee Posted April 3, 2007 Author Share Posted April 3, 2007 do u understand what i am trying to do now? Quote Link to comment Share on other sites More sharing options...
Ameslee Posted April 4, 2007 Author Share Posted April 4, 2007 what else do u want to know, obviously i havent explained myself, please ask questions Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.