eMoneySpace
Welcome, Guest. Please login or register.
Did you miss your activation email?
News: Welcome to eMoneySpace! Aug 12, 2022 06:46 am




A users php code
Print
Author Topic: A users php code  (Read 722 times)
nightlocker
Reputation: (0)
*

Offline

Gender: Male
Posts: 132
Referrals: 0

View Profile WWW
Apr 23, 2010 09:08 am

I'm trying to create a php code through which the details of a user who is logged in can be shown. For example, I have the age of a user and when he logs in, I want it to be shown in his profile.

Here's a code but its only for a single user whose details will be shown to every user:

Quote
<?php
$con = mysql_connect("localhost","peter","abc123");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("my_db", $con);

$result = mysql_query("SELECT * FROM Persons
WHERE FirstName='Peter'");

while($row = mysql_fetch_array($result))
  {
  echo $row['FirstName'] . " " . $row['age'];
  echo "<br />";
  }
?>

Any help?
« Last Edit: Apr 23, 2010 09:12 am by nightlocker » Logged

Print
 
Jump to:  
Copyright © 2008-2022 eMoneySpace. All rights reserved.