Searching a Database
Posted: Fri Jun 08, 2007 3:48 am
Here's my code:
If i search Rihanna ($search = "Rihanna";). There are 2 videos in the database by Rihanna. This code only returns the first one.
How would I be able to edit this code to display every video by Rihanna?
Code: Select all
<?php
$search = $_GET['search'];
$server = "localhost";
$user = "***";
$pass = "***";
$db = "***";
mysql_connect($server, $user, $pass) or die(mysql_error());
mysql_select_db($db) or die(mysql_error());
$result = mysql_query("SELECT * FROM vidz
WHERE Artist='$search'") or die(mysql_error());
$row = mysql_fetch_array( $result );
echo "<a href=watch.php?id=".$row['id'].">".$row['Artist']." - ".$row['Track']."</a><br />";
?>How would I be able to edit this code to display every video by Rihanna?