Hey guys, this is my first time doing anything with php or sql from scratch.
I have a database called "drivers" with 3 rows. "id" (auto increment), "plate", and "comment"
I have a search box on my page where I can enter a plate number, and I want it to return all comments for that plate, there is multiple rows with the same "plate" but a different "comment".
At the moment I have managed to produce some code that selects the first comment that it finds.
Now im having trouble selecting more than one comment. Do I need to use a loop of some sort?
This is my current code:
<?
include("config.php");
$search=$_POST['search'];
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$result = mysql_query("select comment FROM drivers WHERE plate = '$search'");
$row = mysql_fetch_assoc($result);
echo $row['comment'];
mysql_close();
?>