473,394 Members | 1,749 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,394 software developers and data experts.

PHP problem retrieving data

Wm
I'm not sure why this isn't working, but it's giving me no output. I have a
form which requests email and city to pull up a listing, then Email that
address with their password. I'm doing an extract($_POST) to get the data
from the previous form. When I test it I enter a known invalid email/city
combination, yet I get a blank area where the first message should be. This
is what's not working:

include('dbconnect.php');
if (Submit == "Remind Me") {
$query="SELECT ID,firstname,city,email,passwd from artists
WHERE email='$email' AND city='$city'";
$result=mysql_query($query) or die(mysql_error("Could not execute
query."));
// verify that the Email/city combination exists
if (mysql_num_rows($result) < 1) {
echo "<P>&nbsp;</P>
We cannot find that Email address and city combination in our
database.
Please use your browser's \"Back\" button and check your entry.<BR>
For best results, cut and paste the information from your listing to
ensure
that you don't have any typographical errors. If you continue to
have
difficulties, please <A HREF=\"mailto:We*******@domain.com\">
Email the Webmaster</A>.<BR>";
//break 2; (commented out in case it was causing the problem)
} else {
// pull listing from database
while($row = mysql_fetch_array($result)) {
$artistID = $row['artistID'];
$firstname = $row['firstname'];
$city= $row['city'];
$email = $row['email'];
$passwd = $row['passwd'];
// generate Email
$headers .= "From: Webmaster <We*******@domain.com>\n";
$headers .= "To: $firstname <$email>\n";
$headers .= "X-Sender: <We*******@domain.com>\n";
$headers .= "X-Mailer: domain.com\n"; //mailer
$headers .= "X-MSMail-Priority: Normal\n";
$headers .= "X-Priority: 3\n"; //1 UrgentMessage, 3 Normal
$headers .= "Return-Path: <We*******@domain.com>\n";
//Uncomment this to send html format
$headers .= "Content-Type: text/html; charset=iso-8859-1\n";
$message = "
...message text is here...
mail($to......);
}
Jul 16 '05 #1
5 2507
On Sun, 10 Aug 2003 18:19:38 GMT, "Wm" <LA*******@hotmail.com> wrote:
I'm not sure why this isn't working, but it's giving me no output.

if (Submit == "Remind Me") {
If you'd had error_reporting turned up high enough, you'd have got a warning
similar to:

Use of undefined constant Submit, assuming string 'Submit'.

Since 'Submit' != "Remind Me", only the 'else' branch would ever execute.
} else {
// pull listing from database
while($row = mysql_fetch_array($result)) {


But $result was only defined inside the other branch of the if; surely it's
undefined here.

--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 16 '05 #2
Wm
"Andy Hassall" <an**@andyh.co.uk> wrote in message
news:5n********************************@4ax.com...
On Sun, 10 Aug 2003 18:19:38 GMT, "Wm" <LA*******@hotmail.com> wrote:
I'm not sure why this isn't working, but it's giving me no output.

if (Submit == "Remind Me") {
If you'd had error_reporting turned up high enough, you'd have got a

warning similar to:

Use of undefined constant Submit, assuming string 'Submit'.

Since 'Submit' != "Remind Me", only the 'else' branch would ever execute.

The form that submits the data to this page has a value of "Remind Me" on
the submit button. I was trying to verify that the data I was dealing with
was submitted from that form. If they clicked the submit button on the first
page, this SHOULD be true -- it works with all my other sites.
} else {
// pull listing from database
while($row = mysql_fetch_array($result)) {


But $result was only defined inside the other branch of the if; surely

it's undefined here.


True -- maybe I could copy the query down...? but that shouldn't be
necessary if the data is coming from the submitted form, right?

Wm
Jul 16 '05 #3
On Sun, 10 Aug 2003 18:31:26 GMT, "Wm" <LA*******@hotmail.com> wrote:
"Andy Hassall" <an**@andyh.co.uk> wrote in message
news:5n********************************@4ax.com.. .
On Sun, 10 Aug 2003 18:19:38 GMT, "Wm" <LA*******@hotmail.com> wrote:
>I'm not sure why this isn't working, but it's giving me no output.
>
> if (Submit == "Remind Me") {


If you'd had error_reporting turned up high enough, you'd have got a

warning
similar to:

Use of undefined constant Submit, assuming string 'Submit'.

Since 'Submit' != "Remind Me", only the 'else' branch would ever execute.


The form that submits the data to this page has a value of "Remind Me" on
the submit button. I was trying to verify that the data I was dealing with
was submitted from that form. If they clicked the submit button on the first
page, this SHOULD be true -- it works with all my other sites.


No, read it again. You've missed the $.
> } else {
> // pull listing from database
> while($row = mysql_fetch_array($result)) {


But $result was only defined inside the other branch of the if; surely

it's
undefined here.


True -- maybe I could copy the query down...? but that shouldn't be
necessary if the data is coming from the submitted form, right?


Don't know, depends what you're passing.

But it sounds like you need to put error_reporting to E_ALL as both of these
should have displayed visible warnings.

--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 16 '05 #4

On 10-Aug-2003, "Wm" <LA*******@hotmail.com> wrote:
"Andy Hassall" <an**@andyh.co.uk> wrote in message
news:5n********************************@4ax.com...
On Sun, 10 Aug 2003 18:19:38 GMT, "Wm" <LA*******@hotmail.com> wrote:
I'm not sure why this isn't working, but it's giving me no output.

if (Submit == "Remind Me") {


If you'd had error_reporting turned up high enough, you'd have got a

warning
similar to:

Use of undefined constant Submit, assuming string 'Submit'.

Since 'Submit' != "Remind Me", only the 'else' branch would ever
execute.


The form that submits the data to this page has a value of "Remind Me" on
the submit button. I was trying to verify that the data I was dealing with
was submitted from that form. If they clicked the submit button on the
first
page, this SHOULD be true -- it works with all my other sites.


Andy was trying to tell you that if (Submit should be if ($Submit

--
Tom Thackrey
www.creative-light.com
Jul 16 '05 #5
Wm
That was it -- ok, note to self: don't work anymore without coffee. THANK
YOU guys!!!

Wm

"Andy Hassall" <an**@andyh.co.uk> wrote in message
news:uq********************************@4ax.com...
On Sun, 10 Aug 2003 18:31:26 GMT, "Wm" <LA*******@hotmail.com> wrote:
"Andy Hassall" <an**@andyh.co.uk> wrote in message
news:5n********************************@4ax.com.. .
On Sun, 10 Aug 2003 18:19:38 GMT, "Wm" <LA*******@hotmail.com> wrote:

>I'm not sure why this isn't working, but it's giving me no output.
>
> if (Submit == "Remind Me") {

If you'd had error_reporting turned up high enough, you'd have got awarning
similar to:

Use of undefined constant Submit, assuming string 'Submit'.

Since 'Submit' != "Remind Me", only the 'else' branch would ever execute.


The form that submits the data to this page has a value of "Remind Me" on
the submit button. I was trying to verify that the data I was dealing with
was submitted from that form. If they clicked the submit button on the firstpage, this SHOULD be true -- it works with all my other sites.


No, read it again. You've missed the $.
} else {
> // pull listing from database
> while($row = mysql_fetch_array($result)) {

But $result was only defined inside the other branch of the if; surely

it's
undefined here.


True -- maybe I could copy the query down...? but that shouldn't be
necessary if the data is coming from the submitted form, right?


Don't know, depends what you're passing.

But it sounds like you need to put error_reporting to E_ALL as both of

these should have displayed visible warnings.

--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)

Jul 16 '05 #6

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

Similar topics

0
by: Alistair | last post by:
Hi all, I am creating a database based site that keeps track of books, who has read them and the comments they have. After a little help in M.P.I.asp.DB I managed to create a database (access...
1
by: Rushabh Dadbhawala | last post by:
Problem: I am fetching data from the database, storing it in a dataSet, and binding it with a Data Grid. The DataGrid controls allows sorting. The problem is that when the data is sorted on one...
5
by: aniket_sp | last post by:
i am using a data adapter and a dataset for filling and retrieving data into .mdb database. following is the code..... for the form load event Dim dc(0) As DataColumn Try If...
0
by: kid4rilla | last post by:
I can successfully write the binary data to an image data type, and successfully retrieve it, but when I attempt to play the file in media player after retrieving it, I get the file type isn't...
1
by: Dave | last post by:
Can some help me out retrieving word, pdf, etc. docs and streaming to the browser? I'm saving the docs as an image data type along with it's original filename and retrieving them using a...
0
by: Andy | last post by:
Hi All. I'm working for a company that has set out a guideline for retrieving data from a database. Nobody can explain to me the reason for the following. When retrieving a set of records...
6
by: AlveenX | last post by:
Hi, I am trying to pick a Guid from a data row using the following code: foreach(DataRow row in MyDataTable.Rows) { (Guid)row }
1
by: jimmyfo | last post by:
Hi, I recently wrote an ASP.Net web application in VS2005 and published (using VS2005 Publish feature) it to a relatively clean machine with ASP.Net 2.0 and MDAC 2.8 installed on it. However, when...
5
by: Sanjay Pais | last post by:
I have a table with over 1.3 million rows. I am retrieving only 20 at a time using the with - over clauses In query analyser, the data is retrieved in under a second. When retrieving using the...
1
by: san123456789 | last post by:
Hi, Im using a MS SQL server to store images... Im creating a windows form application using C#. I need to store and retrieve images from the database. This is my code to store images: ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.