Posted: Sun Jan 25, 2004 1:16 am
host your own site! lol
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Here is the code that I using:Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/derek/www/profile/aim.php on line 45<br />
Code: Select all
<?php
// AIM Automatic-Answering Machine/Logger v1.0
//
// Code in your aim profile should look like this:
//<A HREF="http://www.halo-source.com/aim.php?T4=%n"
// TARGET="_self">Click Here</a>
//
// get user's IP Address
$userip = getenv("REMOTE_ADDR");
//mysql information
$dbusername='derek';
$dbpassword='*********';
$hostname='localhost';
$databasename='aim';
// connect
$link1 = mysql_connect($hostname, $dbusername, $dbpassword);
//get db
if (!mysql_select_db($databasename, $link1)) {
echo "error with db";
exit();
}
// get current time and date
$time1 = date("h:i a");
$date1 = date("d/m/Y");
// sql statement to insert values
$addstmt = "Insert into tablename(ip, time, date, screenname) values('%s', '%s', '%s', '%s')";
// code in case there is an error inserting
if (!mysql_query(sprintf($addstmt, $userip, $time1, $date1, $T4), $link1)) {
$flag1 = 1;
}
// sql to check to see how many times the user has viewed the profile
$result = mysql_query("select * from aimlist where screename = '".$T4."'");
// count the number of recs
$countthis = 0;
while ($row = mysql_fetch_array($result)) {
$countthis = $countthis + 1;
// you can do other things in here as well
// such as print out all the dates and times the user has viewed
}
// now print out the personalized message for each user
// you can easily put this in another table
// this will be done in the next version
echo "<BR>You have looked at my profile ${countthis}";
echo "times.<BR>";
echo "Screenname: <b>${T4}</b><BR>";
echo "IP: <b>${userip}</b><BR>";
echo "</body>";
echo "</html>";
?>You can see that the "You looked at my profile X times.", isn't working either..<br />
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/derek/www/profile/aim.php on line 45<br />
You have looked at my profile 0times.
Screenname: w0lverne
IP: 24.199.6.***