Queries and Arrays
| From: | RealGM Webmaster | Date: | Wed, 27 Dec 2000 06:20:49 +0000 |
| Subject: | Queries and Arrays | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-31924@lists.php.net to get a copy of this message | ||
Hi,
I have a little question. I have an array that contains 25 values, and I need to compare each value
to another value within a query. Previously I had 25 different variables and compared each
individually, but then with more and more users using our system my session management was not
working correctly so I was forced to change. Now, with the new change, I am getting the following
error message:
Parse error: parse error, expecting
T_STRING' or T_VARIABLE' or
`T_NUM_STRING'
My query looks like the following:
$result = mysql_query("SELECT * FROM data WHERE user = '$user' AND (uid =
'$SESSION["p101"]' OR uid = '$SESSION["p102"]' OR uid =
'$SESSION["p103"]' OR uid = '$SESSION["p104"]' OR uid =
'$SESSION["p105"]' OR uid = '$SESSION["p106"]' OR uid =
'$SESSION["p107"]' OR uid = '$SESSION["p108"]' OR uid =
'$SESSION["p109"]' OR uid = '$SESSION["p110"]' OR uid =
'$SESSION["p111"]' OR uid = '$SESSION["p112"]' OR uid =
'$SESSION["p113"]' OR uid = '$SESSION["p114"]' OR uid =
'$SESSION["p115"]' OR uid = '$SESSION["p116"]' OR uid =
'$SESSION["p117"]' OR uid = '$SESSION["p118"]' OR uid =
'$SESSION["p119"]' OR uid = '$SESSION["p120"]' OR uid =
'$SESSION["p121"]' OR uid = '$SESSION["p122"]' OR uid =
'$SESSION["p123"]' OR uid = '$SESSION["p124"]' OR uid =
'$SESSION["p125') ORDER BY y1 DESC, lastname");
It is very long and tedious, and the problem lies in the calls to the array values $SESSION. Does
anyone know if you can use an array in this manner, or so I have to convert each array value into a
stand alone variable then compare from here?
Thanks,
Michael.