Jump to content

Ameslee

Members
  • Posts

    131
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Ameslee's Achievements

Member

Member (2/5)

0

Reputation

  1. Thanks, i knew it would be something simple as that...stupid me.
  2. <?php if(isset($_GET['search'])){ echo "Search Results<br>"; $hostname = localhost; $username = ; $password = ; $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 "<a href=\"display_services.php?id=".$row['service2id']."\">" .$row['name']. "</a><br>"; } } if(isset($_GET["search2"])){ echo "Search Results<br>"; $hostname = localhost; $username = ; $password = ; $conn = mysql_connect($hostname, $username, $password) or die(mysql_error()); $connection = mysql_select_db("greenac_VORNExpo", $conn); $search2 = $_GET["search2"]; $sql = mysql_query("SELECT * FROM services WHERE category LIKE '%".$search2."%';") or die(mysql_error()); while ($row = mysql_fetch_array($sql)){ // display results echo "<a href=\"display_services.php?id=".$row['service2id']."\">" .$row['name']. "</a><br>"; } } echo "<p>Find a Service here. </p>"; for ($i = 'A'; $i != 'AA'; $i++){ echo "<a href = \"?search=$i\"> $i </a>"; } ?> </p> <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>'; } ?> Ok i have a a-z list, where if u click on a letter it looks up every record with that letter, straight forward enough. Then i have a list of categories......some records are not being displayed when they should. If you click on a category it looks up the category field to see if that category is there, then displays the record. Some records have all categories, so in that field, "all" is entered. If a record has "all" it is not displayed if any of the categories are clicked on. how can i fix the above code so if a record as "all" in the category field, it is displayed no matter what category is picked? hope this makes sense....
  3. what else do u want to know, obviously i havent explained myself, please ask questions
  4. do u understand what i am trying to do now?
  5. 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?
  6. 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
  7. ok still the same error is this right: $row[1] .= <a href="news.php?id={$row[1]}>Read More[/url]
  8. i keep getting this error now: Parse error: syntax error, unexpected '<' in /home/greenac/public_html/events.php on line 260 line 260 is the last line so its probably this line that was just put in: $row[1] .= <a href="news.php?id=<?=$row[1];?>>Read More[/url]
  9. ok thanks i have that: here is the code now: <?php $hostname = localhost; $username = ; $password = ; $conn = mysql_connect($hostname, $username, $password) or die(mysql_error()); $connection = mysql_select_db("greenac_VORNExpo", $conn); $query = "SELECT * FROM news"; $mysql_result=mysql_query($query,$conn); $nothingInDatabase= true; $i=1; echo("<table width=100%>"); while(($row = mysql_fetch_array($mysql_result)) && ($i<=2)){ if ($nothingInDatabase) $nothingInDatabase = false; $row[1] = wordwrap($row[1], 80, '<br />', true); if (strlen($row[1]) > 100) { $row[1] = substr($row[1],0,100); $row[1] .= "<a href=\"news.php\"> More</a>"; } echo "<tr>"; echo "<td>$row[1]<hr></td></tr>"; $i++; } if ($nothingInDatabase == true) { echo "<tr><td>Please check back later for entries</td></tr>"; } ?> and the code for news.php <?php $hostname = localhost; $username = ; $password = ; $conn = mysql_connect($hostname, $username, $password) or die(mysql_error()); $connection = mysql_select_db("greenac_VORNExpo", $conn); $query = "SELECT * FROM news"; $mysql_result=mysql_query($query,$conn); $nothingInDatabase= true; echo("<table width=100%>"); while ($row = mysql_fetch_array($mysql_result)) { if ($nothingInDatabase) $nothingInDatabase = false; $row[1] = wordwrap($row[1], 80, '<br />', true); echo "<tr>"; echo "<td>$row[1]</td></tr>"; } if ($nothingInDatabase == true) { echo "<tr><td>Please check back later for entries</td></tr>"; } ?> How do i display only one record at a time on the news.php page after clicking on the more link on the event.php. hope u can understand this?
  10. news.php <?php $hostname = localhost; $username = ; $password = ; $conn = mysql_connect($hostname, $username, $password) or die(mysql_error()); $connection = mysql_select_db("greenac_VORNExpo", $conn); $query = "SELECT * FROM news"; $mysql_result=mysql_query($query,$conn); $nothingInDatabase= true; echo("<table width=100%>"); while ($row = mysql_fetch_array($mysql_result)) { if ($nothingInDatabase) $nothingInDatabase = false; $row[1] = wordwrap($row[1], 80, '<br />', true); echo "<tr>"; echo "<td>$row[1]</td></tr>"; } if ($nothingInDatabase == true) { echo "<tr><td>Please check back later for entries</td></tr>"; } ?>
  11. ok sure, at the moment i have to records showing, which is a paragraph of text. Only a certain amount is showed on the first page and once you click on the more link i was hoping for it to only display the rest of the content for that particualr record, but at the moment it is displaying both records when the more link is clicked. Second problem is the spacing between records, i have a <hr> but it seems to be displaying in the wrong spot - above the records instead of in between. Hope i have explained myself better. thanks
  12. <?php $hostname = localhost; $username = ; $password = ; $conn = mysql_connect($hostname, $username, $password) or die(mysql_error()); connection = mysql_select_db("greenac_VORNExpo", $conn); $query = "SELECT * FROM news"; $mysql_result=mysql_query($query,$conn); $nothingInDatabase= true; $i=1; echo("<table width=100%>"); while(($row = mysql_fetch_array($mysql_result)) && ($i<=2)){ if ($nothingInDatabase) $nothingInDatabase = false; $row[1] = wordwrap($row[1], 80, '<br />', true); if (strlen($row[1]) > 100) { $row[1] = substr($row[1],0,100); $row[1] .= "<a href=\"news.php\"> More</a>"; } echo "<tr>"; echo "<td>$row[1]</td></tr>"; echo "<hr>"; $i++; } if ($nothingInDatabase == true) { echo "<tr><td>Please check back later for entries</td></tr>"; } ?> Ok i have two problems - there isnt any space between the records, and i have 2 records displaying and once the more link is pressed, both of the records are displayed on the page in full, where i wont one displayed at a time. hope this makes sense.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.