SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    ********* Addict DLG_1's Avatar
    Join Date
    Jun 2000
    Location
    Texas, USA
    Posts
    597
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i'm trying to learn this stuff and i'm having trouble doing the beginning excersises sitepoint has.

    here's my code:
    Code:
    
    <html><head><title>welcome result</title></head>
    <body>
    <?php
     	echo( "tu nombre es: $firstName $lastName" );
    $dbcnx = mysql_connect("localhost", "username", "password");
    	if (!$dbcnx){
    		echo( "<br>Unable to access the dB." );
    		exit();
    		}
    mysql_select_db("/usr/local/mysql/bin/mysql uniquedesignsny_com", $dbcnx);
    $result = mysql_query("SELECT first_name FROM customer");
    while ( $row = mysql_fetch_array($result) ) {
    	echo ("<p>" . $row["first_name"] . "</p>");
    	}
    
    ?>
    </body>
    </html>
    the error that the page produces is:

    Warning: 0 is not a MySQL result index in
    /home/uniquede/uniquedesignsny-www/welcome.php3 on line 12

    line 12 is the while loop.


    what am i doing wrong?!


    any help is appreciated.

    DLG

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Probably this line
    mysql_select_db("/usr/local/mysql/bin/mysql uniquedesignsny_com", $dbcnx);
    try
    mysql_select_db("uniquedesignsny_com", $dbcnx);
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    ********* Addict DLG_1's Avatar
    Join Date
    Jun 2000
    Location
    Texas, USA
    Posts
    597
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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
  •