mysql_fetch_array(): supplied argument is not a valid mysql result resource

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • josh dismukes

    mysql_fetch_array(): supplied argument is not a valid mysql result resource

    i recieve this error from this part of the code:

    mysql_fetch_arr ay(): supplied argument is not a valid mysql result resource


    it's returning a long text from the database which is about 200 characters long.
    Thanks for any help that is given.


    <?php
    if ($_SESSION['is_town'] = 1){
    $query = "SELECT usemap FROM town WHERE town_id = " . $_SESSION['townID'][0];
    $db_result = mysql_query($qu ery);
    $db_usemap = mysql_fetch_arr ay($db_result);
    echo $db_usemap;}
    ?>
  • Jan Pieter Kunst

    #2
    Re: mysql_fetch_arr ay(): supplied argument is not a valid mysql result resource

    In article <907eb563.04040 61003.67561a17@ posting.google. com>,
    sk8er1796@yahoo .com (josh dismukes) wrote:
    [color=blue]
    > i recieve this error from this part of the code:
    >
    > mysql_fetch_arr ay(): supplied argument is not a valid mysql result resource
    > <?php
    > if ($_SESSION['is_town'] = 1){
    > $query = "SELECT usemap FROM town WHERE town_id = " .
    > $_SESSION['townID'][0];
    > $db_result = mysql_query($qu ery);
    > $db_usemap = mysql_fetch_arr ay($db_result);
    > echo $db_usemap;}
    > ?>[/color]
    [color=blue]
    > if ($_SESSION['is_town'] = 1)[/color]

    (should be == 1 instead of = 1, I guess)
    [color=blue]
    > $db_result = mysql_query($qu ery);[/color]

    Try:

    $db_result = mysql_query($qu ery) or die (mysql_error() . ": $query");

    and see if that helps anything.

    JP

    --
    Sorry, <devnull@cauce. org> is een "spam trap".
    E-mail adres is <jpk"at"akamail .com>, waarbij "at" = @.

    Comment

    • Josh Dismukes

      #3
      Re: mysql_fetch_arr ay(): supplied argument is not a valid mysql result resource

      On Tue, 06 Apr 2004 20:15:59 +0200, Jan Pieter Kunst
      <devnull@cauce. org> wrote:
      [color=blue]
      >$db_result = mysql_query($qu ery) or die (mysql_error() . ": $query");[/color]
      when i used that i recieved "You have an error in your sql syntax. at
      line 1 SELECT usemap FROM town WHERE town_id =



      Comment

      • Jan Pieter Kunst

        #4
        Re: mysql_fetch_arr ay(): supplied argument is not a valid mysql result resource

        In article <lju570l1ubtr1f kggc769qruknc60 1jpid@4ax.com>,
        Josh Dismukes <sk8er1796@yaho o.com> wrote:
        [color=blue]
        > On Tue, 06 Apr 2004 20:15:59 +0200, Jan Pieter Kunst
        > <devnull@cauce. org> wrote:
        >[color=green]
        > >$db_result = mysql_query($qu ery) or die (mysql_error() . ": $query");[/color]
        > when i used that i recieved "You have an error in your sql syntax. at
        > line 1 SELECT usemap FROM town WHERE town_id =[/color]

        Which means that the variable that is supposed to contain the 'town_id'
        is either not set or empty.

        JP

        --
        Sorry, <devnull@cauce. org> is een "spam trap".
        E-mail adres is <jpk"at"akamail .com>, waarbij "at" = @.

        Comment

        • Pedro Graca

          #5
          Re: mysql_fetch_arr ay(): supplied argument is not a valid mysql result resource

          Josh Dismukes wrote:[color=blue]
          > On Tue, 06 Apr 2004 20:15:59 +0200, Jan Pieter Kunst
          ><devnull@cauce .org> wrote:
          >[color=green]
          >>$db_result = mysql_query($qu ery) or die (mysql_error() . ": $query");[/color]
          > when i used that i recieved "You have an error in your sql syntax. at
          > line 1 SELECT usemap FROM town WHERE town_id =[/color]

          So, look at the query displayed by your browser and identify the syntax
          error :)

          If you can't identify the error just by looking at the query
          copy and paste it into the MySQL client and execute it there
          to get a better (more informative) error message.
          --
          USENET would be a better place if everybody read: : mail address :
          http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
          http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
          http://www.expita.com/nomime.html : to 10K bytes :

          Comment

          Working...