Hey everyone, im new to this site but I am somewhat familiar with php. . .
Anyways I am having trouble with this script. Is what it is "supposed" to do is pull top searches from a mysql database.
but it isn't working. this is the error I am getting. . .
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
and here is my script. . .
<?
//connection info
$DBHost = ""; //MySQL-Server
$DBName = ""; //MySQL-Database
$DBUser = ""; //MySQL-Username
$DBPassword = ""; //MySQL-Password
mysql_connect($DBHost, $DBUser, $DBPassword) or
die("Could not connect: " . mysql_error());
mysql_select_db($DBName);
// config
$file_path = "search.php";
$show = 3;
$getlogs = "SELECT word COUNT(*) as quantity FROM stats";
$result = mysql_query($getlogs);
$i = 0;
while ($row = mysql_fetch_array($result)) {
$logs[$i] = substr($logs[$i], 1, -1);
$count[$i] = $row['quantity'];
$i++; if ($i == $show) {break;}
}
echo "<div>Top Searches</div>";
echo "<div>";
for ($i=0; $i<$show; $i++) {
echo "$count[$i]";
}
echo "</div>\n";
?>
does anybody see a problem with this or a different way I should do this?
Thanks in advance!