Jump to content

Parse error: syntax error, unexpected T_STRING in /home/8888/public_html/phil


prcollin

Recommended Posts

Can someone please help me with this.  I thought I was doing well then I got a couple errors thrown at me

 

Parse error: syntax error, unexpected T_STRING in /home/f8888r/public_html/p8888t/login.php on line 17

 

<?php

$host="localhost";
$user="fin888r_pr8888";
$passwd="ni888888";
$database="fin888r_U88rs";



$con = mysql_connect("$host", "$user", "$passwd", "$database");

if (!$con)
(
die('Could not connect: ' . mysql_error())
)

mysql_select_db("findzer_Users", $con);

$sql=\ "insert into newuser ('user_name', 'user_pass', 'full_name', 'user_email', 

'confirm_email', 'alt_email', 'user_city')

Values
('$_post[user_name]','$_post[user_pass]','$_post[full_name]','$_post[user_email]','$_post[co

nfir_memail]','$_post[alt_email]','$_post[user_city]";

if (!mysql_query($sql,$con))
(
die('Error: ' . mysql_error());
)

echo "1 record added";
mysql_close($con)
?>

 

is there something I am typing wrong?  I also tried it without the '    ' in the insert into part

 

 

<?php

$host="localhost";
$user="fin888r_pr8888";
$passwd="ni888888";
$database="fin888r_U88rs";



$con = mysql_connect("$host", "$user", "$passwd", "$database");

if (!$con)
{
die("Could not connect:" . mysql_error());
}

mysql_select_db("findzer_Users", $con);

$sql= "insert into newuser ('user_name', 'user_pass', 'full_name', 'user_email', 

'confirm_email', 'alt_email', 'user_city')

Values
('{$_post['user_name']}','{$_post['user_pass']}','{$_post['full_name']}','{$_post['user_email']}','{$_post['co

nfir_memail']}','{$_post['alt_email']}','{$_post['user_city']}";

if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}

echo "1 record added";
mysql_close($con)
?>

<?php

$host="localhost";
$user="fin888r_pr8888";
$passwd="ni888888";
$database="fin888r_U88rs";



$con = mysql_connect("$host", "$user", "$passwd", "$database");

if (!$con)
{
die("Could not connect:" . mysql_error());
}

mysql_select_db("findzer_Users", $con);

$sql= "insert into newuser ('user_name', 'user_pass', 'full_name', 'user_email', 

'confirm_email', 'alt_email', 'user_city')

Values
('{$_post['user_name']}','{$_post['user_pass']}','{$_post['full_name']}','{$_post['user_email']}','{$_post['co

nfir_memail']}','{$_post['alt_email']}','{$_post['user_city']}";

if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}

echo "1 record added";
mysql_close($con)
?>

 

when I use this code it give me

 

Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''user_name', 'user_pass', 'full_name', 'user_email', 'confirm_email', 'alt_e' at line 1

 

 

change the query to:

