Help with MySQL/PHP Connection

Hi,
I'm making a site that requires the storage of information via MySQL.  I've set up my testing server, and it connects fine.  When I try to add a MySQL connection, however, I keep getting the "HTTP Error Code 404: File Not Found" error.  I've tried using both the MySQL server provided by my web host and one hosted on my own computer (using "localhost" as the server), but both give me the same error.  The error box says that perhaps:
1) There is no testing server running on the server machine.
2) The testing server specified for this site does not map to the http://**mywebsite**.com/_mmServerScripts/MMHTTPDB.php URL.  Verify that the URL Prefix maps to the root of the site.
I'm certain it's not #1, because both of my MySQL servers work fine outside of Dreamweaver.  But I'm not quite sure what #2 is saying.  Any help?
Thanks in advance.

nickf77 wrote:
I have my testing server set up at my FTP account that came with my hosting package.  Should it not be?
It's not ideal, but you can do it that way. The principle is still the same.
When using a remote connection, the value of Host directory is the same as you use for FTP connections to your remote site. In many cases, this is left blank, is simply a forward slash, or is something like public_html. In any event, it's the root level of your website.
URL prefix is also the root level of your site, but expressed as a URL: http://www.example.com/.
Host directory and URL prefix must both point to the same place. The first is a path, the second is a web address.

