Re: Help INSERTing to MySQL
| From: | php3 at developersdesk dot com | Date: | Sat, 24 Feb 2001 02:07:27 +0000 |
| Subject: | Re: Help INSERTing to MySQL | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-41424@lists.php.net to get a copy of this message | ||
Addressed to: Clayton Dukes <cdukes@cdukes.com>
php-general@lists.php.net
** Reply to note from Philip Olson <philip@cornado.com> Sat, 24 Feb 2001 01:31:30 +0000 (GMT)
>
>
> > Hello, This is my first attempt, so I'm prolly doing something stupid,
> > but can someone tell me why this doesn't work? All it returns is
> > "Unable to INSERT to database"
>
> Change : or die("Unable to INSERT to database");
> To : or die(mysql_error());
>
> And see what it tells you. Odds are there's a field not being accounted
> for. When not designating columns (just values) it's important to make
> sure all columns are accounted for. See :
>
> http://www.sqlcourse.com/
>
> It'll provide some basic SQL help. It's recommended to write out columns
> and values (easier to make sense of).
I find SET even easier:
INSERT INTO Table SET
or
UPDATE Table SET
then
field1 = '$Field1',
field2 = '$Field2',
fieldN = '$FieldN'
That makes it very easy to keep track of what goes where. It is
somewhat new to MySQL, but anything less than a year old should have it
available.
Rick Widmer
Internet Marketing Specialists
http://www.developersdesk.com