Jump to content

[SOLVED] Will not write into Database:


mikelmao

Recommended Posts

My query doesnt save into the DB.. here it is:

 

                   <?php include 'connect.php';
                    if($_SERVER['REQUEST_METHOD'] == 'POST')
                    {
                      if($_POST['fname'] == "" || $_POST['lname'] == "" || $_POST['uname'] == "" || $_POST['pass'] == "" || $_POST['pass2'] == "" || $_POST['mail'] == "" || $_POST['birth'] == "")
                      {
                        echo "Please fill in all the fields before continuing";
                        echo "<meta http-equiv=Refresh content=2;url='order.php'>";
                      }
                      elseif($_POST['pass'] != $_POST['pass2'])
                      {
                        echo "The 2 passwords do not match";
                        echo "<meta http-equiv=Refresh content=2;url='order.php'>";
                      }
                    else
                    {
                    mysql_query("INSERT INTO order (fname, lname, uname, pass, mail, birth, plan, time) VALUES ('" . $_POST['fname'] . "', '" . $_POST['lname'] . "', '" . $_POST['uname'] . "', '" . $_POST['pass'] . "', '" . $_POST['mail'] . "', '" . $_POST['birth'] . "', '" . $_POST['plan'] . "', '" . $_POST['time'] . "')");
                    echo "Thank you for ordering at CXHosting, We will review your application within 48 Hours. You will recieve an email when your application has been aproved";
                    }
                    }
?>

Connect.php=

<?php
$con = mysql_connect('localhost','****','*****');  
if (!$con)
  {
    echo "Connot connect.";
  }
mysql_select_db('***********' ,$con);
?>

it all exists.. I dont get any MYSQL Errors.... Please help.. thanks :)

Link to comment
https://forums.phpfreaks.com/topic/118126-solved-will-not-write-into-database/
Share on other sites

try this:

 

mysql_query("INSERT INTO order (fname, lname, uname, pass, mail, birth, plan, time) VALUES ('$_POST['fname']' , '$_POST['lname']' , '$_POST['uname']', '$_POST['pass']', '$_POST['mail']', '$_POST['birth']', '$_POST['plan']', '$_POST['time']"')");

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.