Jump to content

[SOLVED] query by url parameter


Meekay

Recommended Posts

I'm creating a simple master/details 2 page setup.  The first page has a list of names and photos, and the second reveals the details for that person.

 

I've added this on the master page...

 

<a href="actor_detail.php?recordID=<?php echo $row_actorslist['submission_id']; ?>"><?php echo $row_actorslist['name']; ?></a>

 

So the user is taken to the actor_detail.php page and the 'submission_id' value is carried in the url (i think).

 

Then on the detail page i have...

 

<?php require_once('Connections/actors.php'); ?>
<?php
mysql_select_db($database_actors, $actors);
$query_actordetail = "SELECT * FROM ft_form_1";
$actordetail = mysql_query($query_actordetail, $actors) or die(mysql_error());
$row_actordetail = mysql_fetch_assoc($actordetail);
$totalRows_actordetail = mysql_num_rows($actordetail);
?><!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>Untitled Document</title>
</head>

<body>
<?php echo $row_actordetail['submission_id']; ?>
<?php echo $row_actordetail['name']; ?>
<?php echo $row_actordetail['email']; ?>
<?php echo $row_actordetail['age']; ?>
<?php echo $row_actordetail['eyes']; ?>
<?php echo $row_actordetail['hair']; ?>
<?php echo $row_actordetail['accents']; ?>
<?php echo $row_actordetail['training']; ?>
</body>
</html>
<?php
mysql_free_result($actordetail);
?>

I just need to know how to link the value in the url to this page, so it displays the record with that ID.

 

Pleeeeeeeeeeeeeeease...

 

Thanks,

 

 

 

Link to comment
Share on other sites

Something like:

 

<a href=actor_detail.php?profile=$row_actorslist['submission_id'];>Person</a>

 

Then on your other page you will have something like:

 

$profile = $_GET['profile'];

 

That sets $profile to your $row_actorslist['submission_id'] which should be in your url. Then use that variable to do whatever you need that id for.

Link to comment
Share on other sites

You said when you click on a name/photo you want it to take you to another page where it displays the information for that person, correct? If so, you need to do what I posted above to achieve this. This way you pass the id for the person chosen to the next page and then grab that value out of the url so that you can take out the information in the database that matches that id. Make sense?

Link to comment
Share on other sites

I already have this

 

<td><a href="actor_detail.php?recordID=<?php echo $row_actorslist['submission_id']; ?>"><?php echo $row_actorslist['name']; ?></a></td>

 

Which i'm almost certain will put the 'submission_id' value into a url parameter called 'recordID'...

 

It confuses me that you want to change this part of the code.

 

Could you tell me simply (in code) how to call that parameter on the details page and then run a query based on it that will bring up the values for that one record...

 

My apologies if i'm being infuriating. 

 

Link to comment
Share on other sites

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.