Created
May 16, 2017 19:11
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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