473,765 Members | 2,058 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

query error

Wm
I have a query that I expect to return 3 or 4 entries -- but I seem to be
getting only the most recent entry, repeated 4 times. What am I doing wrong
here?

$query="SELECT artistID,email, city,state,coun try from artists WHERE
email='$email'" ;
$result=mysql_q uery($query) or die(mysql_error ("Could not execute
query."));
if (mysql_num_rows ($result) > 0){
$alreadylisted = "1";
echo "<CENTER>$e mail is already in our database. Are you listed
below?</CENTER><BR>";
while($row = mysql_fetch_arr ay($result)) {
$artistID = $row['artistID'];
$email = $row['email'];
$city = $row['city'];
$state = $row['state'];
$country = $row['country'];
echo "<CENTER><HR><F ONT size=\"2\" face=\"Arial, Helvetica,
sans-serif\">
<A HREF=\"javascri pt:;\"
onClick=\"openP rofile('artist. php?artistID=". $artistID.

"','Artist','re sizable=yes,wid th=600,height=3 00')\">".$first name."
".$lastname ."</A><BR>"
.$city.", ".$state." ".$country. "</FONT><BR></CENTER>";
}
echo "<HR><CENTE R>If you are already listed above,
congratulations !<BR>
If needed, you may edit your listing using the link at
left.</CENTER>";
mysql_free_resu lt($result);
}
Thanx,
Wm

Jul 16 '05 #1
4 2821
try echoing your query to screen so you can read exactly what is being sent
to the database beforehand.

--

Warren Butt
-- Custom web design, cheap like cheese
"Wm" <LA*******@hotm ail.com> wrote in message
news:1h******** *************@n ews.easynews.co m...
I have a query that I expect to return 3 or 4 entries -- but I seem to be
getting only the most recent entry, repeated 4 times. What am I doing wrong here?

$query="SELECT artistID,email, city,state,coun try from artists WHERE
email='$email'" ;
$result=mysql_q uery($query) or die(mysql_error ("Could not execute
query."));
if (mysql_num_rows ($result) > 0){
$alreadylisted = "1";
echo "<CENTER>$e mail is already in our database. Are you listed
below?</CENTER><BR>";
while($row = mysql_fetch_arr ay($result)) {
$artistID = $row['artistID'];
$email = $row['email'];
$city = $row['city'];
$state = $row['state'];
$country = $row['country'];
echo "<CENTER><HR><F ONT size=\"2\" face=\"Arial, Helvetica,
sans-serif\">
<A HREF=\"javascri pt:;\"
onClick=\"openP rofile('artist. php?artistID=". $artistID.

"','Artist','re sizable=yes,wid th=600,height=3 00')\">".$first name."
".$lastname ."</A><BR>"
.$city.", ".$state." ".$country. "</FONT><BR></CENTER>";
}
echo "<HR><CENTE R>If you are already listed above,
congratulations !<BR>
If needed, you may edit your listing using the link at
left.</CENTER>";
mysql_free_resu lt($result);
}
Thanx,
Wm

Jul 16 '05 #2
Wm
"DjDrakk" <Dj*****@drakkr adio.servemp3.c om> wrote in message
news:vj******** ****@corp.super news.com...
try echoing your query to screen so you can read exactly what is being sent to the database beforehand.

Warren Butt
-- Custom web design, cheap like cheese

echo "Query result = ".$result;

yields this output:

ArrayQuery result = Resource id #21

I'm not sure where the word "Array" is coming from, nor what the "Resource
id #21" is.....????

Wm

"Wm" <LA*******@hotm ail.com> wrote in message
news:1h******** *************@n ews.easynews.co m...
I have a query that I expect to return 3 or 4 entries -- but I seem to be getting only the most recent entry, repeated 4 times. What am I doing

wrong
here?

$query="SELECT artistID,email, city,state,coun try from artists WHERE
email='$email'" ;
$result=mysql_q uery($query) or die(mysql_error ("Could not execute
query."));
if (mysql_num_rows ($result) > 0){
$alreadylisted = "1";
echo "<CENTER>$e mail is already in our database. Are you listed
below?</CENTER><BR>";
while($row = mysql_fetch_arr ay($result)) {
$artistID = $row['artistID'];
$email = $row['email'];
$city = $row['city'];
$state = $row['state'];
$country = $row['country'];
echo "<CENTER><HR><F ONT size=\"2\" face=\"Arial, Helvetica,
sans-serif\">
<A HREF=\"javascri pt:;\"
onClick=\"openP rofile('artist. php?artistID=". $artistID.

"','Artist','re sizable=yes,wid th=600,height=3 00')\">".$first name."
".$lastname ."</A><BR>"
.$city.", ".$state." ".$country. "</FONT><BR></CENTER>";
}
echo "<HR><CENTE R>If you are already listed above,
congratulations !<BR>
If needed, you may edit your listing using the link at
left.</CENTER>";
mysql_free_resu lt($result);
}
Thanx,
Wm


Jul 16 '05 #3
Wm
"Trent Stith" <tr****@airmail .net> wrote in message
news:bg******** @library2.airne ws.net...
You need to echo the query itself, not the result of the query.

echo "<pre>";
echo $query;

that will return what your query is actually doing it may shed some light.

I pasted the lines above in after the query and got this result output to
the browser:

"Array
ad*****@hotmail .com is already in our database. Are you listed below?"

I'm still not sure why I'm getting the word "Array" output, nor why I don't
see the query that I'm trying to verify. And I'm still getting the same info
output 4 times rather than 4 separate listings, but I'm sure that's a
different problem... <groan>

Thanx,
Wm
*************** *************** *************** *************
ORIGINAL MESSAGE(S):
*************** *************** *************** ************* "Wm" <LA*******@hotm ail.com> wrote in message
news:oL******** *************** @news.easynews. com...
"DjDrakk" <Dj*****@drakkr adio.servemp3.c om> wrote in message
news:vj******** ****@corp.super news.com...
try echoing your query to screen so you can read exactly what is being

sent
to the database beforehand.

Warren Butt
-- Custom web design, cheap like cheese


echo "Query result = ".$result;

yields this output:

ArrayQuery result = Resource id #21

I'm not sure where the word "Array" is coming from, nor what the "Resource id #21" is.....????

Wm

"Wm" <LA*******@hotm ail.com> wrote in message
news:1h******** *************@n ews.easynews.co m...
> I have a query that I expect to return 3 or 4 entries -- but I seem to
be
> getting only the most recent entry, repeated 4 times. What am I

doing wrong
> here?
>
> $query="SELECT artistID,email, city,state,coun try from artists WHERE > email='$email'" ;
> $result=mysql_q uery($query) or die(mysql_error ("Could not execute
> query."));
> if (mysql_num_rows ($result) > 0){
> $alreadylisted = "1";
> echo "<CENTER>$e mail is already in our database. Are you listed > below?</CENTER><BR>";
> while($row = mysql_fetch_arr ay($result)) {
> $artistID = $row['artistID'];
> $email = $row['email'];
> $city = $row['city'];
> $state = $row['state'];
> $country = $row['country'];
> echo "<CENTER><HR><F ONT size=\"2\" face=\"Arial, Helvetica, > sans-serif\">
> <A HREF=\"javascri pt:;\"
> onClick=\"openP rofile('artist. php?artistID=". $artistID.
>
> "','Artist','re sizable=yes,wid th=600,height=3 00')\">".$first name."
> ".$lastname ."</A><BR>"
> .$city.", ".$state." ".$country. "</FONT><BR></CENTER>";
> }
> echo "<HR><CENTE R>If you are already listed above,
> congratulations !<BR>
> If needed, you may edit your listing using the link at
> left.</CENTER>";
> mysql_free_resu lt($result);
> }
>
>
> Thanx,
> Wm
>
>
>



Jul 16 '05 #4
Ok insert the echo "$query" line in the following places where indicated
with 'echo', that's how you should isolate the problem to one line of code:
"Wm" <LA*******@hotm ail.com> wrote in message
news:1h******** *************@n ews.easynews.co m...
I have a query that I expect to return 3 or 4 entries -- but I seem to be
getting only the most recent entry, repeated 4 times. What am I doing wrong here?

echo
$query="SELECT artistID,email, city,state,coun try from artists WHERE
email='$email'" ;
echo
$result=mysql_q uery($query) or die(mysql_error ("Could not execute
query."));
echo
if (mysql_num_rows ($result) > 0){
$alreadylisted = "1";
echo "<CENTER>$e mail is already in our database. Are you listed
below?</CENTER><BR>";
while($row = mysql_fetch_arr ay($result)) {
$artistID = $row['artistID'];
$email = $row['email'];
$city = $row['city'];
$state = $row['state'];
$country = $row['country'];
echo "<CENTER><HR><F ONT size=\"2\" face=\"Arial, Helvetica,
sans-serif\">
<A HREF=\"javascri pt:;\"
onClick=\"openP rofile('artist. php?artistID=". $artistID.

"','Artist','re sizable=yes,wid th=600,height=3 00')\">".$first name."
".$lastname ."</A><BR>"
.$city.", ".$state." ".$country. "</FONT><BR></CENTER>";
}
echo "<HR><CENTE R>If you are already listed above,
congratulations !<BR>
If needed, you may edit your listing using the link at
left.</CENTER>";
mysql_free_resu lt($result);
}
Thanx,
Wm

Jul 16 '05 #5

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

Similar topics

8
2195
by: Polar | last post by:
I am having troubles finding the parse error in this script. I've been checking for weeks. I am too new to the subject I guess. I am trying to show a readord and them have a form at the bottom of the page for inputting data to Update the record. I get a parse error that points to the last line in the script so I know it is something I am missing earlier in the script but doing a line by line it seems fine to me. Thanks for any...
10
2611
by: johnnyboy10017 | last post by:
I am having a hell of a time with what I think is a very simple query: It won't actually insert a new record into the specified table, but returns no error, in fact it returns "1" (or true) that the query was successful. Things to know: 1. id field is auto-incrementing primary key 2. Other queries SELECT, UPDATE, and DELETE all work no problem 3. INSERT works via phpMyAdmin 4. Query generated by phpMyAdmin and pasted into my PHP...
2
3435
by: jaysonsch | last post by:
Hello! I am having some problems with a database query that I am trying to do. I am trying to develop a way to search a database for an entry and then edit the existing values. Upon submit, the new values are updated in all corresponding tables (the function of the pages in question). However, on the page that does the DB update, I also want to do some checks on the data before performing the update. Now, the problem that I am...
3
1955
by: Nick Truscott | last post by:
<? // scoreinput.php - input a match score when match selected from list ?> <html> <head> <basefont face="Verdana"> </head> <body>
2
2391
by: Mattyboy | last post by:
Guys I have built a database with saved queries that runs fine in Access but when I call it from the web using ASP, an exception occurs. I have tried multiple ways of testing the databases with the following results. www.brinkster.com has a tool on their free asp hosting where you can dump an access .mdb database on there and then run SQL queries against it. Using Access databases it is possible to just call the query by using its...
6
29942
by: Martin Lacoste | last post by:
Ok, before I headbutt the computer... don't know why when I add criteria in a query, I get an 'invalid procedure call'. I also don't know why after searching the help in access, the various access newsgroups, the access support centre, I can seem to find no similar situation. I am not using any references, or VBA at all in the first place. I am trying to set up a simple (or so I thought) query to work with the text of two tables. ...
4
2857
by: Alan Lane | last post by:
Hello world: I'm including both code and examples of query output. I appologize if that makes this message longer than it should be. Anyway, I need to change the query below into a pivot table query. I'm having trouble doing it. Help! Here is my code so far: Sub OldRegionQuery()
4
3045
by: deko | last post by:
When using OutputTo with a query, the 'File name' window in the 'Output To' dialog gets populated with the name of the query by default. This makes the exported file self-describing if the query is named on the fly. The benefit is consistent file naming, and users don't have to enter a file name when exporting. The problem is the query has to be renamed every time, and I don't know how to find it in the QueryDefs collection other than...
11
3967
by: Arpan | last post by:
I have always been working with SQL Server 2005 for ASP.NET apps but due to some reasons, had to revert back to MS-Access 2000. When I try to insert/update a MS-Access DB table (MDB), ASP.NET generates the following error: Operation must use an updateable query. pointing to a line that says
9
3062
by: Kelii | last post by:
I've been trying to get this piece to work for a few hours, but have given up. I hope someone out there can help, I think the issue is relatively straightforward, but being a novice, I'm stumped. Below you will find the code I've written and the error that results. I'm hoping that someone can give me some direction as to what syntax or parameter is missing from the code that is expected by VBA. Overview: I'm trying to copy calculated...
0
9568
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10007
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9835
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8832
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7379
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5276
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.