Jump to content

click on the name of person to get details about "help"


Recommended Posts

hello every body

i have simple script that read from database

mysql_connect($server, $datauser, $datapass) or die (mysql_error());
$result = mysql_db_query($database, "select * from $table order by id asc") or die (mysql_error());

if (mysql_num_rows($result)) {
   echo "Registered People:<ul>";
   while ($qry = mysql_fetch_array($result)) {
     echo "<li><a href=javascript:popUp('$qry[user]')>$qry[name]</a> from $qry[con] <br/> $qry[key]</li><br/>";

   }
}

as you can see it's show simple details about contact's but i want when someone click the name it's open new popup window showing the full details about this person

the problem is that i can't choose the right one every click

that's mean when i click any name it's show the first name in mysql  database i can't let the new page determine the specific person

please any help about this

sorry for my bad english

 

Id suggest using a target _blank in your link, as popups are annoying and at most cases blocked by anti popup software. Anyway the idea in your script is to open a new file, ex profile.php and pass a url variable that may be the id of the user. Im writing the sample without the popup call, but it would give u and idea:

 

echo "<a href='profile.php?id={$qry['id']}'>{$qry['name']}</a>"

 

U can have a profile.php with a standart template for the user (ex. full name, email, phone, description) and fill those values by getting the id of the selected users from the url variable using $_GET.

try this

mysql_connect($server, $datauser, $datapass) or die (mysql_error());
$result = mysql_db_query($database, "select * from $table order by id asc") or die (mysql_error());

if (mysql_num_rows($result)) {
  echo "Registered People:<ul>";
  while ($qry = mysql_fetch_array($result)) {
    echo "<a href=\"some.url?user=".$qry['user']."&name=".$qry['name']."\" target=\"_BLANK\">".$qry['user']." ".$qry['name']."</a> from ".$qry['con']." ".$qry['key']."<br/>";

  }
echo '<ul>';
}

 

Then on the some.url page use the $_GET[''] to pull the values from the url and then use the SELECT from mySQL to print all the database info about that specifc record.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.