Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: Show data using ID

  1. #11
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Didn't I give you the code above?
    Code:
    $page_id = $_GET['id'];
    $query = "SELECT * FROM `table_name` WHERE `id`='{$page_id}'";
    $result = mysql_query($query)or die(mysql_error());
    $myrow = mysql_fetch_array($result);
    echo "First Name: $myrow['firstname']";
    echo "<br>Last Name:$myrow['lastname']";
    echo "<br>Nick Name: $myrow['nick']";
    echo "<br>Email address: $myrow['email']";
    echo "<br>Salary: $myrow['salary']";
    And then just add your code.
    Jeremy | jfein.net

  2. #12
    Join Date
    May 2006
    Posts
    266
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    I did what you said and i get this

    
    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/isearch/public_html/podcast/player/xml.php on line 11
    
    I tryed echo and it does not work

    Lets say i am trying to get BBC news RSS feed i have the URL to it in my MySQL database
    I would like away to fetch the rss by ID

    I hope that helps.
    It has to have this for it to work with my Flash Player

    header("content-type:text/xml;charset=utf-8");

    readfile("BBC RSS FEED");
    The web in one word.

  3. #13
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Well, did you replace table-name with your table? And also the field?
    Jeremy | jfein.net

  4. #14
    Join Date
    May 2006
    Posts
    266
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Yes i did all that here is the code

    Code:
    <?php
    header("content-type:text/xml;charset=utf-8");
    include '../include/config.php';
    include '../include/opendb.php';
    ?>
    <?php
    $id = $_GET["id"];
    $sql = "SELECT * FROM podcast WHERE id = $id";
    $result = mysql_query($sql);
    
    
    while($row = mysql_fetch_array($result, MYSQL_ASSOC))
    {
        readfile("{$row['xmllink']}");
    } 
    
    exit();
    
    include 'include/closedb.php';
    
    ?>
    The web in one word.

  5. #15
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Try this:
    PHP Code:
    <?php
    header
    ("content-type:text/xml;charset=utf-8");
    include (
    '../include/config.php');
    include (
    '../include/opendb.php';)
    ?>
    <?php
    $id 
    $_GET["id"];
    $sql "SELECT * FROM `podcast` WHERE `id` = `$id`";
    $result mysql_query($sql);


    while(
    $row mysql_fetch_array($result))
    {
        
    readfile($row['xmllink']);

    include (
    'include/closedb.php');

    exit;



    ?>
    Heres what I changed:
    I added ( and ) to the includes
    Added ` and ` before and after tables/fields[optional]
    Took your MYSQL_ASSOC out.
    Put exit(); under the last include.
    Changed exit() to exit.

    The exit; is not a function, this is most like the die function but does not return a string which is why we don't use the (), it also needs to be above the rest of the code or else everything under it(but ?>) won't work.
    Jeremy | jfein.net

  6. #16
    Join Date
    May 2006
    Posts
    266
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Hi i tryed your code found an error and still have not been able to get it to work...

    Code:
    <?php
    header("content-type:text/xml;charset=utf-8");
    include ('../include/config.php');
    include ('../include/opendb.php');
    ?>
    <?php
    $id = $_GET["id"];
    $sql = "SELECT * FROM `podcast` WHERE `id` = `$id`";
    $result = mysql_query($sql);
    
    
    while($row = mysql_fetch_array($result))
    {
        readfile($row['xmllink']);
    } 
    include ('../include/closedb.php');
    
    exit;
    
    ?>
    The web in one word.

Bookmarks

Posting Permissions

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