PHP problem retrieving data

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default PHP problem retrieving data

    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:Webmaster@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 <Webmaster@domain.com>\n";
    $headers .= "To: $firstname <$email>\n";
    $headers .= "X-Sender: <Webmaster@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: <Webmaster@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......);
    }


    Wm Guest

  2. Similar Questions and Discussions

    1. Problem retrieving data from SQL Server
      I am a newbie to both SQL Server and webservices. I have mostly done programing in Foxpro, VB6, and a little C++, and VB.net. I have been able to...
    2. Retrieving Updated Data
      Hi, I have a Windows application that consumes a web service. The data returned from this service contains product prices, ratings and other...
    3. retrieving data from website
      hi there all, me again... is it possible if you know the layout of a web site, to retrieve data from it? i mean things like a weather site that...
    4. Forms and retrieving data
      Hello, I'm a new user to DWMX and am quite the novice. My question is: How do you retrieve data / information from a form? I created a survey about...
    5. Problem Retrieving data from an SQL Query in ASP
      You can create a table variable inside your code and insert the data from the cursor into it. Finally, return the table variable back to your ASP....
  3. #2

    Default Re: PHP problem retrieving data

    On Sun, 10 Aug 2003 18:19:38 GMT, "Wm" <LAshooter@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 (andy@andyh.co.uk) icq(5747695) ([url]http://www.andyh.co.uk[/url])
    Space: disk usage analysis tool ([url]http://www.andyhsoftware.co.uk/space[/url])
    Andy Hassall Guest

  4. #3

    Default Re: PHP problem retrieving data

    "Andy Hassall" <andy@andyh.co.uk> wrote in message
    news:5n3djvgkucbpe3hmsdoh19n4eubi7guiii@4ax.com...
    > On Sun, 10 Aug 2003 18:19:38 GMT, "Wm" <LAshooter@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


    Wm Guest

  5. #4

    Default Re: PHP problem retrieving data


    On 10-Aug-2003, "Wm" <LAshooter@hotmail.com> wrote:
    > "Andy Hassall" <andy@andyh.co.uk> wrote in message
    > news:5n3djvgkucbpe3hmsdoh19n4eubi7guiii@4ax.com...
    > > On Sun, 10 Aug 2003 18:19:38 GMT, "Wm" <LAshooter@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
    [url]www.creative-light.com[/url]
    Tom Thackrey Guest

  6. #5

    Default Re: PHP problem retrieving data

    On Sun, 10 Aug 2003 18:31:26 GMT, "Wm" <LAshooter@hotmail.com> wrote:
    >"Andy Hassall" <andy@andyh.co.uk> wrote in message
    >news:5n3djvgkucbpe3hmsdoh19n4eubi7guiii@4ax.com.. .
    >> On Sun, 10 Aug 2003 18:19:38 GMT, "Wm" <LAshooter@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 (andy@andyh.co.uk) icq(5747695) ([url]http://www.andyh.co.uk[/url])
    Space: disk usage analysis tool ([url]http://www.andyhsoftware.co.uk/space[/url])
    Andy Hassall Guest

  7. #6

    Default Re: PHP problem retrieving data

    That was it -- ok, note to self: don't work anymore without coffee. THANK
    YOU guys!!!

    Wm

    "Andy Hassall" <andy@andyh.co.uk> wrote in message
    news:uq4djv08aa3m9h28inci9nm2i3uoq35e4t@4ax.com...
    > On Sun, 10 Aug 2003 18:31:26 GMT, "Wm" <LAshooter@hotmail.com> wrote:
    >
    > >"Andy Hassall" <andy@andyh.co.uk> wrote in message
    > >news:5n3djvgkucbpe3hmsdoh19n4eubi7guiii@4ax.com.. .
    > >> On Sun, 10 Aug 2003 18:19:38 GMT, "Wm" <LAshooter@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 (andy@andyh.co.uk) icq(5747695) ([url]http://www.andyh.co.uk[/url])
    > Space: disk usage analysis tool ([url]http://www.andyhsoftware.co.uk/space[/url])

    Wm Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139