maxso Posted December 25, 2008 Share Posted December 25, 2008 <html> <head /> <body> <?php $ip=$_SERVER['REMOTE_ADDR']; $con=mysql_connect('***************','********','********'); mysql_select_db('***********'); $get=mysql_query("SELECT ip FROM id1 WHERE IP='$ip'"); $ip_exist=mysql_num_rows($get); $sql = "INSERT INTO id1 (IP, count) VALUES ('$ip', '1')"; if($ip_exist > 0){ echo "welcome again"; $result = mysql_query("UPDATE id1 SET count=count+1 WHERE ip='$ip'") or die(mysql_error()); } else { mysql_query($sql) or die(mysql_error()); } ?> </body> </html> This is my page for the users profile. My problem is that i want it to go to profile.php?user=<id number>. When it goes onto that, I want the table to switch to id<id number>. How can i do this? Link to comment https://forums.phpfreaks.com/topic/138401-profilephp/ Share on other sites More sharing options...
zangeel Posted December 25, 2008 Share Posted December 25, 2008 like this <?php $ip=$_SERVER['REMOTE_ADDR']; $con=mysql_connect('***************','********','********'); mysql_select_db('***********'); $get=mysql_query("SELECT ip FROM id1 WHERE IP='$ip'"); $ip_exist=mysql_num_rows($get); $sql = "INSERT INTO id1 (IP, count) VALUES ('$ip', '1')"; if($ip_exist > 0){ echo "welcome again"; $result = mysql_query("UPDATE id1 SET count=count+1 WHERE ip='$ip'") $resulted = mysql_query("select * from `id1`"); $row = mysql_fetch_assoc($resulted); or die(mysql_error()); Header (Location: "profile.php?user=" . $row['id']); } and for the profile.php you need something like if (isset($_GET['user'])) { $user = mysql_real_escape_string($_GET['user']); $q1 = mysql_query("select something from someththing WHERE something = 'user'"); $row = mysql_fetch_assoc($q1); echo "welcome here's ur profile"; echo $row['mysql row here']; } else { echo 'invalid url'; } Link to comment https://forums.phpfreaks.com/topic/138401-profilephp/#findComment-723652 Share on other sites More sharing options...
maxso Posted December 25, 2008 Author Share Posted December 25, 2008 What should i call the top half? Link to comment https://forums.phpfreaks.com/topic/138401-profilephp/#findComment-723666 Share on other sites More sharing options...
9three Posted December 25, 2008 Share Posted December 25, 2008 Whatever you like. Just make sure that the user starts from the top part of the code otherwise it will not work properly. Link to comment https://forums.phpfreaks.com/topic/138401-profilephp/#findComment-723705 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.