Jump to content

No error still not working


chand.sethi77
 Share

Recommended Posts

I have this action page after a registration form :

<php include("connect.php") ?><?php require("constant.php"); ?><?php//connecting to mysql	$connect = mysql_connect(DB_SERVER, DB_USER, DB_PASS);		if (!$connect) {			die ("Mysql Connection failed. Error is :" .mysql_error() );					}?><?php $firstname = $_POST['firstname'];$lastname = $_POST['lastname'];$username = $_POST['username'];$email = $_POST['email'];$password = $_POST['password'];$age = $_POST['age'];?><?php	$db_select = mysql_select_db("chand", $connect);		if (!$db_select) {			die ("Databse selection failed! :" .mysql_error());		}?><?php $insert = "INSERT INTO users (						firstname, lastname, username, email, password						) VALUES (							'$firstname', '$lastname', '$username','$email', '.md5{$password}'							)";if (!$insert) {		die ("Error in server! reason : " .mysql_error() );}?>

Please tell me what is the problem. It is neither showing any error nor inserting data in ANY database

Link to comment
Share on other sites

<?php$insert = "INSERT INTO users (						firstname, lastname, username, email, password						) VALUES (							'$firstname', '$lastname', '$username','$email', '.md5{$password}'							)";if (!$insert) {		die ("Error in server! reason : " .mysql_error() );}

you need to pass the $insert in mysql_quey() http://php.net/function.mysql_query. now it is not even being executed by mysql yet.after that checking the return value of mysql_query() will ensure that query successfuly done or not.

Edited by birbal
Link to comment
Share on other sites

somethink like..

<?php$insert = "INSERT INTO users (						firstname, lastname, username, email, password						) VALUES (							'$firstname', '$lastname', '$username','$email', '.md5{$password}'							)";if (!mysql_query($insert)) {		die ("Error in server! reason : " .mysql_error() );}elseecho 'inserted';

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...