[SOLVED] Geting id of specific column through pages

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Draco_03
Forum Regular
Posts: 577
Joined: Fri Aug 15, 2003 12:25 pm
Location: Montreal, Canada

[SOLVED] Geting id of specific column through pages

Post by Draco_03 »

This is my summary page

Code: Select all

<?php
if(!isset($_SESSION['name'])){
	echo("Need to log in first <a href="index.php">click here</a> to log in");
}else{
	$sql = "SELECT * FROM clients";
	$result = mysql_query($sql);
	$numrows = mysql_num_rows($result);
	
	if ($numrows == 0) {
		echo ("No loaner has been sent");
	}else{ 
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><strong>First Name</strong></td>
    <td><strong>Loaner ID</strong></td>
  </tr>
  <tr>
<?php
	for ($i=0, $numrows=mysql_num_rows($result); $i<$numrows; $i++){
		$row = mysql_fetch_row($result);
		echo("
		<td><a href="confirm/clients.php">$row[1]</a></td>
		<td><a href="confirm/loaners2.php">$row[11]</a></td>
		</tr>
		");
		}
	}
	
	mysql_close($connect);
}
?>
I want that when I click on a clients name (wich is row[1]) it get all the info of the clients.
all I have to get is the clientsid of this perticular clients i cliked on..
how ?

thx
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

add the id to the url of clients.php like so:

confirm/clients.php?id=$row[0]

or whatever column your id appears in...
Draco_03
Forum Regular
Posts: 577
Joined: Fri Aug 15, 2003 12:25 pm
Location: Montreal, Canada

Post by Draco_03 »

I'm speechless
thx man 8)
Post Reply