RE: [PHP] confused big time
| From: | Chris W. Parker | Date: | Wed, 07 Apr 2004 00:00:32 +0000 |
| Subject: | RE: [PHP] confused big time | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-182568@lists.php.net to get a copy of this message | ||
Andy B <mailto:aborka1@wmis.net>
on Tuesday, April 06, 2004 4:51 PM said:
> they both use the same identical format to insert the arrays. there
> is an interesting problem though: the first one complains about use
> of undefined constant add - assumed 'add' in the second query...the
> first one doesnt do that??
>
> everything is set up exactly the same for both queries except the
> relevant variable/array names...
two things i would recommend before disecting your code.
1. write readable queries.
GOOD:
$sql = "
SELECT
name
, age
, height
, etc
FROM user
WHERE
name = '$name'
AND height = '5'";
2. always put single quotes around array keys. $array['key']
hth,
chris.