Hey there
I'd appreciate some help with variables please.
I have a search function on a site I'm building and would like to have it so that a user can click on a search result to see more columns from that row on the db, if you see what I mean. The best way seems to be to open a new page on which to display more detail on the chosen search result.
I express it like this
echo '<a href="newpage.php?w=' . $row['value'] . '">' . $r['value'] . '</a>';
That part works fine.
The problem is this - when I click through to the new page, all rows on the db are shown i.e. the search is made, result x is returned, click on x and in newpage.php x y and z (i.e. all rows) are displayed.
How do I structure things so that only x (and any other columns from row x that I choose) are displayed?
I'm thinking that I should be able to limit what it displayed with the SELECT but can't seem to find the right syntax to finish it off properly. Currently I have this on newpage.php
$query = "SELECT * FROM pro_words".$_SESSION['where clause'];
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo '<center>' . $_GET['w'] . '</center> ';
echo $row['word'] ;
}
I have defined the $_SESSION on search.php as
$_SESSION['word'] = $row['word']
Is that on the right lines?
I know a little PHP, enough to know where the problem is but not quite enough to solve the problem. I've not found an answer yet after hours of googling!
Any help/guidance/code would be really appreciated.
Thanks in advance.