473,405 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

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

i recieve this error from this part of the code:

mysql_fetch_array(): 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($query);
$db_usemap = mysql_fetch_array($db_result);
echo $db_usemap;}
?>
Jul 17 '05 #1
4 2811
In article <90**************************@posting.google.com >,
sk*******@yahoo.com (josh dismukes) wrote:
i recieve this error from this part of the code:

mysql_fetch_array(): 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($query);
$db_usemap = mysql_fetch_array($db_result);
echo $db_usemap;}
?> if ($_SESSION['is_town'] = 1)
(should be == 1 instead of = 1, I guess)
$db_result = mysql_query($query);


Try:

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

and see if that helps anything.

JP

--
Sorry, <de*****@cauce.org> is een "spam trap".
E-mail adres is <jpk"at"akamail.com>, waarbij "at" = @.
Jul 17 '05 #2
On Tue, 06 Apr 2004 20:15:59 +0200, Jan Pieter Kunst
<de*****@cauce.org> wrote:
$db_result = mysql_query($query) or die (mysql_error() . ": $query");

when i used that i recieved "You have an error in your sql syntax. at
line 1 SELECT usemap FROM town WHERE town_id =

Jul 17 '05 #3
In article <lj********************************@4ax.com>,
Josh Dismukes <sk*******@yahoo.com> wrote:
On Tue, 06 Apr 2004 20:15:59 +0200, Jan Pieter Kunst
<de*****@cauce.org> wrote:
$db_result = mysql_query($query) or die (mysql_error() . ": $query");

when i used that i recieved "You have an error in your sql syntax. at
line 1 SELECT usemap FROM town WHERE town_id =


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

JP

--
Sorry, <de*****@cauce.org> is een "spam trap".
E-mail adres is <jpk"at"akamail.com>, waarbij "at" = @.
Jul 17 '05 #4
Josh Dismukes wrote:
On Tue, 06 Apr 2004 20:15:59 +0200, Jan Pieter Kunst
<de*****@cauce.org> wrote:
$db_result = mysql_query($query) or die (mysql_error() . ": $query");

when i used that i recieved "You have an error in your sql syntax. at
line 1 SELECT usemap FROM town WHERE town_id =


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 :
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: wrw[three] | last post by:
Hey Okay so i have a page that lists a bunch of clients... then another page that would limit it to a specific chosen client.... the one that lists all the clients is working just fine, however...
3
by: Pratchaya | last post by:
Hi Everyone ============================================================== About PHP::: Error/Problem PHP Warning: mysql_fetch_array():...
1
by: myaashik | last post by:
Hello! All I have a Error message saying that: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/rocks/public_html/colorado3.php on line 32 I have...
3
by: dslade | last post by:
I got the following message when trying to do a mysql php query: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Program Files\Apache Group\Apa.... ...
1
by: lsmamadele | last post by:
I am getting the following error messages in my search: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/mamadele/public_html/BESTPLAYS/search.php on...
11
by: Breana | last post by:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/breana/public_html/category.php on line 88 ------------------------------------------- It does this...
11
by: chemlight | last post by:
I'm having a problem. I'm sure I'm going to kick myself over the answer... I have a table that stores vendors and their languages. This table starts out blank. I am querying the table to see if a...
1
by: byteit101 | last post by:
I was working with OOP, and was testing a sql result class, but it gives me the following error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource. I think it has...
1
mideastgirl
by: mideastgirl | last post by:
What does this error mean? Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/content/m/i/d/mideasthonors/html/student_session_proposal_success.php on...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.