Current location: Hot Scripts Forums » Programming Languages » PHP » desoerate for help!!! Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting ']


desoerate for help!!! Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting ']

Reply
  #1 (permalink)  
Old 09-07-08, 02:47 PM
JavierVT JavierVT is offline
New Member
 
Join Date: Sep 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy desoerate for help!!! Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting ']

Can someone help me with this error?

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting ']' in ../pruebas/formulario_adr.php on line 45

the problem line of code is the following:

$sql = "INSERT INTO ADR (Nombre_ADR, CLUNI, Domicilio_Fiscal, Telefono, Telefono_Celular )

what is causing the error?

Thanks in advance.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 09-07-08, 02:53 PM
connor connor is offline
Wannabe Coder
 
Join Date: Apr 2005
Location: Knob Noster, Mo
Posts: 228
Thanks: 1
Thanked 0 Times in 0 Posts
Well first off you need
This
PHP Code:

$sql "INSERT INTO ADR (Nombre_ADR, CLUNI, Domicilio_Fiscal, Telefono, Telefono_Celular ) 

To end
PHP Code:

$sql "INSERT INTO ADR (Nombre_ADR, CLUNI, Domicilio_Fiscal, Telefono, Telefono_Celular )"
__________________
Connor Strandt
JCS Photography
www.JCStrandt.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 09-07-08, 03:36 PM
JavierVT JavierVT is offline
New Member
 
Join Date: Sep 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks but don't work!!!!!

my complete code is:

PHP Code:

$sql "INSERT INTO ADR (Nombre_ADR, CLUNI, Domicilio_Fiscal, Telefono, Telefono_Celular, Correo_Electronico, Domicilio_para_recibir_correspondencia, Figura_Asociativa, Fecha_de_constitucion, Representante_legal, ¿Esta_siendo_incubada?, Nombre_Incubadora, Numero_de_Socios_de_la_ADR)"VALUES ('$_POST[Nombre_ADR]''$_POST[CLUNI]''$_POST[Domicilio_Fiscal]''$_POST[Telefono]''$_POST[Telefono_Celular]''$_POST[Correo_Electronico]''$_POST[Domicilio_para_recibir_correspondencia]''$_POST[Figura_Asociativa]''$_POST[Fecha_de_constitucion]''$_POST[Representante_legal]''$_POST[¿Esta_siendo_incubada?]''$_POST[Nombre_Incubadora]''$_POST[Numero_de_Socios_de_la_ADR]')"; 

in line 45

and php send:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting ']' in /home/pesaorg.php on line 45

Last edited by mab; 09-07-08 at 03:46 PM. Reason: Code in code tags please.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 09-07-08, 03:45 PM
connor connor is offline
Wannabe Coder
 
Join Date: Apr 2005
Location: Knob Noster, Mo
Posts: 228
Thanks: 1
Thanked 0 Times in 0 Posts
PHP Code:

$sql "INSERT INTO ADR (Nombre_ADR, CLUNI, Domicilio_Fiscal, Telefono, Telefono_Celular, Correo_Electronico, Domicilio_para_recibir_correspondencia, Figura_Asociativa, Fecha_de_constitucion, Representante_legal, ¿Esta_siendo_incubada?, Nombre_Incubadora, Numero_de_Socios_de_la_ADR) VALUES ('$_POST[Nombre_ADR]', '$_POST[CLUNI]', '$_POST[Domicilio_Fiscal]', '$_POST[Telefono]', '$_POST[Telefono_Celular]', '$_POST[Correo_Electronico]', '$_POST[Domicilio_para_recibir_correspondencia]', '$_POST[Figura_Asociativa]', '$_POST[Fecha_de_constitucion]', '$_POST[Representante_legal]', '$_POST[¿Esta_siendo_incubada?]', '$_POST[Nombre_Incubadora]', '$_POST[Numero_de_Socios_de_la_ADR]')"
Try that.
__________________
Connor Strandt
JCS Photography
www.JCStrandt.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 09-07-08, 04:11 PM
JavierVT JavierVT is offline
New Member
 
Join Date: Sep 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
it follows without working

I already put that code but it gives me the same error:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting ']' in /home/formulario_adr.php on line 45

My code is:

PHP Code:

