View Full Version : php id code

05-21-2011, 11:51 AM
i have little knowledge in php
i am having problem in this code, i want to make link like ?id=1 something like this and it should show the detail of that id here is my code

<?php if(isset($_GET['pool_id'])){
$pool_id = $_GET['pool_id'];
$pool_id = mysql_real_escape_string($pool_id);
$sql = "SELECT * FROM creat_survivor WHERE pool_id = '$pool_id'";
echo saad;
$sql = "SELECT * FROM creat_survivor ORDER BY id DESC";


<?php while($row = mysql_fetch_array($result))
{ ?>
<td class="iconColumn"><a href="?id=<?php echo $row['pool_id'] ?>" title="<?php
$row['pool_name'] ?>"><img src="/icon-survivor.png" alt=""></a></td>
<td class="poolId"><strong><?php echo $row['pool_id']; ?></strong></td>
<td class="dsc"><strong><a href="/survivor/pool/199"
title="<?php echo $row['pool_name']; ?>"><?php echo $row['pool_name']; ?></a>

the problem is that i have make link to ?id=pool_id but don't know how to show data on that page please help me out

05-21-2011, 07:35 PM
any one can u please help me out i really need help i will try to explain u guys again
i need to show different for every different id

05-21-2011, 08:31 PM

Please see the signature in my link. Once you've adjusted your first post maybe someone will help you.

05-29-2011, 10:15 PM
still waiting for reply please any one can help me out

05-30-2011, 01:24 PM
You are not querying for any data. $row will always be false.
I see a sql string, but no resource created from it. You need to execute a mysql_query against it and use that resource ($result from the looks of it) within this code. Other than the missing query, it appears fine, the link has added to it the id= provided with the $row['pool_id'] (assuming that column exists).
It will send it back to this page though, so you'll need to add a new test and output for if the $_GET['id'] isset, and what you want to do with it.

05-30-2011, 05:32 PM
What Fou-Lou means is this:

$sql = "SELECT * FROM creat_survivor ORDER BY id DESC";

//This line is missing
$result = mysql_query($sql);

while($row = mysql_fetch_array($result))