SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Queries Returning Nothing?

    I'm just starting out with mySQL. Using the phpmyadmin provided by my host and a few tutorials, I've created a database, a table, a form and PHP script I used to insert data into the table, and I'm trying to write a page that reads from the table.

    phpmyadmin shows the following record: (I wanted ID to start at 71 and increment from there)

    ID: 71
    IssueDate: 2001-08-15
    IssueHTML: [BLOB]
    IssueText: [BLOB]

    That's it. One record, exactly as I inserted. If I do a dump the IssueHTML and IssueTEXT contain the correct text.

    Now when I run the following script nothing is returned for any of the fields. I've tried playing around with the select statement, nothing I do (removing the limit, adding things) returns anything:

    PHP Code:

    <?

    $sql 
    "SELECT * FROM archive LIMIT 1";

    $connection mysql_connect("database.webshowhost.com","sbnsite_sit","censored")  
        or die (
    "Couldn't connect to server."); 
         
    $db mysql_select_db("sbn"$connection
        or die(
    "Couldn't select database."); 

    $sql_result mysql_query($sql,$connection
        or die(
    "Couldn't add record."); 

    if (
    $sql_result) {
        echo 
    "$ID $IssueDate $IssueHTML $IssueText";
    } else {
        echo 
    "Error!";
    }

    ?>

    Any help would be appreciated greatly.

    --
    Dan

  2. #2
    Serial Publisher silver trophy aspen's Avatar
    Join Date
    Aug 1999
    Location
    East Lansing, MI USA
    Posts
    12,937
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you need to get the variables out of the result set.
    PHP Code:
    while($main mysql_fetch_array($sql_result)){  
        
    $ID $main[ID];
        
    $date_issue $main[IssueDate];
        
    etc
        etc

    Chris Beasley - I publish content and ecommerce sites.
    Featured Article: Free Comprehensive SEO Guide
    My Guide to Building a Successful Website
    My Blog|My Webmaster Forums

  3. #3
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Ohhhh! I get it now Thanks


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
  •