Jump to content

Profile.php


maxso

Recommended Posts

<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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.