SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    May 2007
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    echo a MYSQL database?

    How do I echo a MYSQL database within a .php file?

    Thanks,
    CellularDeals.Org
    http://cellulardeals.org

    - Save on Cellular Accessories, Cell Phones, etc!

  2. #2
    Who turned the lights out !! Mandes's Avatar
    Join Date
    May 2005
    Location
    S.W. France
    Posts
    2,496
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    More info please, what do you want to echo, one record, one field, the whole database ??
    A Little Knowledge Is A Very Dangerous Thing.......
    That Makes Me A Lethal Weapon !!!!!!!!

    Contract PHP Programming

  3. #3
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    echo "a MYSQL database"

  4. #4
    Who turned the lights out !! Mandes's Avatar
    Join Date
    May 2005
    Location
    S.W. France
    Posts
    2,496
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dan Grossman View Post
    PHP Code:
    echo "a MYSQL database"
    Genius,
    A Little Knowledge Is A Very Dangerous Thing.......
    That Makes Me A Lethal Weapon !!!!!!!!

    Contract PHP Programming

  5. #5
    SitePoint Wizard bronze trophy devbanana's Avatar
    Join Date
    Apr 2006
    Location
    Pennsylvania
    Posts
    1,736
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dan Grossman View Post
    PHP Code:
    echo "a MYSQL database"


    Seriously...a database is, well, a database...not something to be echoed...or...oh I'm confused

    What do you want to do?

  6. #6
    SitePoint Zealot
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    137
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe you want to dump a mysql database, i.e. get all the data of the database? Or do you want to get the contents to make a backup? Please be more specific.

  7. #7
    SitePoint Addict silentcollision's Avatar
    Join Date
    Jun 2006
    Location
    New Zealand
    Posts
    388
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dan Grossman View Post
    PHP Code:
    echo "a MYSQL database"


    To try answer the question, this will output your database as a table. Hope it helps.

    PHP Code:
    <?php

          
    echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\" >";


       
    $query "SELECT * FROM table";
       
    $result mysql_query($query) or die(mysql_error());
       while(
    $row mysql_fetch_array($result)){
       

             echo 
    "<tr>";
                echo 
    "<td>{$row['col1']}</td>";
                echo 
    "<td>{$row['col2']}</td>";
                echo 
    "<td>{$row['col3']}</td>";
                echo 
    "<td>{$row['col4']}</td>"// add more for more columns
             
    echo "</tr>";
          

    }

          echo 
    "</table>";
    ?>


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
  •