$sql "INSERT INTO ADR

 (Nombre_ADR, CLUNI, Domicilio_Fiscal, Telefono, Telefono_Celular, Correo_Electronico,
 Domicilio_para_recibir_correspondencia, Figura_Asociativa, Fecha_de_constitucion,
 Representante_legal, ¿Esta_siendo_incubada?, Nombre_Incubadora,
 Numero_de_Socios_de_la_ADR)
 VALUES ('
$_POST[Nombre_ADR]', '$_POST[CLUNI]', '$_POST[Domicilio_Fiscal]',
 '
$_POST[Telefono]', '$_POST[Telefono_Celular]', '$_POST[Correo_Electronico]',
 '
$_POST[Domicilio_para_recibir_correspondencia]', '$_POST[Figura_Asociativa]',
 '
$_POST[Fecha_de_constitucion]', '$_POST[Representante_legal]',
 '
$_POST[¿Esta_siendo_incubada?]', '$_POST[Nombre_Incubadora]',
 '
$_POST[Numero_de_Socios_de_la_ADR]')"
Thanks

Last edited by mab; 09-07-08 at 04:29 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 09-07-08, 04:19 PM
mab's Avatar
mab mab is offline
Community VIP
 
Join Date: Oct 2005
Location: Denver, Co. USA
Posts: 2,674
Thanks: 0
Thanked 0 Times in 0 Posts
By itself that line of code does not generate that error message. You likely have a syntax error in the code immediately before that line. Post at least 10 lines of code before that line.

The ¿ and ? language symbols are also likely to cause problems and should be avoided.
__________________
Error checking, error reporting, and error recovery. If your code does not have these to get it to tell you why it is not working, what makes you think someone in a programming forum will be able to tell you why it is not working???
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #7 (permalink)  
Old 09-07-08, 04:38 PM
JavierVT JavierVT is offline
New Member
 
Join Date: Sep 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Ok, my least 10 lines of code before the line 45:

PHP Code:

if (isset($_POST['submit'])) {


    if (empty(
$_POST['Nombre_ADR']))
    {echo 
"<p>Introduzca el <b>Nombre de la ADR</b>.</p>";

    } else if (empty(
$_POST['Domicilio_Fiscal'])) {

        echo 
"<p>Introduzca el <b>Domicilio Fiscal de la ADR</b>.</p>";
    } else if (empty(
$_POST['Telefono'])) {

        echo 
"<p>Introduzca el <b>Teléfono de la ADR</b>.</p>";
    } else if (empty(
$_POST['Correo_Electronico'])) {

        echo 
"<p>Introduzca el <b>Correo Electrónico de la ADR</b>.</p>";
    } else if (empty(
$_POST['Domicilio_para_recibir_correspondencia'])) {

        echo 
"<p>Introduzca el <b>Domicilio para recibir correspondencia de la ADR</b>.</p>";
    } else if (empty(
$_POST['Figura_Asociativa'])) {

        echo 
"<p>Introduzca la <b>Figura Asociativa de la ADR</b>.</p>";
    } else if (empty(
$_POST['Representante_legal'])) {

        echo 
"<p>Introduzca el <b>Nombre del Representante Legal de la ADR</b>.</p>";
    } else if (empty(
$_POST['¿Esta_siendo_incubada?'])) {

        echo 
"<p>Especifique si <b>la ADR esta siendo incubada</b>.</p>";
    } else if (empty(
$_POST['Numero_de_Socios_de_la_ADR'])) {

        echo 
"<p>Introduzca el <b>Número de socios de la ADR</b>.</p>";

    } else {
$sql "INSERT INTO ADR (Nombre_ADR, CLUNI, Domicilio_Fiscal, Telefono, Telefono_Celular, Correo_Electronico, Domicilio_para_recibir_correspondencia, Figura_Asociativa, Fecha_de_constitucion, Representante_legal, ¿Esta_siendo_incubada?, Nombre_Incubadora, Numero_de_Socios_de_la_ADR) VALUES ('$_POST[Nombre_ADR]', '$_POST[CLUNI]', '$_POST[Domicilio_Fiscal]', '$_POST[Telefono]', '$_POST[Telefono_Celular]', '$_POST[Correo_Electronico]', '$_POST[Domicilio_para_recibir_correspondencia]', '$_POST[Figura_Asociativa]', '$_POST[Fecha_de_constitucion]', '$_POST[Representante_legal]', '$_POST[¿Esta_siendo_incubada?]', '$_POST[Nombre_Incubadora]', '$_POST[Numero_de_Socios_de_la_ADR]')"
i hope can help me.

Last edited by mab; 09-07-08 at 05:03 PM. Reason: Code in code tags please.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #8 (permalink)  
Old 09-07-08, 09:31 PM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
I couldn't help but notice that you're doing absolutely no screening of POST variables for malicious code or characters, nor is there even any checking to make sure the data types are correct. You're just blithely taking raw POST vars and sticking them into a SQL statement. It's difficult for me to describe just how incredibly foolhardy and dangerous that is.

I sincerely hope this code isn't accessible from the web or you're in for some extremely rude surprises.
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data | Oracle Date & Substring Functions | Code Snippet Library | [url=http://www.codmb.com/Call Of Duty[/url]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRIN aprogrammer PHP 20 08-31-11 06:56 AM
Parse error: syntax error, unexpected ';', expecting T_OLD_FUNCTION or T_FUNCTION or Dr. Forensics PHP 3 09-13-06 07:21 AM
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' Dr. Forensics PHP 3 07-15-06 04:54 PM
parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting '}' unlisted80 PHP 8 07-05-06 05:28 PM
Parse error: parse error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' HELP stormshadow PHP 2 06-27-06 10:27 AM


All times are GMT -5. The time now is 02:07 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.