Skip to content

Instantly share code, notes, and snippets.

@vineeth030
Last active July 21, 2016 07:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vineeth030/755585d569f40eb7cd7dbac5ad7512f6 to your computer and use it in GitHub Desktop.
Save vineeth030/755585d569f40eb7cd7dbac5ad7512f6 to your computer and use it in GitHub Desktop.
// *Check to see if someone has clicked on a word out of the description text on the video page.*
// *If they have then do a search for that term.*
if(isset($_GET["term"]))
{
$termid = $_GET["term"];
if(is_numeric($termid))
{
zpConnectDB('zanesitecontent');
$sql = "SELECT g.id, g.term, t.name as topic, g.description FROM glossary AS g
INNER JOIN Topics AS t ON (t.productid = g.topic)
WHERE g.id = " . mysql_real_escape_string($termid) . "
" . ($subject == 0?"":"AND t.subject = " . mysql_real_escape_string($subject)) . "
" . ($category == 0?"":"AND t.category = " . mysql_real_escape_string($category)) . "
" . ($topic == 0?"":"AND t.productid = " . mysql_real_escape_string($topic)) . "
ORDER BY t.name, g.term";
$result = mysql_query($sql) OR $debugContent .= debugMysql(mysql_error(),$sql);
$rowCount = mysql_num_rows($result);
while($row = mysql_fetch_array($result))
{
array_push($results, array("topic" => $row["topic"], "term"=>$row["term"], "id" => $row["id"], "description" => $row["description"]));
}
$smarty->assign('rowCount', $rowCount);
$smarty->assign('searchResults', $results);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment