I'm trying to implement a hashtag system into my website. I have it set so user input that has a hashtag gets converted into a link to hashtag.php?q=%23$1 that echo's "Results for '.$_GET["q"].':"; which works fine, but it doesn't actually display any posts. For example, I have a post saying "This #website sucks" which is echoed out as
This <a href="hashtag.php?q=%23website">#website</a> sucks
But the following page only displays
Results for #website:
and the rest is blank. Here's my code for hashtag.php:
echo 'Results for '.$_GET["q"].':';
$connect = mysql_connect("localhost","root","");
mysql_select_db("database",$connect);
$mysql = "SELECT * FROM table WHERE input LIKE '".$_GET['q']."' ";
$myData = mysql_query($mysql, $connect);
while ($record = mysql_fetch_array($myData)){
echo $record['input'];
}
I'm working on using mysqli before I make the site public by the way.
'; DROP TABLE table'for$_GET[q]?ext/mysqldoes not allow multiple queries to be executed with one function simultaneously. However, he should use properly parameterized queries to prevent injection.