I have a database I'm building that stores an auto-incrementing ID, URL, Title, and Date. My table name is 'urls'
I need to be able to search the table where the data is stored and return all occurences of rows with URLs matching the search term.
The code I'm using now is:
$query_insert = "SELECT url FROM urls WHERE url='http://www.cnn.com'";
$result = mysql_query($query_insert);
$row = mysql_fetch_row($result);
//show number of results
echo count($row) . '<br>';
//show all results
for($i=0;$i<count($row);$i++){
echo $row[$i] . '<br>';
}
Even though in my table I've purposely set up multiple occurences of the same row with that URL([url]http://www.cnn.com)[/url], its only returning the first record.
However, if I copy/paste that same string into phpMyAdmin, it returns all 3 of the results that are in the database.
What am I doing wrong?