Jump to content

Query problem Please help


whitling

Recommended Posts

I have a members login and i wont a query when the user logs in to show up sertain info.....

 

i have a database with phone logs in that holds something like 500 different phone numbers, i also have a members table that will obviously hold the members info for logging in...member_id, firstname, lastname, login, password, number

 

when a user logs in i wont a query to run that basicly looks at the current user loged in then retreves his number in members table then pulls out all of his number from the phone logs table (there will be multipule entrys for each number in the phone log database)

The code below is the members-index.php (this is what they are sent to once the login is succesfull)

 

<?php

require_once('auth.php');

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Member Index</title>

<link href="loginmodule.css" rel="stylesheet" type="text/css" />

</head>

<body>

<h1>Welcome <?php echo $_SESSION['SESS_FIRST_NAME'];?></h1>

<a href="member-profile.php">My Profile</a> | <a href="logout.php">Logout</a>

<p>This is a password protected area only accessible to members. </p>

</body>

</html>

 

Link to comment
https://forums.phpfreaks.com/topic/176683-query-problem-please-help/
Share on other sites

Get the members number (x)

$result = mysql_query("SELECT x FROM members WHERE id='".$memberId."'");
$row = mysql_fetch_assoc($result);

// use the number to lookup the required records

$result = mysql_query("SELECT * FROM phonelog where x='".$row['x']."'");
// display records
while($row = mysql_fetch_assoc($result)) {

}

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.