What I need to accomplish: I have an eCommerce site like Amazon. You can post your items on there. But now let's say a different user wants to buy a product, like Xbox, for example. Once they search for it, a list of results is pulled up from all users selling their Xboxes. Now, I've got the list pulling up all users selling their Xboxes, but I am stuck on linking to each user's post page. In another words, I can't get the link working right. The link here is the variable $list.
I only need a hint as far as what am I doing wrong, since I would like to figure this out and learn from it.
$query = "SELECT * FROM `posts` WHERE `post_title` LIKE '%".mysql_real_escape_string($search)."%' $limit";
$queryrun = mysqli_query($conn, $query);
$query_num_rows = mysqli_num_rows($queryrun);
if ($query_num_rows>=1)
{
echo $query_num_rows. ' results found:<br>' . '<hr>';
while ($query_row = mysqli_fetch_array($query_run, MYSQLI_ASSOC))
{
$availablesITEMS1 = $query_row['useid'];
$availablesITEMS2 = $query_row['posttitle'];
$availablesITEMS3 = $query_row['post_desc'];
echo $availablesITEMS1 . '.) ' . $availablesITEMS2 . ' <br>' .$availablesITEMS3 . '<br>' . '<hr>';
echo $list .= '<a href="userpostspage.php?id='.$availablesITEMS1.'"> "Click here"</a>'.'<br>'.'<br>';
}
}
else
{
echo 'No result found' . '<hr>';
}
} else {
echo 'Not enough keywords to predict your search' . '<hr>';
}
}