Skip to content

Instantly share code, notes, and snippets.

@thepsion5
Created May 16, 2017 19:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thepsion5/b88d4b7a02b3ab6783278d9b817019bd to your computer and use it in GitHub Desktop.
Save thepsion5/b88d4b7a02b3ab6783278d9b817019bd to your computer and use it in GitHub Desktop.
Did you know you can shove entire chunks of HTML into a PHP array key? WELL YOU CAN
<?php
//Formatting and indentation unchanged from original file
$find = $_GET['find'];
$browse = $_GET['browse'];
//More awful code ommitted to preserve the sanity of readers
if(isset($find)) {
$find = addcslashes(mysql_real_escape_string($find), "%_");
$rs = new MySQLPagedResultSet("SELECT * FROM TableName WHERE MATCH (Name) AGAINST ('$find' IN BOOLEAN MODE) ORDER BY Name ASC", 100, $dbConnect);
}
if (isset($browse)){
$rs = new MySQLPagedResultSet("Select * FROM TableName ORDER BY Name ASC", 50, $dbConnect);
$pages = $rs->getPageNav("browse=$browse");
}
?>
<p class="pages"><?=$pages?> </p>
<p><?php if ($rs->getNumPages($results)==0)
{echo "<b>No Matches to Your Search</b>";}
?></p>
<?php
/* ################ Show Results ################ */
while ($row = $rs->fetchArray())
{
/* ################ Group Results ################ */
$set["<div class='title'>".$row['Name']."</div><span class='content_text'>".$row['Address'].", ".$row['City'].", ".$row['State']." ".$row['Zip']."<br />Contact: ".$row['Contact']."<br />Phone: ".$row['Phone']."</span>"][]=$row;
}
foreach ($set as $charity=>$records)
{
?>
<div ><?php echo $charity ;} ?></div>
<p class="pages"><?=$pages?> </p>
<?php }?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment