Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 22
  1. #1
    New Coder
    Join Date
    Jun 2005
    Posts
    83
    Thanks
    2
    Thanked 0 Times in 0 Posts

    mysql_fetch_array(): supplied argument....

    I can't seem to rid myself of this error: mysql_fetch_array(): supplied argument is not a valid MySQL

    I have the site running perfectly on a local test environment. I uploaded it to my old web space and they both work fine. I then got my new server (ISP) uploaded the files and imported the database. I get many errors that lead to the code above. Here is a sample:

    All errors lead to this line in the PHP code: (different files of course)

    $config=mysql_fetch_array(mysql_query("select * from XXXXX_config "));

    I have run a MySql connection test and all is OK there. I'm at my wits end! Anyone? Thank You.
    Last edited by bzzrd2; 03-25-2007 at 03:12 PM. Reason: error

  • #2
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts
    Quote Originally Posted by bzzrd2 View Post
    I can't seem to rid myself of this error: mysql_fetch_array(): supplied argument is not a valid MySQL

    I have the site running perfectly on a local test environment. I uploaded it to my old web space and they both work fine. I then got my new server (ISP) uploaded the files and imported the database. I get many errors that lead to the code above. Here is a sample:

    All errors lead to this line in the PHP code: (different files of course)

    $config=mysql_fetch_array(mysql_query("select * from XXXXX_config "));

    I have run a MySql connection test and all is OK there. I'm at my wits end! Anyone? Thank You.
    try adding
    PHP Code:
    $config=mysql_fetch_array(mysql_query("select * from XXXXX_config ")) or die(mysql_error()); 

  • #3
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Your query is failing. Separate the lines so you can see the error:
    PHP Code:
    $result mysql_query("select * from XXXXX_config ") or die(mysql_error());
    $config=mysql_fetch_array($result) or die(mysql_error()); 

  • #4
    New Coder
    Join Date
    Jun 2005
    Posts
    83
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Here is one of the results I got for one query:

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/xxxxxx/public_html/friends/myconnect.php on line 32

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/xxxxxx/public_html/friends/styles.php on line 17
    Table 'xxxxxx_friends.friends_config' doesn't exist

    One thing I am curious about and that is why this is great on two servers and not my new one. I'm somewhat of a newb but learning!
    Last edited by bzzrd2; 03-25-2007 at 08:07 PM. Reason: error

  • #5
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,066
    Thanks
    2
    Thanked 319 Times in 311 Posts
    Does this part of the error output say anything to you about where the problem is? -
    Table 'xxxxxx_friends.friends_config' doesn't exist
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #6
    Regular Coder
    Join Date
    Oct 2005
    Location
    Right Here
    Posts
    654
    Thanks
    1
    Thanked 0 Times in 0 Posts
    apparently the table xxxxxx_friends.friends_config doesnt exist..

  • #7
    New Coder
    Join Date
    Jun 2005
    Posts
    83
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Here are the errors:

    Parse error: syntax error, unexpected T_LOGICAL_OR in /home/oldatel5/public_html/friends/myconnect.php on line 32


    Line 32 Code:
    $online=mysql_fetch_array(mysql_query("select * from friends_online where sb_ip='$ip'"));

  • #8
    Regular Coder
    Join Date
    Oct 2005
    Location
    Right Here
    Posts
    654
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Doesn't mean there is a problem with that line, just means thats when the error occurred. You could have an open " or ' somewhere above that line.

    I suggest splitting out your query and array as suggested by Inigoesdr.

  • #9
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,066
    Thanks
    2
    Thanked 319 Times in 311 Posts
    The parse error is a PHP error. The code did not even get to the point of running. As iLLin suggested, you would need to post at least 5-10 lines prior to the line with the error in order to get any help with that error.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #10
    New Coder
    Join Date
    Jun 2005
    Posts
    83
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Inigoesdr View Post
    Your query is failing. Separate the lines so you can see the error:
    PHP Code:
    $result mysql_query("select * from XXXXX_config ") or die(mysql_error());
    $config=mysql_fetch_array($result) or die(mysql_error()); 
    Here is the response I got following Inigoesdr's direction. Is it possible it's a MySql version problem? Like I said, it works ok on my environment and another host.

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /mounted-storage/home48c/sub004/sc33782-ACCQ/www/fXXXX/myconnect.php on line 33

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /mounted-storage/home48c/sub004/sc33782-ACCQ/www/XXXX/styles.php on line 17

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /mounted-storage/home48c/sub004/sc33782-ACCQ/www/XXXX/styles.php on line 44

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

    This is my table structure. The host I'm using now has MySql version 5.
    CREATE TABLE `friends_admin` (
    `id` bigint(20) NOT NULL auto_increment,
    `admin_name` varchar(255) collate latin1_general_ci default NULL,
    `pwd` varchar(255) collate latin1_general_ci default NULL,
    PRIMARY KEY (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=2 ;

  • #11
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Quote Originally Posted by bzzrd2 View Post
    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
    This is the relevant error, you need to figure out why your query is failing. Run it in phpMyAdmin, and/or post the actual query you're running.

  • #12
    New Coder
    Join Date
    Jun 2005
    Posts
    83
    Thanks
    2
    Thanked 0 Times in 0 Posts
    This is the query that give me the errors. Ther are many of these as well as others producing errors:

    $config=mysql_fetch_array(mysql_query("select * from friends_config "));

  • #13
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    First guess would be the table name is wrong.. since the one you posted earlier and the one in the query are different.

  • #14
    Regular Coder
    Join Date
    Oct 2005
    Location
    Right Here
    Posts
    654
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Hmm paste up 10lines up and your query, with error.

  • #15
    New Coder
    Join Date
    Jun 2005
    Posts
    83
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Here's the error:

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /mounted-storage/home48c/sub004/sc33782-ACCQ/www/friends/date_time_format.php on line 5


    After I input the extra code:

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /mounted-storage/home48c/sub004/sc33782-ACCQ/www/friends/myconnect.php on line 32

    Parse error: syntax error, unexpected ';' in /mounted-storage/home48c/sub004/sc33782-ACCQ/www/friends/date_time_format.php on line 5


    A few lines of code.
    <?php
    //include_once "myconnect.php";
    function sb_date($unx_stamp,$cal_elapsed)
    {
    $config=mysql_fetch_array(mysql_query("select * from friends_config") or die(mysql_error());
    $config=mysql_fetch_array($result) or die(mysql_error());

    $date_str="";
    $time_str="";
    if($cal_elapsed==1)
    {
    if($config["elapsed_date"]=="no")
    {$cal_elapsed=0;}
    }
    if($cal_elapsed==0)
    {


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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