PHP / MySQL Error : Please help

Ok so today I am working on making my form data be imported into my mysql database that I setup. Yet when I run the addrequest.php I get the following error.


Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/aatechni/public_html/addrequest.php on line 3

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/aatechni/public_html/addrequest.php on line 4

Parse error: parse error in /home/aatechni/public_html/addrequest.php on line 4


Here is the code for addrequest.php
PHP:
<?

$username="******";
$password="******";
$database="******";	

$firstname=addslashes($_POST['firstname']);
$lastname=addslashes($_POST['lastname']);
$company=addslashes($_POST['company']);
$phonenumber=addslashes($_POST['phonenumber']);
$address1=addslashes($_POST['address1']);
$address2=addslashes($_POST['address2']);
$city=addslashes($_POST['city']);
$state=addslashes($_POST['state']);
$zipcode=addslashes($_POST['zipcode']);
$brand=addslashes($_POST['brand']);
$model=addslashes($_POST['model']);
$description=addslashes($_POST['description']);
$os=addslashes($_POST['os']);
$urgency=addslashes($_POST['urgency']);

$regdate = date('m d, Y');
$status="new";

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

$query("INSERT INTO users (firstname, lastname, company, phonenumber, address1, address2, city, state, zipcode, brand, model, os, urgency, regdate, status) VALUES ('$firstname[0]','$lastname[1]','$company[2]','$phonenumber[3]','$address1[4]','$address2[5]','$city[6]','$state[7]','$zipcode[8]','$brand[9]','$model[10]','$description[11]','$os[12]','$urgency[13]','$regdate[14]','$status[15]')");

mysql_close();

?>

You can view the form by visiting:
http://www.aatechnical.com/?pid=request


Please help. I need to finish this peice of code before I can start working on the next. Thanks in advance.
 
Also, make sure these names (username, etc) are not reserved. Check your info.php

Code:
<?php
phpinfo();
?>

Try changing the varable names to like $user_name, $db, etc...

The parse error is complaining on like 3 and 4 so that is where I would start.
 
I'll try those out when I get home. THanks for the help Turnkey I will let you know what the results are..... as for now Im about to throw the damn computer out the window :)
:smash: :smash: :smash:
 
Ok I made a few changes in the code so now I dont get those ASCI=92 errors. Now I receive a parse error on LINE 29. I have marked line 29 in red.

Code:
<?php

$db_username="aatechni_client";
$db_password="jk38921";
$db_name="aatechni_client";

$firstname=$_POST['firstname'];
$lastname=$_POST['lastname'];
$company=$_POST['company'];
$phonenumber=$_POST['phonenumber'];
$address1=$_POST['address1'];
$address2=$_POST['address2'];
$city=$_POST['city'];
$state=$_POST['state'];
$zipcode=$_POST['zipcode'];
$brand=$_POST['brand'];
$model=$_POST['model'];
$description=$_POST['description'];
$os=$_POST['os'];
$urgency=$_POST['urgency'];

$regdate = date('m d, Y');
$status="new";

mysql_connect(localhost,$db_username,$db_password);
@mysql_select_db($db_name) or die( "Unable to select database");

[color=red][b]$query = "INSERT INTO users VALUES
(",'$firstname','$lastname','$company','$phonenumber','$address1','$address2','$city','$state','$zipcode','$brand','$model','$os','$urgency','$regdate','$staus')";[/color][/b]
mysql_query($query);

mysql_close();
?>
 
Back
Top