Jump to content

No error still not working


chand.sethi77

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.

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

Archived

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

×
×
  • Create New...