SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Apr 2002
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Mysql help needed

    Hi people. I'm new to mysql so don't know much.
    Here's my question. I have a database set up and I can get the information into the database fine, it is when I try to print this information onto a page, this is the code I have for getting the information from the database:

    while ($myrow = mysql_fetch_array($result)) {
    printf("<p>%s<br>\n-&gt; <span class=%s>Priority %s</span>, %s<br>\n-&gt; Estimated time: %s</p>", $myrow[description], $myrow[priorcl], $myrow["priority"], $myrow["solution"], $myrow["time"]);

    }

    The problem is that no 'description' text appears and each part is shifted forward, so that where the descriptoin is meant to appear there will ne the 'priorcl' etc. The url is this:
    http://cgi-bin.spaceports.com/~simuscr/todolist.php
    (It's not finsihed yet as you can see)and this is what it should look like:
    http://members.9cy.com/simucentre/todolist.html
    Any help would be much appreciated TIA
    Good day To You
    Adam
    http://members.9cy.com/simucentre/ - The Simutrans Centre

  2. #2
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this is more of a PHP question but i guess it's ok...

    you should put quotes (' or ") around the array keys viz. $myrow['description'] if the keys are strings (non-numeric) if the keys are integers then use $myrow[numeric_key]:
    PHP Code:
    while ($myrow mysql_fetch_array($result)) {
      
    printf("<p>%s<br>\n-&gt; <span class=%s>Priority %s</span>,
      %s<br>\n-&gt;  Estimated time: %s</p>"
    $myrow['description'],
      
    $myrow['priorcl'], $myrow['priority'], $myrow['solution'], $myrow['time']);


  3. #3
    SitePoint Member
    Join Date
    Apr 2002
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the quick reply
    but I've still got the same problem, have you go any other ideas of what the problem may be??
    Good day To You
    Adam
    http://members.9cy.com/simucentre/ - The Simutrans Centre


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
  •