Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2008
    Posts
    14

    Unanswered: Frist time connecting mysql database: PHP error

    This is my first time working with php and databases and I would like some advice trying to connect them.

    This is my database table fields

    http://www.tarantuladatabase.com/tf.jpg

    This is my field values

    http://www.tarantuladatabase.com/fv.jpg

    I am using two php files one of them is called connect.php and it only has the information to connect to my database. The other files is called echo.php. The form is at

    http://www.tarantuladatabase.com/ass...es/search.html

    When I try and connect I am getting this error message

    Code:
    Warning: include(includes/connect.php) [function.include]: failed to open stream: No such file or directory in /home/e0120590/public_html/tarantuladatabase.com/assets/php/echo.php on line 38
    
    Warning: include() [function.include]: Failed opening 'includes/connect.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/e0120590/public_html/tarantuladatabase.com/assets/php/echo.php on line 38
    
    Warning: mysql_query() [function.mysql-query]: Access denied for user 'e0120590'@'localhost' (using password: NO) in /home/e0120590/public_html/tarantuladatabase.com/assets/php/echo.php on line 40
    
    Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/e0120590/public_html/tarantuladatabase.com/assets/php/echo.php on line 40
    
    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/e0120590/public_html/tarantuladatabase.com/assets/php/echo.php on line 43
    
    Warning: mysql_close(): no MySQL-Link resource supplied in /home/e0120590/public_html/tarantuladatabase.com/assets/php/echo.php on line 48
    I am kinda stuck right here so any advice would be greatly appreciated.

    Here are the files I'm working with http://www.tarantuladatabase.com/3_Files.zip

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    so the first problem is that your include failed to find the connection file

    id be looking for something similar to
    include ("./includes/connect.php");
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Jun 2008
    Posts
    14
    Oh I see what I did I thought the include was part of the code not part of the path.

    Ok I got that and it seems to be connecting Whoo Hoo! Well I have a new error message

    Code:
    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/e0120590/public_html/tarantuladatabase.com/assets/php/echo.php on line 43
    I hope its only in the echo.php file

  4. #4
    Join Date
    Jun 2008
    Posts
    14
    Last edited by Snot; 06-13-08 at 02:26.

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Quote Originally Posted by Snot
    good on you
    one of the thing to watch out for with PHP is that the error message isn't always as specific as you might expect. the error message here told you that it crapped out on line 43 of echo.php... it expressly tild you which file it died in. and in this case the line that caused the error was 43... probably because you didnt' refr to the MySQL connection correclty.

    however it can be very confusing trying to debug a missing statement block } as the error message is often an unhelpfull error found at, say line 300 of a 300 line script.

    whilst you are in development mode I'd suggest you make sure that all errors are reported
    I think its ErrorLevel(E_All)
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •