Forum Moderators: coopster

Message Too Old, No Replies

Associative arrays saving values too variable

PHP errors

         

Robeysan

1:03 am on Jun 17, 2009 (gmt 0)

10+ Year Member



Im trying to save a sql statment to variable $sql, some of the values in my sql stament are held in an array called $shonet

I get this error when I run my script"
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /big/dom/xthelocalsounds/www/DEV/addshows.php on line 100

When I remove the array from the string It works but I need to figure out how to use the $shonet array.

here is the code that is producing the error


$sql = "INSERT INTO SHOWS (SHOW_ID, APPROVED, SHOW_NAME, DESCRIPTION, GENRE, SHOW_DATE, SHOW_TIME, HR, MIN, AMPM, CHARGE, AGE, POSTED_BY, COMMENTS, VENUE_NAME, ARTIST_NAME, TSF, LMN, LPI, LS, V, JB, SM, VIEWS) VALUES (NULL, 'n', '$tittle', '$desc', '$genre', '$showDate', '$time', '$hr', '$min', '$ampm', '$cover', '$age', '$postedBy', '$comments', '$venueName', '$artistName', '$shonet[\"tsf\"]', '$shonet[\"lmn\"]', '$shonet[\"lpi\"]', '$shonet[\"ls\"]', '$shonet[\"v\"]', 'n', '$shonet[\"sm\"]', '0')";
$result= mysql_qurey($sql) or die (mysql_error());

rocknbil

2:05 am on Jun 17, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



See one possible answer in other thread [webmasterworld.com], what you're doing there definately won't work.

coopster

11:38 am on Jun 17, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Also see the do's and don't section on the PHP arrays [php.net] manual page.