Taktloss
14-01-2005, 15:36
#!/usr/bin/php -q
<?php
$now = time() - 86400;
$month = date('M', $now);
$host = localhost;
$user = traffic;
$db = traffic;
$pw = ********;
$file = fopen("/tmp/xferlog", "r");
mysql_connect($host, $user, $pw);
mysql_select_db($db);
while (!feof($file))
{
$line = fgets($file, 12000);
list($month, $day, $user, $bytes) = explode(" ", $line);
echo "$user $bytes";
$query = "SELECT * FROM ftp WHERE (user = '$user') AND (month = '$month')";
$result = mysql_query(query);
if (mysql_num_rows ($result) > 0)
{
echo "Found $user in table!!!";
}
}
?>
Gibt mir folgenden Fehler:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /root/xferlog.mysql.php on line 22
Ich bin echt am Ende, weis nicht wo der Fehler liegt.
Die tabelle traffic existiert und die Spalte user ebenfalls.
Kann mir bitte jemand helfen?
MfG. Takt
<?php
$now = time() - 86400;
$month = date('M', $now);
$host = localhost;
$user = traffic;
$db = traffic;
$pw = ********;
$file = fopen("/tmp/xferlog", "r");
mysql_connect($host, $user, $pw);
mysql_select_db($db);
while (!feof($file))
{
$line = fgets($file, 12000);
list($month, $day, $user, $bytes) = explode(" ", $line);
echo "$user $bytes";
$query = "SELECT * FROM ftp WHERE (user = '$user') AND (month = '$month')";
$result = mysql_query(query);
if (mysql_num_rows ($result) > 0)
{
echo "Found $user in table!!!";
}
}
?>
Gibt mir folgenden Fehler:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /root/xferlog.mysql.php on line 22
Ich bin echt am Ende, weis nicht wo der Fehler liegt.
Die tabelle traffic existiert und die Spalte user ebenfalls.
Kann mir bitte jemand helfen?
MfG. Takt