insert into newuser ('user_name', 'user_pass', 'full_name', 'user_email', 'confirm_email', 'alt_email', 'user_city') Values('{$_post['user_name']}','{$_post['user_pass']}','{$_post['full_name']}','{$_post['user_email']}','{$_post['confir_memail']}','{$_post['alt_email']}','{$_post['user_city']}"

now i get

 

 

Parse error: syntax error, unexpected T_STRING in /home/findzer/public_html/philsshit/login.php on line 21

 

 

sorry guys i dont have phpedit at work so i cant check all this on my own that is why I am asking for your help so much.  THANKS ALOT AHEAD OF TIME!!!

I'm putting it through Zend Studion 5.5.1, and getting a clean bill of health.  I'm guessing you aren't sending the full code.

 

this is my exact code

 

<?php

$host="lxxxxt";
$user="fixxxx_pxxxxxn";
$passwd="nxxxxx7";
$database="fixxxxr_Uxxxs";


$con = mysql_connect("$host", "$user", "$passwd", "$database");

if (!$con)
{
die("Could not connect:" . mysql_error());
}

mysql_select_db("findzer_Users", $con);

$sql= "insert into newuser ('user_name', 'user_pass', 'full_name', 'user_email', 'confirm_email', 'alt_email', 'user_city') Values('{$_post['user_name']}','{$_post['user_pass']}','{$_post['full_name']}','{$_post['user_email']}','{$_post['confir_memail']}','{$_post['alt_email']}','{$_post['user_city']}"


Values
('{$_post['user_name']}','{$_post['user_pass']}','{$_post['full_name']}','{$_post['user_email']}','{$_post['co

nfir_memail']}','{$_post['alt_email']}','{$_post['user_city']}";

if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}

echo "1 record added";
mysql_close($con)
?>

 

and the form that feeds this script the information is

 

<html>
<body>
<form action="login.php" method="post">
Username: <input type="text" name="user_name">
Password: <input type="password" name="user_pass">
Full Name: <input type="text" name="full_name">
E-Mail : <input type="text" name="user_email">
Confirm E-mail: <input type="text" name="confirm_email">
Alt Email: <input type="text" name="alt_email">
City: <input type="text" name="user_city">
<input type="submit" />

 

 

Thats all of it

cleaned up your code:

<?php

$host="lxxxxt";
$user="fixxxx_pxxxxxn";
$passwd="nxxxxx7";
$database="fixxxxr_Uxxxs";


$con = mysql_connect("$host", "$user", "$passwd", "$database");

if (!$con)
{
die("Could not connect:" . mysql_error());
}

mysql_select_db("findzer_Users", $con);

$sql= "insert into newuser ('user_name', 'user_pass', 'full_name', 'user_email', 'confirm_email', 'alt_email', 'user_city') Values('{$_post['user_name']}','{$_post['user_pass']}','{$_post['full_name']}','{$_post['user_email']}','{$_post['confir_memail']}','{$_post['alt_email']}','{$_post['user_city']} Values('{$_post['user_name']}','{$_post['user_pass']}','{$_post['full_name']}','{$_post['user_email']}','{$_post['confir_memail']}','{$_post['alt_email']}','{$_post['user_city']}";

if (!mysql_query($sql,$con))
{
die("Error:  ". mysql_error());
}

echo "1 record added";
mysql_close($con)
?>

now getting

 

Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''user_name', 'user_pass', 'full_name', 'user_email', 'confirm_email', 'alt_email' at line 1

 

i am using mysql version 4.1.22-standard

oops, my fault. should have error checked the sql too:

<?php

$host="lxxxxt";
$user="fixxxx_pxxxxxn";
$passwd="nxxxxx7";
$database="fixxxxr_Uxxxs";


$con = mysql_connect("$host", "$user", "$passwd", "$database");

if (!$con)
{
die("Could not connect:" . mysql_error());
}

mysql_select_db("findzer_Users", $con);

$sql= "insert into newuser (`user_name`, `user_pass`, `full_name`, `user_email`, `confirm_email`, `alt_email`, `user_city`) Values('{$_post['user_name']}','{$_post['user_pass']}','{$_post['full_name']}','{$_post['user_email']}','{$_post['confir_memail']}','{$_post['alt_email']}','{$_post['user_city']} Values('{$_post['user_name']}','{$_post['user_pass']}','{$_post['full_name']}','{$_post['user_email']}','{$_post['confir_memail']}','{$_post['alt_email']}','{$_post['user_city']}";

if (!mysql_query($sql,$con))
{
die("Error:  ". mysql_error());
}

echo "1 record added";
mysql_close($con)
?>

oops, my fault. should have error checked the sql too:

<?php

$host="lxxxxt";
$user="fixxxx_pxxxxxn";
$passwd="nxxxxx7";
$database="fixxxxr_Uxxxs";


$con = mysql_connect("$host", "$user", "$passwd", "$database");

if (!$con)
{
die("Could not connect:" . mysql_error());
}

mysql_select_db("findzer_Users", $con);

$sql= "insert into newuser (`user_name`, `user_pass`, `full_name`, `user_email`, `confirm_email`, `alt_email`, `user_city`) Values('{$_post['user_name']}','{$_post['user_pass']}','{$_post['full_name']}','{$_post['user_email']}','{$_post['confir_memail']}','{$_post['alt_email']}','{$_post['user_city']} Values('{$_post['user_name']}','{$_post['user_pass']}','{$_post['full_name']}','{$_post['user_email']}','{$_post['confir_memail']}','{$_post['alt_email']}','{$_post['user_city']}";

if (!mysql_query($sql,$con))
{
die("Error:  ". mysql_error());
}

echo "1 record added";
mysql_close($c
?>

 

now i get

 

Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

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.