Similar Messages

  • OT: Help with MySQL/PHP line (SQL syntax)

    I have this now -
    $colname_rsPassword = $_POST['password'];
    $query_rsPassword = sprintf("SELECT contactFName,
    contactLName,
    contactPassword, contactEmail, contactRecord FROM
    tblcontactdata WHERE
    contactPassword = %s", GetSQLValueString($colname_rsPassword,
    "text"));
    How would I change that to include $_POST['LName'] and
    $_POST['FName'] (as
    posted from the form) in the WHERE clause?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================

    I did it another way -
    GetSQLValueString($colname_rsPassword, "text"),
    $_POST['fname'],
    $_POST['lname']);
    goes to this -
    GetSQLValueString($colname_rsPassword, "text"),
    "'".$_POST['fname']."'",
    "'".$_POST['lname']."'");
    Woiks!
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "Joe Makowiec" <[email protected]> wrote in
    message
    news:[email protected]..
    > On 11 Oct 2006 in macromedia.dreamweaver.appdev, Murray
    *ACE* wrote:
    >
    >> SELECT contactFName, contactLName, contactPassword,
    contactEmail,
    >> contactRecord FROM tblcontactdata WHERE
    contactPassword =
    >> 'uwUYreTTM' AND contactFName = Murray AND
    contactLName = Summers
    >
    > That might be the problem. Try adding the quotes to the
    string:
    >
    > $query_rsPassword = sprintf("SELECT contactFName,
    contactLName,
    > contactPassword, contactEmail, contactRecord FROM
    tblcontactdata WHERE
    > contactPassword = %s AND contactFName = '%s' AND
    contactLName = '%s'",
    > GetSQLValueString($colname_rsPassword, "text"),
    $_POST['fname'],
    > $_POST['lname']);
    >
    > --
    > Joe Makowiec
    >
    http://makowiec.net/
    > Email:
    http://makowiec.net/email.php

  • I need help with DW, PHP & MySQL please.

    Hello, I am new to website development and am trying to set up a form for collecting data on my website and have a question that I can’t find an answer to anywhere else. I was wandering if someone there would be kind enough to help?  I am using Dreamweaver in CS4 and my host already has PHP & MySQL installed on the server that I can use.  My question is: Do I need to download XAMP or WAMP on my computer before trying to connect my form to the server?  Also, do I need to change the page I am putting the form on to .PHP extension or can I just embed the PHP form into an existing HTML page?
    Most of the training tutorials I’ve read don’t start at the most basic beginning but rather expect people to already have a basic knowledge of the topics they are trying to learn.  If anyone knows the best place to get answers to the most basic questions like this one or a beginners guide to working with DW, PHP & MySQL I will gladly go there rather than waste your time on questions you’ve probably already answered a bezillion times.
    Thank you for the help.

    Strictly speaking, you don't need XAMPP or WAMP on your local computer. But if you're serious about getting involved with PHP/MySQL, you should definitely set up a local testing environment with one or the other. It's safer and more efficient. Don't expose all your errors on a live server. You can find instructions on  how to set up a testing environment here: http://www.adobe.com/devnet/dreamweaver/articles/setting_up_php.html.
    To develop with PHP, you should always use a .php file name extension. Any other choice is very rare.
    There's a tutorial on building your first dynamic website with DW here: http://www.adobe.com/devnet/dreamweaver/articles/first_dynamic_site_pt1.html.
    For more in-depth help, you might want to consider grabbing hold of a copy of "The Essential Guide to Dreamweaver CS4 with CSS, Ajax, and PHP". (Yes, I wrote it, so it's a bit of shameless self-promotion, but you'll find it answers many of your questions - and probably a lot you hadn't even thought of.)

  • Need help with MySQL connection error _mmServerScripts

    Trying to create insert a recordset I got the message:
    "The files from the _mmServerScripts folder are for the server model PHP-MySQL. You try to connect to a database using a different server model .Please remove this folder outside the Dreamweaver environment on both local and testing machines and try again."
    I've searched the net and have seen this message hunting people since dw8...
    I could not find a "cure".
    Things to notice:
    0 - Yes the whole thing is apache/php/mysql... just DW thinks it's not.
    1 - Both the connection and the Recordset actualy works. I have a whole site based on this connection and the recorsets I've created manualy based on it.
    2 - It does not matter if we erase or not the _mmServerScripts folder the message stands still allover.
    3 - The problem seems to show up when you split servers...
    3.1 - If I test in a WAMP environment where apache and mysql are in the same machine I can use DW to create data objects for me.
    3.2 - If I test in my real test environment which have web server and db server separated from each other then I can't use DW to create data objects, see bindings, behaviours etc... all I get is this message.... while the code itself runs fine anyway.
    Does any one already knows how to work around or fix this?
    Thanks,
    Julio

    Thanks PZ,
    Yes everything is fine with the site definition.
    everything works. I can upload, run, test all ok.
    The only thing that does not work is to insert any sort of data object through DW interface. If I declare my reordsets by hands or even If I use the ones DW created in my local test server all works fine.
    Then if I use the site definition and try to see any bindings or create a recordset or create a new connection using dw... then the messages come up and dw can't go any further in that task.
    By spli servers I mean one phisical linux server with apache/php but without mySQL + one physical Linux server with mySQL but without apache/php.
    So when I use a site definition that points either to a WAMP or LAMP i.e. when everything is in the same machine DW goes happy and does whatever it's asked to do.
    When I try that on the real mccoy environment (with the two separated servers)... It looks like DW gets confused...

  • Help with mySQL Connection string

    Here is hoping someone can help & once I get it down I promise I'll post all my work on this list so some other newbie can benefit.
    I'm simply trying to run a very very straightforward JDBC test with mySQL & I keep getting the "Server configuration denies access to data source" error. But before you tell me that I must simply look at what my mysql.db & mysql.user table allows - I'VE TRIED THAT. I realize that the error is probably there somewhere - but I can't see it.
    I've tried connecting with 2 different accounts - the provided "root" & a user I created "deep" to 2 different databases the provided "test" & "testdb" which I created) . Here is what mysql says about the two different databases
    mysql> select * from db;
    Host  | Db         | User |.......
    -----+------------+-------
    | %         | test    |       | ......
    | %         | test\_% |     | ........
    | localhost | testdb  | deep |........Note that "root" should have access to "test" & deep@localhost should have access to "testdb" right?
    So here are all the connection strings I have tried - all return the same error below
            Connection conn = DriverManager.getConnection(
                "jdbc:mysql://localhost:3306/test", "root", "mypass"
    //            "jdbc:mysql://localhost:3306/testdb", "deep", "mypass"
    //            "jdbc:mysql://localhost/testdb?user=deep&password=mypass"
    //            "jdbc:mysql://localhost/testdb", "deep", "mypass"
    //            "jdbc:mysql://localhost:3306/testdb?user=deep@localhost&password=mypass"
    //            "jdbc:mysql://localhost:3306/testdb?user=deep&password=mypass"
    //            "jdbc:mysql://localhost/testdb", "deep@localhost", "mypass"
    //            "jdbc:mysql:///test", "root", "mypass"
    //            "jdbc:mysql://localhost/test", "root@localhost", "mypass"
    );My Error:
    Exception in thread "main" java.sql.SQLException: Server configuration denies access to data source
            at org.gjt.mm.mysql.MysqlIO.init(MysqlIO.java:193)
            at org.gjt.mm.mysql.Connection.connectionInit(Connection.java:261)
            at org.gjt.mm.mysql.jdbc2.Connection.connectionInit(Connection.java:89)
            at org.gjt.mm.mysql.Driver.connect(Driver.java:167)
            at java.sql.DriverManager.getConnection(DriverManager.java:517)
            at java.sql.DriverManager.getConnection(DriverManager.java:199)
            at TestMySQL4.main(TestMySQL4.java:76)BTW:
    I am using MacOSX 10.1
    MySQL 3.23.42
    The driver is: mm.mysql-2.0.6.jar
    Please help!
    'deep

    hi amandeep
    well i m getting the same error message when trying to connect MYSQL using mm.jdbc driver.
    java.sql.SQLException : Server configuration denies access to data base source.
    query.jdbcDriver org.gjt.mm.mysql.Driver
    query.databaseURL jdbc:mysql://aaa.bbb.com/pluto
    query.databaseUserName samin
    query.databasePwd samin
    query.summaries true
    i hve installed mysql on server aaa.bbb.com network 1
    and trying to run application on network 2
    Thanks
    samir

  • New Bie help with MySQL & servlet

    Hi,
    I am trying to execute a small action... some how my code does not work. All it shows is a blank page with no error....
    Can any one help me to optimize this code so that it works?
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package oneword;
    import com.mysql.jdbc.Connection;
    import com.mysql.jdbc.Statement;
    import java.io.IOException;
    import java.io.PrintWriter;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import java.util.Random;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class Register extends HttpServlet {
        private String name = null;
        private String emailID = null;
        private String nameDB = "jdbc:mysql://localhost:3306/register";
        private String mysqlUser = "root";
        private String mysqlPassword = "abc";
        private String mySqlJdbcDriver = "com.mysql.jdbc.Driver";
        private Connection conn = null;
         * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
         * @param request servlet request
         * @param response servlet response
         * @throws ServletException if a servlet-specific error occurs
         * @throws IOException if an I/O error occurs
        protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException, ClassNotFoundException, SQLException {
            response.setContentType("text/html;charset=UTF-8");
            PrintWriter out = response.getWriter();
            name = request.getParameter("_name");
            emailID = request.getParameter("_email");
            try {
                Random generator = new Random();
                int activationPassword = generator.nextInt(100000);
                Class.forName(mySqlJdbcDriver);
                conn = (Connection) DriverManager.getConnection(nameDB,mysqlUser,mysqlPassword);
                Statement statement = (Statement) conn.createStatement();
                String sqlCommand = "INSERT INTO userdata(name, email, validation, " +
                        "banned, activatepassword, password)values("+name+", "+emailID+", 0, 0,"+activationPassword+", 'ddd')";
                statement.executeQuery(sqlCommand);
                out.println(name);
                out.println("<br>"+emailID);
                out.println("rows affected:");
                conn.close();
            } catch (SQLException ex) {
            // handle any errors
            System.out.println("SQLException: " + ex.getMessage());
            System.out.println("SQLState: " + ex.getSQLState());
            System.out.println("VendorError: " + ex.getErrorCode());
            } finally {
                out.close();
        // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
         * Handles the HTTP <code>GET</code> method.
         * @param request servlet request
         * @param response servlet response
         * @throws ServletException if a servlet-specific error occurs
         * @throws IOException if an I/O error occurs
        @Override
        protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            try {
                processRequest(request, response);
            } catch (ClassNotFoundException ex) {
                Logger.getLogger(Register.class.getName()).log(Level.SEVERE, null, ex);
            } catch (SQLException ex) {
                Logger.getLogger(Register.class.getName()).log(Level.SEVERE, null, ex);
         * Handles the HTTP <code>POST</code> method.
         * @param request servlet request
         * @param response servlet response
         * @throws ServletException if a servlet-specific error occurs
         * @throws IOException if an I/O error occurs
        @Override
        protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            try {
                processRequest(request, response);
            } catch (ClassNotFoundException ex) {
                Logger.getLogger(Register.class.getName()).log(Level.SEVERE, null, ex);
            } catch (SQLException ex) {
                Logger.getLogger(Register.class.getName()).log(Level.SEVERE, null, ex);
    }Thank you

    A blank page usually indicate that an exception is been thrown but cannot be displayed because the response is already started/committed/processed. Just read the appserver's logs as usual for the details.
    Your servlet class does way too much. You're mingling all the processing steps together in one class. This is simply asking for trouble. Use a DAO class for accessing the DB. Use a JSP file for presentation. Use a business object to process the input/output data. Use a servlet for controlling the request. To start off, you may get some ideas out of this article and the JSP/Servlet follow-up: [http://balusc.blogspot.com/2008/07/dao-tutorial-data-layer.html].
    Oh, your JDBC code is not safe against SQL injection attacks either.

  • Need help with thinkvantage access connection

    Here a log file with new access connection:
    Connection status:  Disconnected
    Cause:  Driver disconnected while associating.
    Error code:  229378
    Recommended actions:
    Verify that the encryption settings (WEP/TKIP/AES) specified in this profile match those expected by the wireless network.
    Verify that the wireless adapter in your computer has not been restricted from accessing the radio channels being used by the wireless network.
    If the problem persists, contact your network administrator and provide the troubleshooting information below.
    Adapter Details
    Adapter name  11a/b/g Wireless LAN Mini PCI Express Adapter                  
    Adapter type  Wireless LAN                                                   
    Adapter speed  54.0 Mbps                                                      
    Driver/Firmware version  7.6.0.96/ N/A                                                  
    Adapter status  Enabled                                                        
    Connection Status  Disconnected                                                   
    Disable unused cards?  Yes                                                            
    TCP/IP Settings
    DHCP enabled?  Yes                                                            
    Append parent suffixes of the primary DNS suffix?  Yes                                                            
    Register connection's DNS suffix in registration?  Yes                                                            
    Register connection's DNS suffix in DNS registration?  Yes                                                            
    Enable LMHOSTS Lookup?  No                                                             
    NetBIOS setting  "Default"                                                      
    Wireless Settings
    Network name (SSID)  linksys                                                        
    Connection type  Access point                                                   
    Wireless mode  Auto                                                           
    Security encryption  None                                                           
    System Information
    System model  7732CTO                                                        
    BIOS version  7LETB7WW (2.17 )                                               
    Operating system version  Windows Vista,  Service pack 2                                 
    Access connections version  5.31                                                           
    Access Point scan list
    Network name (SSID)              Wireless mode  MAC address                   Signal strength Channel
    linksys                          802.11g        00:1C:10:54:65:B6              24%            11
    Global Settings
    Network
     Allow all users of this system to switch to any existing location profile  -> No
     Allow the wireless LAN radio to be turned off when inactive  -> No
     Allow selection of location profiles with Fn+F5 On Screen Display menu  -> Yes
     Enable autodeletion of unused profiles  -> Yes
    Notifications
     Show ThinkVantage Access Connections status icon in task tray  -> No
     Show wireless status icon in task tray  -> No
     Display the progress indicator window when a profile is being applied  -> Yes
    Preferences
     Enable sound effects  -> Yes
     Do not show balloon tips from the Access Connections system tray icon  -> Yes
     Show WiMAX page as default on Main GUI  -> No
    Automatic location profile switching list
     Include Ethernet connections in automatic switching and prompt me to save Ethernet ports  -> Yes
     When no other connections are available, connect through Wireless WAN or WiMAX  -> No
    Wireless priority list
    Selection    Priority     Location profile name                                            Connection order                 Connection details             
    No                  1     linksys                                                          Wireless LAN                     SSID: linksys                  
    Log File
    Debug Log is enabled
    It didn't happen when I use old version. Can anybody help me?

    Are you getting any error message while connecting to ds..?
    Are you able to go online on wired computer...?
    Are you able to go online on any wireless computer on your network..?
    Open the router setup page and under the wireless tab,Change the Channel width to 20MHz only and Channel to 11-2.462GHz and click on save settings...Under the Advanced Wireless Settings...Change the Beacon Interval to 75,Change the Fragmentation Threshold to 2304,Change the RTS Threshold to 2304 and Click on Save Settings... 
    Now,check.

  • Need help with Outlook 2013 connecting to Exchange server(2010)

    Hi
    I need help with Outlook 2013 and with my exchange server(2010) email account
    After setting up account initially emails come in and than after an hour or two stop. My OWA is working fine with no issues. I have even created a forward rule in OWA to my GMAIL account whch works fine
    However Outlook 2013 is not syncing messages, have difficulty in sending emails sometimes as it takes too long.  In fact the connection also is intermittent. Even if the task bar shows connected to exchange, it seems that is not the case since new emails
    and any emails I compose dont work.  I have trouble shot the issue with my ISP and email service provide, but they havent resolved the issue  I have also done a TraceRoute and that shows no drops or problems to he exchange server.
    Can someone please help me resolve this matter so I can continue to use Outlook 2013( running Windows 8.1) in both my computers which have the identical problem
    Look forward to a solution soon
    Thanks

    Hi Angela
    Thanks for your message
    To answer your questions, please note the following
    a) My account is set up in Cache Mode( not online mode)
    b) I am the only other user on the account
    c) When the connection to the exchange server is broken, I see upon clicking connection tab that there is no information in the box, and when I press reconnect it starts showing "connecting"
    d) When the connection to the server is there, it shows  connection as "established"
    e) Sorry I dont understand th meaning of CAS array in your environment?  Can you pls explain
    Since yday I have been using Outlook 2010 on desktop and Outlook 2013 on my laptop using Exchange 2013 account.  So far all emails are syncing, and I can send emails from both computers. However, I am concerned that the connection can break-off anytime,
    as it has done that in the past on both outlook versions.  The max time it has worked without any problem is 48 hrs and than after that the same issue of not connection, not syncing and unable to send emails happens
    My ISP has checked and there is no network connectivity issues. My email service provider has trouble shot the issue many times, but to no positive results.  I have also changed the profile a few times, but the intermittent connectivity problem hasn't
    been resolved.
    Can you identify the possible causes and more importantly a working permanent solution please
    Thanks
    Mahesh

  • Help With Some PHP

    On
    www.imagesandwords.org.uk/andrewjamesrp/
    I had a go with a PHP CSS switcher using a tutorial from,
    www.alistapart.com/articles/phpswitch/
    and I can't seem to get it working.
    I want to do some more complex changes in the css but for now am just trying to work out the php. Can anyone help me? I am not sure what information to inclue but I have done my damndest to follow the tutorial.
    You can see that the page isn't in the root directory but the php and css files are in the andrewjamesrp folder.
    Thanks
    Martin

    Thanks Nate
    Here's the link: http://imagesandwords.org.uk/andrewjamesrp/index.html
    Here's switcher.php
    < ?php
    $set = $_GET['set'];
    setcookie ('sitestyle', $set, time()+31536000, '/', 'www.imagesandwords.org.uk', '0');
    header("Location: $HTTP_REFERER");
    ?>
    Here's my < head>:
    < link href="stylemain.css" rel="stylesheet" type="text/css" media="all"/>
    < link rel="stylesheet" type="text/css" media="screen" title="User Defined Style" href="<?php echo (!$sitestyle)?'stylemain':$sitestyle ?>.css" />
    < link rel="alternate stylesheet" type="text/css" media="screen" title="Red" href="red.css" />
    < link rel="alternate stylesheet" type="text/css" media="screen" title="Blue" href="blue.css" />
    < link rel="alternate stylesheet" type="text/css" media="screen" title="Green" href="green.css" />
    < /head>
    And here's the switch in the < body>
    < li id="red">< a href="./switcher.php?set=styleone">1</a></li>
    < li id="green">< a href="/switcher.php?set=styletwo">2</a></li>
    < li id="blue">< a href="switcher.php?set=stylethree">3</a></li>
    I have used different ways of referencing the switcher.php there because I am not sure how to do it. This page is a practice in my own site so the index.html is not in the true root.
    I have changed the file extension to .html and I think my host uses PHP 4.2.something. Or not PHP 5.
    Regards
    Martin

  • Help with html / php contact form

    Hi guys I was hoping to get some help with a contact form on my website, to be honest I havent a clue about php but kind of okay with html thats why the php code is just a copy and paste from some website, just trying to marry it up with the html but getting errors.
    Hopfully one of you can see the problem.
    Error on Submitting:
    Notice: Undefined variable: name in \\nas44ent\Domains\g\gethinhayman.co.uk\user\htdocs\send_form_email.php on line 69
    Notice: Undefined variable: message in \\nas44ent\Domains\g\gethinhayman.co.uk\user\htdocs\send_form_email.php on line 75
    We are very sorry, but there were error(s) found with the form you submitted. These errors appear below.
    The Name you entered does not appear to be valid.
    The Comments you entered do not appear to be valid.
    HTML Code:
    <section id="contact" class="four">
                                                                <div class="container">
                                                                          <header>
                                                                                    <h2>Contact</h2>
                                                                          </header>
                                                                          <form method="post" action="send_form_email.php">
                                                                                    <div class="row half">
                                                                                              <div class="6u"><input type="text" class="text" name="name" placeholder="Name" /></div>
                                                                                              <div class="6u"><input type="text" class="text" name="email" placeholder="Email" /></div>
                                                                                    </div>
                                                                                    <div class="row half">
                                                                                              <div class="12u">
                                                                                                        <textarea name="message" placeholder="Message"></textarea>
                                                                                              </div>
                                                                                    </div>
                                                                                    <div class="row">
                                                                                              <div class="12u">
                                                                                                        <a href="http://www.mywebsite.co.uk/email_form.php" class="button submit">Send Message</a>
                                                                                              </div>
                                                                                    </div>
                                                                          </form>
                                                                </div>
                                                      </section>
    php Code:
    <?php
    if(isset($_POST['email'])) {
        $email_to = "my email address";
        $email_subject = "Mail from Site";
        function died($error) {
            // your error code can go here
            echo "We are very sorry, but there were error(s) found with the form you submitted. ";
            echo "These errors appear below.<br /><br />";
            echo $error."<br /><br />";
            echo "Please go back and fix these errors.<br /><br />";
            die();
        // validation expected data exists
        if(!isset($_POST['name']) ||
            !isset($_POST['email']) ||
            !isset($_POST['message'])) {
            died('We are sorry, but there appears to be a problem with the form you submitted.');      
        $first_name = $_POST['name']; // required
        $email_from = $_POST['email']; // required
        $comments = $_POST['message']; // required
        $error_message = "";
        $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
      if(!preg_match($email_exp,$email_from)) {
        $error_message .= 'The Email Address you entered does not appear to be valid.<br />';
        $string_exp = "/^[A-Za-z .'-]+$/";
      if(!preg_match($string_exp,$name)) {
        $error_message .= 'The Name you entered does not appear to be valid.<br />';
      if(strlen($message) < 1) {
        $error_message .= 'The Comments you entered do not appear to be valid.<br />';
      if(strlen($error_message) > 0) {
        died($error_message);
        $email_message = "Form details below.\n\n";
        function clean_string($string) {
          $bad = array("content-type","bcc:","to:","cc:","href");
          return str_replace($bad,"",$string);
        $email_message .= "Name: ".clean_string($name)."\n";;
        $email_message .= "Email: ".clean_string($email)."\n";
        $email_message .= "Message: ".clean_string($message)."\n";
    // create email headers
    $headers = 'From: '.$email_from."\r\n".
    'Reply-To: '.$email_from."\r\n" .
    'X-Mailer: PHP/' . phpversion();
    @mail($email_to, $email_subject, $email_message, $headers); 
    ?>
    <?php
    ?>

    PHP CODE:  SaveAs send_form_email.php
    <?php
    if(isset($_POST['email'])) {
        // EDIT THE 2 LINES BELOW AS REQUIRED
        $email_to = "[email protected]";
        $email_subject = "Your email subject line";
        function died($error) {
            // your error code can go here
            echo "We are very sorry, but there were error(s) found with the form you submitted. ";
            echo "These errors appear below.<br /><br />";
            echo $error."<br /><br />";
            echo "Please go back and fix these errors.<br /><br />";
            die();
        // validation expected data exists
        if(!isset($_POST['name']) ||
            !isset($_POST['email']) ||
            !isset($_POST['message'])) {
            died('We are sorry, but there appears to be a problem with the form you submitted.');     
        $name = $_POST['name']; // required
        $email_from = $_POST['email']; // required
        $comments = $_POST['message']; // required
        $error_message = "";
        $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
      if(!preg_match($email_exp,$email_from)) {
        $error_message .= 'The Email Address you entered does not appear to be valid.<br />';
        $string_exp = "/^[A-Za-z .'-]+$/";
      if(!preg_match($string_exp,$name)) {
        $error_message .= 'The Name you entered does not appear to be valid.<br />';
      if(strlen($message) < 2) {
        $error_message .= 'The message you entered does not appear to be valid.<br />';
      if(strlen($error_message) > 0) {
        died($error_message);
        $email_message = "Form details below.\n\n";
        function clean_string($string) {
          $bad = array("content-type","bcc:","to:","cc:","href");
          return str_replace($bad,"",$string);
        $email_message .= "Name: ".clean_string($name)."\n";
        $email_message .= "Email: ".clean_string($email_from)."\n";
        $email_message .= "Message: ".clean_string($message)."\n";
    // create email headers
    $headers = 'From: '.$email_from."\r\n".
    'Reply-To: '.$email_from."\r\n" .
    'X-Mailer: PHP/' . phpversion();
    @mail($email_to, $email_subject, $email_message, $headers);
    ?>
    <!-- include your own success html here -->
    Thank you for contacting us. We will be in touch with you very soon.
    <?php
    ?>
    HTML Code -- save as html page.
    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Contact Form</title>
    </head>
    <body>
    <section id="contact" class="four">
    <div class="container">
    <header>
    <h2>Contact</h2>
    </header>
    <form method="post" action="send_form_email.php">
    <div class="row half"> <div class="6u">
    <input type="text" class="text" name="name" placeholder="Name" />
    </div>
    <div class="6u">
    <input type="text" class="text" name="email" placeholder="Email" />
    </div>
    </div>
    <div class="row half"> <div class="12u">
    <textarea name="message" placeholder="Message"></textarea>
    </div>
    </div>
    <div class="row">
    <div class="12u">
    <input type="submit" name="submit" value="Send">
    </div>
    </div>
    </form>
    </div>
    </section>
    </body>
    </html>
    Upload both to your Apache server to test.
    EDIT:  changed typo on Submit button -- valuse to value.
    Nancy O.

  • Need help with simple php files

    I have simple php files that are setup with includes for a header, sidebar and footer... all other data is within the file. There is no dynamic info on the pages, yet I cannot get the files to load up in InContext. Is there a way to make this work?
    I can get an html file to work flawless, but something seems to stop the php file from working.
    Thanks,
    Ken Henderson

    What I mean is, whenever I try to edit any file with a php extension, I get a 404 error... even a simple file with no includes. I created a php file with one line of text within an editable region and I still could not edit it with InContext.
    The site I'm trying to work with is http://www.thunderbirdchemical.com
    The homepage is index.php
    The simple test file I made is test.php
    Thanks for your help.
    Ken

  • Need help with MySQL Query...Again

    Ok so I get this error when I enter "springfield" and "MA" for the city and state.
    This server program accepts either a 'zipcode' or 'city, state' depending on the choice # passed to it.
    I just need to be able to perform the query.
    Thanks!!
    java.sql.SQLException: Unknown column 'springfield' in 'where clause'
    Error4
         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2975)
         at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1600)
         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1695)
         at com.mysql.jdbc.Connection.execSQL(Connection.java:3020)
         at com.mysql.jdbc.Connection.execSQL(Connection.java:2949)
         at com.mysql.jdbc.Statement.executeQuery(Statement.java:959)
         at ThreadConnect.run(ZipcodeServer.java:84)Here is my code:
    import java.sql.*;
    import java.io.*;
    import java.net.*;
    public class ZipcodeServer {
         static void runServer() {
              ServerSocket server;
              Socket connection;
              try {
                   System.out.println("Creating Server Socket " + 5000 + " . . . ");
                   server = new ServerSocket(5000);
                   System.out.println("SUCCESS!!!");
                   while (true) {
                        System.out.println("Waiting for connection.");
                        connection = server.accept();
                        System.out.println("Done");
                        ThreadConnect t = new ThreadConnect(connection);
                        t.start();
              } catch (IOException e) {
                   System.out.println("Error5");
                   e.printStackTrace();
         public static void main(String args[]) {
              ZipcodeServer.runServer();
    class ThreadConnect extends Thread {
         Socket connection;
         DataOutputStream output;
         DataInputStream input;
         ThreadConnect(Socket x) {
              connection = x;
         public void run() {
              try {
                   input = new DataInputStream(connection.getInputStream());
                   output = new DataOutputStream(connection.getOutputStream());
                   try {
                        int choice = input.readInt();
                        String city, state;
                        int zipcode;
                        if (choice == 1) {
                             int zc = input.readInt();
                             DatabaseConnection.connect();
                             DatabaseConnection.rs = DatabaseConnection.s
                                       .executeQuery("SELECT City,State FROM Zipcodes "
                                                 + "WHERE ZipCode = " + zc);
                             while (DatabaseConnection.rs.next()) {
                                  state = DatabaseConnection.rs.getString("State");
                                  output.writeUTF(state);
                                  output.flush();
                                  city = DatabaseConnection.rs.getString("City");
                                  output.writeUTF(city);
                                  output.flush();
                        } else if (choice == 2) {
                             city = input.readUTF();
                             state = input.readUTF();
                             DatabaseConnection.connect();
                             DatabaseConnection.rs = DatabaseConnection.s
                                       .executeQuery("SELECT ZipCode FROM Zipcodes "
                                                 + "WHERE City = " + city + " AND State = "
                                                 + state);
                             while (DatabaseConnection.rs.next()) {
                                  zipcode = DatabaseConnection.rs.getInt("ZipCode");
                                  output.writeInt(zipcode);
                                  output.flush();
                   } catch (Exception e) {
                        System.out.println("Error4");
                        e.printStackTrace();
                   } finally {
                        DatabaseConnection.close();
              } catch (IOException e) {
                   System.out.println("Error3");
                   e.printStackTrace();
    class DatabaseConnection {
         static Connection con;
         static Statement s;
         static ResultSet rs;
         static String driver = "com.mysql.jdbc.Driver";
         static String url = "jdbc:mysql://***.****.******/***";
         static String user = "*******";
         static String password = "********";
         static void connect() {
              try {
                   Class.forName(driver).newInstance();
                   System.out.println("Loaded Driver");
                   con = DriverManager.getConnection(url, user, password);
                   System.out.println("Connected to database\n");
                   con.setAutoCommit(false);
                   s = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
                             ResultSet.CONCUR_READ_ONLY);
              } catch (Throwable e) {
                   System.out.println("Error2");
                   e.printStackTrace();
         static void close() {
              try {
                   rs.close();
                   s.close();
                   con.close();
                   System.out.println("\nDisconnected From Database");
              } catch (Throwable e) {
                   System.out.println("Error1");
                   e.printStackTrace();
    }

    R.Baldwin7 wrote:
    I tried it. Still getting the same error.
    Code no looks like:
    else if (choice == 2) {
                             city = input.readUTF();
                             state = input.readUTF();
                             DatabaseConnection.connect();
                             PreparedStatement ps = DatabaseConnection.con.prepareStatement("SELECT ZipCode FROM Zipcodes "
                                       + "WHERE City = " + city + " AND State = "
                                       + state);
                             DatabaseConnection.rs = ps.executeQuery();
                             while (DatabaseConnection.rs.next()) {
                                  zipcode = DatabaseConnection.rs.getInt("ZipCode");
                                  output.writeInt(zipcode);
                                  output.flush();
    Read the API docs and the JDBC Tutorials for the proper way to use a PreparedStatement. It may "work" to add the quotes, but it is definately not the right way to do it. What happens if the city entered contains an apostrophe? Your statement will be broken again. Like I said, use a PreparedStatement and use it right.

  • Help with newsletter PHP Mail script for mySQL / cron job

    I'm just trying to set up a PHP script to send emails as a cron job.
    It pretty much seems to work, but I can't get it to do two parts.
    The first part is to send the emails, and the second is to send a notification email to the site owner confirming that the emails have been sent.
    The script looks like:
    <?php
    include_once "connect_to_mysql.php";
    $sql = mysql_query("SELECT UserID, Firstname, Email, Newsletter_Received FROM Users WHERE Firstname='test' LIMIT 20");
    $numRows = mysql_num_rows($sql);
    $mail_body = '';
    while($row = mysql_fetch_array($sql)){
      $id = $row["UserID"];
      $email = $row["Email"];
      $name = $row["Firstname"];
      $mail_body = 'Test - please ignore';
        $subject = "Safari Awards Newsletter";
        $headers  = "From:[email protected]\r\n";
        $headers .= "Content-type: text/html\r\n";
        $to = "$email";
        $mail_result = mail($to, $subject, $mail_body, $headers);
      if ($mail_result) {
      mysql_query("UPDATE Users SET Newsletter_Received='1' WHERE Email='$email' LIMIT 20");
      } else {
    ?>
    <?php
    if ($numRows == 0) {
      $subj = "Newsletter Sent";
      $body = "The current newsletter has been sent to everyone.";
         $hdr  = "From:[email protected]\r\n";
         $hdr .= "Content-type: text/html\r\n";
         mail("[email protected]", $subj, $body, $hdr);
    ?>
    Basically with the line
    include_once "connect_to_mysql.php";
    included, it sends the emails as per the SELECT query, but does not send the 'Newsletter Sent' email.
    But if I take out that line, it obviously doesn't send the emails as per the SELECT query, but it does send the 'Newsletter Sent' email.
    Any suggestions on what might need changing in order for it to do both would be much appreciated!
    Thanks.

    Change this line -
    if ($numRows == 0) {
    to this -
    if ($mail_result) {

  • TS2634 Help with ipad 3 connection to TV

    I can't get my ipad 3 to work with my tv. I hav the av adapter and hdmi cable hooked up right. Not sure what else to try.

    http://ipad.about.com/od/iPad_Guide/a/How-To-Connect-Your-Ipad-To-Your-Tv.htm
    Since you are a new iPad user, here's some helpful info to get you started.
    Complete guide to using iOS 6
    http://howto.cnet.com/ios-6-complete-guide/
    Guide to Built-In Apps on iOS
    https://sites.google.com/site/appleclubfhs/support/advice-and-articles/guide-to- built-in-apps-ios
    You can download a complete iOS 5 iPad User Guide and iOS 6 iPad User Guide here: http://support.apple.com/manuals/ipad/
    Also, Good Instructions http://www.tcgeeks.com/how-to-use-ipad-2/
    Apple - iPad - Guided Tours
    http://www.apple.com/ipad/videos/
    Apple iPad Guided Tours - Watch the videos see all the amazing iPad apps in action. Learn how to use FaceTime, Mail, Safari, Videos, Maps, iBooks, App Store, and more.
    http://www.youtube.com/watch?v=YT2bD0-OqBM
    http://www.youtube.com/watch?v=ROY4tLyNlsg&feature=relmfu
    http://www.youtube.com/watch?v=QSPXXhmwYf4&feature=relmfu
    How to - Articles & User Guides & Tutorials
    http://www.iphone-mac.com/index.php/Index/howto/id/4/type/select
    iPad How-Tos  http://ipod.about.com/lr/ipad_how-tos/903396/1/
    You can download this guide to your iPad.
    iPad User Guide for iOS 5
    http://itunes.apple.com/us/book/ipad-user-guide-for-ios-5/id470308101?mt=11
     Cheers, Tom

  • Please Help with my 3G connection nightmare

    Im going to try to explain this without rambling on but i can almost write a novel with this problem.
    Got iphone on the 24 of july. First 3 weeks, phone, email, safari work great. One day, safari goes slow on 3g and/or doesn't connect at all. Reset, restore, reebot..the whole nine yards with phone. Same problem. 3G works for a few minutes, next minute its stuck in connection for a minute at a time and then gives me the messages either..
    "Safari cannot open page because the server is not responding"
    or "Safari cannot open page because the connection was reset which sometimes occurs when the server is busy."
    Called ATT, no help saying 3G network is working fine in area(20 minutes outside boston.) Call Apple tell me to go to genius, tells me to wait for update.
    Remind you that my phone's reception and safari where FANTASTIC for the first 3 weeks. I suggested to both parties that i can read them off the software or setting to see if something was wrong and i was pretty much shushed.
    Then i install update, have full 3-5 bar 3G reception-SAME ERROR MESSAGES. The phone will be fine for a little, then bog down to slower than edge and finally just not connect, same with email.
    Went back to apple and gave me a new phone. This has to fix it right...NO. Call ATT because i am pretty sure its not the phone. They said they sent some updates to the phone and it should be fixed. Worked for maybe a half an hour and same problems.
    I really don't know what to do. I have 5 bar reception, calls seem fine, but safari, or stocks/weather, and email are not working or responding. The only thing i can think of is that after every restore, i sync it back to a backup. DOes anyone know of any sites, or apps or any change that would have caused this? My phone was working great one day, and literally the next day its not working.
    Itunes for some reason did not save certain backups and saved this one specific one i had deleted many times. When i sync phone, it always tells me to transfer app purchases that i had deleted off the phone and itunes. itunes almost seems to not be syncing on the sync if that makes any sense.
    If anyone has any suggestions or help i would GREATLY APPRECIATE and happily go into more detail on specific things. If anyone knows how to take the contacts off my phone and save them somewhere, i will happily restore my iphone to a "new phone" through itunes. and then just add my contacts, music and apps, as if they are going on for the first time because i am pretty sure it is something that is stuck in one of the backups that gets reapplied to the phone everytime i restore it. Or the sim card....
    Thanks you very much in advance.
    Message was edited by: bostonboy34

    I don't know enough about how the SIM cards actually work to know if trading one out would help you. It's probably worth doing as it would be the least invasive "fix." You should be able to get a new SIM card from either an Apple store or your carrier.
    It really sounds like you need to restore your phone as new, but I can understand not wanting to lose your contacts.
    You can download a free 60-day trial of Office Pro 2007 from Microsoft. Here's the page: http://us20.trymicrosoftoffice.com/product.aspx?re_ms=oo&family=officepro&cultur e=en-US. It includes Outlook. Once your contacts are in Outlook, you can restore your phone and then resync your contacts. From Outlook I think you can export your contacts to a format that could be imported into other software. But the problem would be to get it into your iPhone.
    MobileMe is another solution you might want to try. You can do a free trial of it, also -- http://www.me.com. I haven't had the problems with it that others have reported, but I'm using it to push only contacts and calendar entries.
    Sometimes there just aren't easy solutions. I have to get my contacts and my calendar from Lotus Notes. I sync it from Notes on one computer to a Palm Pilot. From the Palm to Outlook on a second computer. Then MobileMe picks it up from Outlook and pushes it to my iPhone. It's not ideal, but it does work after a fashion.

Maybe you are looking for

  • Query on cancel operation on adf:table

    Hi, We are developing an ADF-BC project using JDeveloper 11g. I have an query on the industry standard for implementing the 'Cancel' operation. In my application,all the pages have an adf:table with CRUDimplemenations on it. In a scenario where I do

  • Using Nokia PC Suite - Communication Center to cal...

    I know that I can use the Nokia PC Suite - Communication Center (NPCS-CC) to start a call in my mobile, but... Is it possible to configure the PC to be used as the speaking / hearing device? I would love to make a phone call from the PC and be able t

  • Cannot re-download The Adobe CS5 Design Premium to new laptop

    Dear All, I would like to re-install the CS5 Design Premium software that I've purchased last year because I would like to install it on my new laptop. Now I am using my toshiba laptop so I need to re-install the software, but when I logged on into t

  • GroupWise 8.0.3 patch on NetWare server

    I read that there were some problems with the GroupWise 8.0.3 patch on a NetWare box. Have these been resolved with the current version?

  • Orainst on SuSE 6.0

    Last week I receive the SuSE 6.0, cos I don't have nothing important on my linux partition I clear everything and start it from zero. But when I try to install the 8.0.5.1 EE it gives me an error OS Error: Unable to get current working directory any