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

 

 

Link to comment
Share on other sites

<?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)
?>

Link to comment
Share on other sites

<?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

 

 

Link to comment
Share on other sites

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']}"

Link to comment
Share on other sites

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!!!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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)
?>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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)
?>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.