Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Dec 2006
    Thanked 0 Times in 0 Posts

    PHP script wont get contents of MYSQL DB


    Does anyone see anything wrong with the below? What it tries to do is get an email address stored in a field called value and then print it out but for some reason the value it returns is empty. The strange thing is that it works when i use anything other then email like if value is firstname it works great and returns the first name and so on with other values like company, last name etc...

    PS The WHERE email=\"$email\" portion of the script is a controller and not the email i am trying to get.


    PHP Code:

    $query "SELECT value FROM imports WHERE email=\"$email\" AND controller=1 AND field=\"$emailfield\" ORDER BY controller";
    $result mysql_query($query) or die(mysql_error());

    $row mysql_fetch_array($resultMYSQL_ASSOC))
    Last edited by thekevin07; 03-12-2007 at 12:04 PM.

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Thanked 637 Times in 625 Posts
    Well, since the query works in other situations, then you've got to think it's either the data isn't there, or the query isn't doing what you think it should be doing for the data that is there.

    To troubleshoot, I would stick a "die($query)" statement in right after you build the query text. This will simply echo to the browser the exact query you are running. Then copy/paste that query into an ad-hoc query tool such as PhpMyAdmin, and see what results you get. If the results are just as you expected, then the problem is the PHP code. If not, then the problem is with the query.
    Last edited by Fumigator; 03-12-2007 at 05:18 PM.


    Posting Permissions

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