Jump to content

parse error


prudhvi

Recommended Posts

hi guys, i'm new to php.

 

<?php

  include('includes/header.html');

  if(isset($_POST['submitted']))

  {

  require_once('db_login.php');

 

 

    $fname = $_POST['fname'];

    $lname = $_POST['lname'];

$username = $_POST['username'];

$password = $_POST['password'];

    $email = $_POST['email'];

 

//connection to mysql

$connection = mysql_connect($db_host,$db_username,$db_password);

 

  if(!$connection)

    {

      die("Could not connect to the mysql<br/>".mysql_error());

    }

 

//selecting database

 

$db_selection = mysql_select_db(db_database);

  if(!$db_selection)

    {

      die("Could not select the database:<br/>".mysql_error());

    }

 

//query

 

$query = "INSERT INTO users(fname,lname,username,password,email)VALUES('$fname','$lname','$username','$password','$email')";

 

//executing query

$result = mysql_query($query);

  if(!$result)

    die("There is an error in sql query:<br/>".mysql_error());

  else

  echo "your details are stored in database";

    db_close($connection);

}

?>

  <form action="register.php" method="post">

    <fieldset>

      <pre>

        <label>First Name: <input type="text" name="fname" id="fname" size="20"/></label><br/>

 

          <script language="JavaScript" type="text/javascript">

            if(document.getElementById)

              document.getElementById('fname').focus();

          </script>

 

        <label> Last Name: <input type="text" name="fname" id="fname" size="20"/></label><br/>

        <label> User Name: <input type="text" name="lname" id="lname" size="20"/></label><br/>

        <label>  Password: <input type="password" name="password" id="password" size="20"/></label><br/>

        <label>    Email: <input type="text" name="email" id="email" size="40"/></label><br/>

                          <input type="submit"  value="Register"/>

                          <input type="hidden" name="submitted" value="TRUE" />

      </pre>

    </fieldset>

  </form>

<?php

 

  include('includes/footer.html');

 

?>

 

when run this code i'm getting

parse error on line3.

i.e require_once('db_login.php');

i kept it in the correct still i'm getting error. could all help me to rectify it.

Link to comment
https://forums.phpfreaks.com/topic/142459-parse-error/
Share on other sites

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.