[solved][PHP] mysql_query problem with multi dim arrays

From: Date: Tue, 06 Apr 2004 00:24:25 +0000
Subject: [solved][PHP] mysql_query problem with multi dim arrays
Groups: php.general 
Request: Send a blank email to php-general+get-182429@lists.php.net to get a copy of this message
> $sql = "INSERT INTO x VALUES ({$_SESSION['add']['name']} ...."; > > oh, and unless add & name are actually constants you should always wrap > them in single quotes. (php will covert the non-exstent constant into a > string a issue an E_NOTICE + its overhead) well that got me on the right track... actually it goes like this: since php expands the multi dimentional array to its text value (whatever that variable holds in it) with the {} around it there is no need for '' in it anywhere... the only thing about the mysql_query deal when using {} around a varname is you have to have '' around the whole set: '{$array[index1][index2]}' for mysql will turn out like 'test2' in the expanded query string.... tnx for the help on that

« previous php.general (#182429) next »