firstly..i want to say that i hv search but didnt found..so dont ask me to search..2ndly..anybody have that code share wit me plz..
Profile Last View By...
Collapse
This topic is closed.
X
X
-
that shows it
this updates itCode:$sqlthing = mysql_query("SELECT * FROM last WHERE username='$name'"); $dt=(mysql_result($sqlthing,0,"date")); $by=(mysql_result($sqlthing,0,"who")); //echo " Profile Last Viewed At $dt"; echo " Profile Last Viewed By: $by ";
hope this works for you but it will need slite alteration to your specific scriptCode:sql2 = "UPDATE last SET who='$username' WHERE username='$name'"; $result2 = mysql_query($sql2); $dt = date('Y-m-d H:i:s'); $sql = "SELECT * FROM last where username='$name'"; $result = mysql_query($sql); $number_of_rows = mysql_num_rows($result); if ($number_of_rows=="1") { $sql = "UPDATE last SET date='$dt' WHERE username='$name'"; $result = mysql_query($sql); } if ($number_of_rows=="0") { $dt = date('Y-m-d H:i:s'); $sql11 = "INSERT INTO last (username,date,who) VALUES ('$name','$dt','$username')"; $result11 = mysql_query($sql11); }
Comment
-
///////////index.php (viewuser)
Code:$sqlthing = mysql_query("SELECT * FROM last WHERE username='$name'"); $dt=(mysql_result($sqlthing,0,"date")); $by=(mysql_result($sqlthing,0,"who")); //echo " Profile Last Viewed At $dt"; echo " Profile Last Viewed By: $by ";
//////////where must iput this code?
Code:sql2 = "UPDATE last SET who='$username' WHERE username='$name'"; $result2 = mysql_query($sql2); $dt = date('Y-m-d H:i:s'); $sql = "SELECT * FROM last where username='$name'"; $result = mysql_query($sql); $number_of_rows = mysql_num_rows($result); if ($number_of_rows=="1") { $sql = "UPDATE last SET date='$dt' WHERE username='$name'"; $result = mysql_query($sql); } if ($number_of_rows=="0") { $dt = date('Y-m-d H:i:s'); $sql11 = "INSERT INTO last (username,date,who) VALUES ('$name','$dt','$username')"; $result11 = mysql_query($sql11); }
Comment
-
thats too long mate this is how i do mine
Code:$wid = $_GET["wid"]; $me = userid_sesid($sesid); $update = mysql_query("INSERT INTO mc_users SET last_view='".$me."' WHERE id='".$wid."'")); //fetch last view $lv = mysql_fetch_array(mysql_query("SELECT last_view FROM mc_users WHERE id='".$wid."'")); echo "Last viewed by: ".nick_userid($lb[0]);
R.M.C
----------
PHP Adovocate B)
Comment
-
wut is the sql table for bcfc n mckeny coding?[/b]
Code:-- -------------------------------------------------------- -- -- Table structure for table `last` -- CREATE TABLE `last` ( `username` varchar(30) NOT NULL default '', `date` varchar(50) NOT NULL default '0000-00-00', `who` varchar(30) NOT NULL default '' ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `last` -- -- --------------------------------------------------------
Comment
-
thats too long mate this is how i do mine
Code:$wid = $_GET["wid"]; $me = userid_sesid($sesid); $update = mysql_query("INSERT INTO mc_users SET last_view='".$me."' WHERE id='".$wid."'")); //fetch last view $lv = mysql_fetch_array(mysql_query("SELECT last_view FROM mc_users WHERE id='".$wid."'")); echo "Last viewed by: ".nick_userid($lb[0]);
[/b]
if your using lavalair its best for yu 2 use the code mckeny gave ya as its been coded for it wer as my code came from my script
Comment
-
too easywat about a list of the last 10 users who view ur profile?
am gonna code it....
[/b]
add these two new fields in ibwf_users
in index.php under $action=="viewuser"Code:lastview int(100) NOT NULL default '0' ltime int(100) NOT NULL default '0'
Code:$lv= getuid_sid($sid); $tm = time(); mysql_query("INSERT INTO ibwf_users SET lastview='".$lv."',ltime='".$tm."' WHERE uid='".$who."'")); $sql = (mysql_query("SELECT lastview,ltime FROM ibwf_users WHERE uid='".$who."' ORDER BY ltime DESC LIMIT 10")); while($row = mysql_fetch_array($sql)){ echo "Last viewed by: ".getnick_uid($row[0]); $newtime =$row[1]+(6 *60 *60); echo ".date("D d M y - H:i:s",$newtime). "; echo "------------ "; }
Comment
-
Ha ha,Here is error!Look Parse error: syntax error, unexpected ')' in /home2/lidijama/public_html/proba/index.php on line 2434[/b]Code:mysql_query("INSERT INTO ibwf_users SET lastview='".$lv."',ltime='".$tm."' WHERE uid='".$who."'"));
this shall work:
Code:mysql_query("INSERT INTO ibwf_users SET lastview='".$lv."',ltime='".$tm."' WHERE uid='".$who."'");
Comment


Comment