...

View Full Version : php id code



saad_sinpk
05-21-2011, 10: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;
}else{
$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>
</strong></td>

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

saad_sinpk
05-21-2011, 06: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

tangoforce
05-21-2011, 07:31 PM
Hello

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

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

Fou-Lu
05-30-2011, 12: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.

tangoforce
05-30-2011, 04: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))



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum