Re: [PHP] Weird Syntax Error
-Original Message- From: Edgar da Silva (Fly2k) [mailto:[EMAIL PROTECTED] Sent: Thursday, November 13, 2008 9:39 AM To: Kyle Terry Cc: PHP General Mailing List Subject: Re: [PHP] Weird Syntax Error Try: $insert = INSERT INTO release_file_upload (upl_file_name, upl_file_type, upl_file_size, upl_date, upl_by, upl_path, release_id) VALUES ('$filename', '{$_SESSION['upload']['type']}', '{$_SESSION['upload']['size']}', now(), '$username', '$path', '$release_id'); 2008/11/13 Kyle Terry [EMAIL PROTECTED]: I keep getting this syntax error on the following string... syntax error unexpected T_ENCAPSED_AND_WHITESPACE expecting T_STRING or T_VARIABLE or T_NUM_STRING $insert = INSERT INTO release_file_upload (upl_file_name, upl_file_type, upl_file_size, upl_date, upl_by, upl_path, release_id) VALUES ('$filename', '$_SESSION['upload']['type']', '$_SESSION['upload']['size']', now(), '$username', '$path', '$release_id'); Yup... I was just about to say--you need to wrap your array references with curly braces {}. Otherwise, I believe PHP will look for a primitive variable named $_SESSION, not an array whose indices are upload and size. HTH, Todd Boyd Web Programmer You could also use the . operator instead and quote using the quote method if you are using PDO. But this is a personal style I guess. -- Thodoris
[PHP] Weird Syntax Error
I keep getting this syntax error on the following string... syntax error unexpected T_ENCAPSED_AND_WHITESPACE expecting T_STRING or T_VARIABLE or T_NUM_STRING $insert = INSERT INTO release_file_upload (upl_file_name, upl_file_type, upl_file_size, upl_date, upl_by, upl_path, release_id) VALUES ('$filename', '$_SESSION['upload']['type']', '$_SESSION['upload']['size']', now(), '$username', '$path', '$release_id'); -- Kyle Terry | www.kyleterry.com
Re: [PHP] Weird Syntax Error
On 13 Nov 2008, at 15:28, Kyle Terry wrote: I keep getting this syntax error on the following string... syntax error unexpected T_ENCAPSED_AND_WHITESPACE expecting T_STRING or T_VARIABLE or T_NUM_STRING $insert = INSERT INTO release_file_upload (upl_file_name, upl_file_type, upl_file_size, upl_date, upl_by, upl_path, release_id) VALUES ('$filename', '$_SESSION['upload']['type']', '$_SESSION['upload']['size']', now(), '$username', '$path', '$release_id'); I can't see anything wrong with that line (except that I don't think those variables will interpolate correctly, and you don't seem to be escaping stuff going into your SQL which is, ya know, bad!!). Your problem is probably on the line before, possible several lines before. Post a bit of the surrounding code. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Weird Syntax Error
Hi Kyle, The line looks fine in my text editor (SciTE). Have you checked the line above it is properly enclosed and ended? Michael Kubler *G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz Kyle Terry wrote: I keep getting this syntax error on the following string... syntax error unexpected T_ENCAPSED_AND_WHITESPACE expecting T_STRING or T_VARIABLE or T_NUM_STRING $insert = INSERT INTO release_file_upload (upl_file_name, upl_file_type, upl_file_size, upl_date, upl_by, upl_path, release_id) VALUES ('$filename', '$_SESSION['upload']['type']', '$_SESSION['upload']['size']', now(), '$username', '$path', '$release_id');
Re: [PHP] Weird Syntax Error
Try: $insert = INSERT INTO release_file_upload (upl_file_name, upl_file_type, upl_file_size, upl_date, upl_by, upl_path, release_id) VALUES ('$filename', '{$_SESSION['upload']['type']}', '{$_SESSION['upload']['size']}', now(), '$username', '$path', '$release_id'); 2008/11/13 Kyle Terry [EMAIL PROTECTED]: I keep getting this syntax error on the following string... syntax error unexpected T_ENCAPSED_AND_WHITESPACE expecting T_STRING or T_VARIABLE or T_NUM_STRING $insert = INSERT INTO release_file_upload (upl_file_name, upl_file_type, upl_file_size, upl_date, upl_by, upl_path, release_id) VALUES ('$filename', '$_SESSION['upload']['type']', '$_SESSION['upload']['size']', now(), '$username', '$path', '$release_id'); -- Kyle Terry | www.kyleterry.com -- Abraços Edgar Ferreira da Silva Engenheiro de Software Campinas - SP (19) 8110-0733 - Aprenda PHP, cole códigos, saiba das vagas de empregos: http://www.manjaphp.com.br
RE: [PHP] Weird Syntax Error
-Original Message- From: Edgar da Silva (Fly2k) [mailto:[EMAIL PROTECTED] Sent: Thursday, November 13, 2008 9:39 AM To: Kyle Terry Cc: PHP General Mailing List Subject: Re: [PHP] Weird Syntax Error Try: $insert = INSERT INTO release_file_upload (upl_file_name, upl_file_type, upl_file_size, upl_date, upl_by, upl_path, release_id) VALUES ('$filename', '{$_SESSION['upload']['type']}', '{$_SESSION['upload']['size']}', now(), '$username', '$path', '$release_id'); 2008/11/13 Kyle Terry [EMAIL PROTECTED]: I keep getting this syntax error on the following string... syntax error unexpected T_ENCAPSED_AND_WHITESPACE expecting T_STRING or T_VARIABLE or T_NUM_STRING $insert = INSERT INTO release_file_upload (upl_file_name, upl_file_type, upl_file_size, upl_date, upl_by, upl_path, release_id) VALUES ('$filename', '$_SESSION['upload']['type']', '$_SESSION['upload']['size']', now(), '$username', '$path', '$release_id'); Yup... I was just about to say--you need to wrap your array references with curly braces {}. Otherwise, I believe PHP will look for a primitive variable named $_SESSION, not an array whose indices are upload and size. HTH, Todd Boyd Web Programmer