SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: PHP Code

  1. #1
    SitePoint Zealot zook's Avatar
    Join Date
    May 2001
    Location
    Houston, tx
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP Code

    Let's say a have a database of articles. I know how to connect to the database server and select the database, or at least I think i do:

    include("connect.php");
    $connection = @mysql_connect($hostname, $username, $password, $dbname);
    if (!$connection) {
    echo( "Unable to connect to the database server.");
    exit();
    }

    mysql_select_db("articles", $connection);
    if (! @mysql_select_db("articles") ) {
    echo( "Unable to query the database");
    exit();
    }

    ...but how do I take one row from the table, and insert each of the various columns of that row into a variable? Columns will be somthing like: ID, Author, AuthorName, AuthorEmail, Article.

    I've yet to switch my host, so I havn't been able to experiment with a database or PHP. Thanks in advance.

  2. #2
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Zook...

    This won't answer the question that you asked, but it DOES answer the question that you haven;t asked.

    You need NuSphere (www.NuSPhere.com - download).

    It is an all-in-one package that installs Apache, Perl, PHP and mySQL on your WIndows machine (I assume you are using Windows). I personally use this package and I think that it is great. It allows you to test full database driven websites right on your local computer. It saves time and effort.

    you should check it out.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  3. #3
    SitePoint Zealot zook's Avatar
    Join Date
    May 2001
    Location
    Houston, tx
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, I'll be sure to check that out.


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
  •