After around 20 years of not working with PHP\MySQL, it appears I am in need of a little assistance (as I have forgotten most of what I knew) to point me in the proper direction.

What I have is a basic search field that automatically pulls information from MySQL once the user enters a couple of letters in the field. The data is quiered against certain colums in the database table (in this case it pulls from the name, street and city). For instance if a user enters "bad" it displays 2 venues that have "bad" in the name and echos the pertinent information below the search field. When the user adds an additional "a" at the end of "bad" one of the venues goes away leaving only 1 behind. The echoed information has hyperlinked venue names which leads me into what I need it to do (and where I am stumped).

What I require is when a user clicks on the hyper-linked venue name, the data for that venue is displayed in a new page. The data fields would be: name, address, city, website, email, info, event, categories and their logo (which is stored in the database as a BLOB). Yes, I know that it's quicker to reference to the logo file in the database and keep the image as a file in a directory, but that's not how the person wants it done not to mention the logo files are quite small (~60k each).

Below is the search code with the data ID echoing back for my own reference until it is no longer required to echo back. What I do know is the information will need to be placed into arrays and then read from the arrays utilizing the DB table ID. Which is where I find myself running in circles for such a basic (and archaeic) task.


include_once ('mdbconn.php');

    $keyword =  trim($_GET['keyword']) ;
$keyword = mysqli_real_escape_string($dbc, $keyword);

$query = "select id,venue,category,city,address,info,event from buffnoa where venue like '%$keyword%' or category like '%$keyword%' or address like '%$keyword%' or city like '%$keyword%'";

//echo $query;
$result = mysqli_query($dbc,$query);
          while($r = mysqli_fetch_array($result,MYSQLI_ASSOC)){
     echo '<p>' .$r['id'].' <b><a href>'.$r['venue'].'</a></b> '.$r['address'].' </br>'.$r['city'].'</p>' ;
    }else {
        echo 'No Results for :"'.$_GET['keyword'].'"';

}else {
    echo 'Parameter Missing';

5 Years
Discussion Span
Last Post by Iggy54945

use the query string to pass the venue id to the generic venue display page, make your <a> tags ref that page with "?id=xxx" at the end, from the venue page fetch that xxx value and query your db for that specific venue, and display that venue's fields as you like.

$myvar = $_GET['id']; and thus
Select * FROM table WHERE field='$myvar'

Edited by Philippe.Lahaie: typo


As Philippe said, you have to pass a value to your <a href=''>

echo '<p>' .$r['id'].' <b><a href="yourPage?venue='.$r['yourId'].'">'.$r['venue'].'</a></b> '.$r['address'].' </br>'.$r['city'].'</p>' ;

Then you have to get the value from yourPage?venue=yourID

$venueId = $_GET['yourId']
`SELECT * FROM table WHERE field = mysql_real_escape_string($venueId);`

After this, you just have to read the data from the Database.

Edited by Szabi Zsoldos


Thank you both for the input. It was enough to get me steered in the proper direction.

Being almost 20 years since last using PHP, I remember why I enjoyed scripting with it.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.