PDA

View Full Version : [PHP MySQL] Query Problems



jw06
February 26th, 2005, 11:24 AM
Alright, I am trying to make a script that will automaticly update some URL's in a table. I've used this format of a query in order to get the content before, but this time its only returning the number of entries in the table.



$query = "SELECT COUNT(*) AS url FROM urls";
if ($r = mysql_query($query)) {
while ($row = mysql_fetch_array ($r)) {
$url = $row['url'];
echo "$url";
$gather = new Harvest_Keywords($url);
$gather->process();
}
} else {
die ('Error: ' . mysql_error() . '');
}


Any ideas on what I'm doing wrong?

pixelisfun
February 26th, 2005, 12:07 PM
use "SELECT * " instead of "SELECT COUNT(*) ", obviously what select count does is just count...

four1seven
February 26th, 2005, 12:19 PM
;)

Don't ya hate silly mistakes :)

pixelisfun
February 26th, 2005, 12:25 PM
it happens all the time :P me first

SlowRoasted
February 26th, 2005, 12:31 PM
yeah i do dumb stuff too:)

jw06
February 26th, 2005, 02:18 PM
Yea, dumb mistake :( Now it wont happen again though, thanks for pointing it out guys! lol