Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 6 of 6

Thread: error help

  1. #1
    Junior Member
    Join Date
    Mar 2017
    Posts
    5
    Member #
    56363

    error help

    I have been working on building a search bar with php and mysql. I think I have gotten the code right. I can enter a serach but it tells me that there are no search results. I have checked over everything. I have found 2 others that have done the search the same way and they have working search bars. I need help.

    I can provide code or a link. Let me know which is better for you. I just need help.

    So for this part but I tried another forum and was having trouble getting help. I really don't want to learn a whole new coding. I see php working on other pieces of my site, so please don't tell me it is obsolete.

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,359
    Member #
    5580
    Liked
    672 times
    I also view the "other forum", so I know what the conversation was about.

    Depending on your webhost and PHP version, MySQL might be obsolete.
    It is no longer supported in the latest PHP versions (which may be what your server has).

    There is MySQLi (i=improved). That is still supported while people convert to PDO.
    PDO is like MySQL, but it uses prepared statements and is process differently on the server.
    You still use the MySQL database that you have on the server ... it's the PHP scripting that changes.

    T
    he email issue:

    For your email problem, you need to write a super simple email script to test if your server is sending you emails.
    Make it just the email part without any database or contact form stuff. Just enough to know it works.

    The "From" email address MUST be an email address of your own domain (the part after the @ symbol).

    If your "to" email is, happyd@unclestogys.com ... you can use that as the "from" email address as well, or just use noreply@unclestogys.com as the "from" address.

    You already know that the email is coming from your contact form. The person who submitted the form will have entered their name and email.
    Those you put in the "message" portion of the email. Also, you never let the users supply the "subject".

    Contact your webhost, or look at your webhost control panel, and tell me what version of PHP they are using. Also, who is your webhost?


  4. #3
    Junior Member
    Join Date
    Mar 2017
    Posts
    5
    Member #
    56363
    So learning PDO would be good? Im just understanding php. Is this the problem my search bar is having?

    I changed the from email.

    I am not sure what you mean by the user supply the "subject".

    I use godaddy to host. The version of php is native 5.4. I can change it. It has options for 5.5 and 5.6 as well.

  5. #4
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,359
    Member #
    5580
    Liked
    672 times
    Try the script below to test your email.
    It's just a basic script to make sure you're getting emails from the PHP script.

    You make your own subject, not a subject that the user entered.

    The "From or Sender" email must be your domain ....
    It will not be the email address of the person submitting the form.

    PHP Code:

    <?php

    // This is your real email address ...
    $recipient "johnsmith@yoursite.com";

    // Enter the email subject here.
    $subject "Life is Grand! Cherish It!";

    // Who the sender is ... the reply address on the email
    // This must also be your own domain
    $sender "noreply@yoursite.com";

    $message "
    =====================================================
    This is the message area.
    You will have your user's name and email in here.
    Plus anything else that is on the contact form.
    =====================================================
    "
    ;

    $extraheaders "From: $sender\n";

    if (
    mail($recipient$subject$message$extraheaders)){
    echo 
    "email sent";
    exit;
    }
    else{
    echo 
    "Mail did not send for some reason.";
    }

    ?>


  6. #5
    Junior Member
    Join Date
    Mar 2017
    Posts
    5
    Member #
    56363
    I copied and pasted the code and added it to my site. I am still not getting the email.

  7. #6
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,359
    Member #
    5580
    Liked
    672 times
    PM (Private Message) me and post your code exactly as you have it on your website.



Remove Ads

Posting Permissions

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

Tags for this Thread

All times are GMT -6. The time now is 01:38 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com