Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6

Thread: php id code

  1. #1
    New to the CF scene
    Join Date
    Feb 2010
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    php id code

    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 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
    Last edited by saad_sinpk; 05-21-2011 at 10:36 PM.

  • #2
    New to the CF scene
    Join Date
    Feb 2010
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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

  • #3
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,298
    Thanks
    57
    Thanked 525 Times in 512 Posts
    Blog Entries
    5
    Hello

    Please see the signature in my link. Once you've adjusted your first post maybe someone will help you.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • Users who have thanked tangoforce for this post:

    saad_sinpk (05-21-2011)

  • #4
    New to the CF scene
    Join Date
    Feb 2010
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts
    still waiting for reply please any one can help me out

  • #5
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    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.

  • #6
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,298
    Thanks
    57
    Thanked 525 Times in 512 Posts
    Blog Entries
    5
    What Fou-Lou means is this:
    PHP Code:
    $sql "SELECT * FROM creat_survivor ORDER BY id DESC";

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

    while(
    $row mysql_fetch_array($result)) 
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •