Help with code I´m dessperate !!!!!
Posted: Sat Nov 12, 2005 6:15 pm
Hi friends i´m about to go crazy with this piece of code i´ve written it makes new users´ registration data be written into a mySQL database . The environment is windows XP Professional apache 1.3.26 PHP 4.2.3 and MySQL 3.23.52 with phpmyadmin 2.3.0 here´s the code Please help me it shows the message Sorry your data couldn´t be inserted into our database , plase check them that I´ve put for exception management but I´ve checked the Mysql code and it´s alright and as soon as i check with phpmyadmin there´s nothing in the tables. I gave permission to the user and it connects but writes nothing into the tables.Pleae help!!!!.
PS I have installed Service pack 2 because i also use MS Vstudio .NET beta 2 and I´ve included the following exceptions in the WXPSP2 personal firewalls thinking this might help but nothing
httpd.exe
mysqld-nt.exe
mysqld-opt.exe
Thanxs !!!!!!!!!!!.
PS I have installed Service pack 2 because i also use MS Vstudio .NET beta 2 and I´ve included the following exceptions in the WXPSP2 personal firewalls thinking this might help but nothing
httpd.exe
mysqld-nt.exe
mysqld-opt.exe
Code: Select all
<?php
//user session start up
session_start () ;
//New Users registration data
$reg_firstname=trim($_POST[´reg_first_name´]);
$reg_lastname=trim($_POST[´reg_last-name]);
$reg_username=trim($_POST[´reg-username´]);
$reg_password=trim($_POST[´reg-password´]);
$reg_email=trim($_POST[´reg_password´]);
// user sex choice
switch ($_POST[´reg_sex´])
{
case "M":
$reg_sex="M";
break;
case "F" :
$reg_sex="F";
break;
default:
break;
}
$reg_icq=trim($_POST[´reg_icq´]);
$reg_yahoo_id=trim($_POST[´reg_yahoo_id´]);
$reg_msn_id=trim($_POST[´reg_msn_id´]);
//Variables for the conection to the users table in the asian dreams database
$db_host="localhost";
$db_user="eddy";
$db_password="ishikawa";
$db_name="asiandreams";
$table_name="users";
$link=mysql_connect($db_host,$db_user,$db_password)
or die ("Im sorry the database connection to localhost couldn´t be executed , try later.");
mysql_select_db($db_name,$link);
$reg_data_insert=mysql_query("INSERT INTO ´$table_name´ (index,firstname,lastname,username,password,email,sex,ICQ,Yahoo_Messenger,MSN,Country,City) VALUES (´0´,´$reg_firstname´,´$reg_last_name´,´$reg_username´,password(´$reg_password´),´$reg_email´,´reg-sex´,´$reg_icq´,´$reg_yahoo_id´,´$reg_msn_id´)");
if ($reg_data_insert)
{
header("location: http://localhost/asiandreams/welcome.html");
$_SESSION[´logged_username´]="$reg_username";
exit();
}
else
die("Sorry your data couldn´t be inserted into our database , plase check them" );
?>Thanxs !!!!!!!!!!!.