Date: 10/29/01
- Next message: Jason Wong: "Re: [PHP-DB] Did you use PHP-Nuke? Need help."
- Previous message: Ricky Theil: "RE: [PHP-DB] HELP PLEASE!! Get query error when inserting into My Sql"
- Next in thread: Ricky Theil: "RE: [PHP-DB] HELP PLEASE!! Get query error when inserting into My Sql"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
This also works:
INSERT INTO vcstats VALUES( NULL,column2,column3,column4,column5)
The NULL value will be replaced with theauto-incremented value in the table
-----Original Message-----
From: Ricky Theil [mailto:rtheil <email protected>]
Sent: Monday, October 29, 2001 10:26 AM
To: 'biorn <email protected>'; Robby Whiteside; php-db <email protected>
Subject: RE: [PHP-DB] HELP PLEASE!! Get query error when inserting into
My Sql
If your first field is an auto insert field, then you have to do it like
this:
insert into tablename (column2,column3,column4,column5) values
(value2,value3,value4,value5)
The auto incremented field will be automatically be filled in with the next
available value.
Ricky
-----Original Message-----
From: biorn <email protected> [mailto:biorn <email protected>]
Sent: Monday, October 29, 2001 9:24 AM
To: Robby Whiteside; php-db <email protected>
Subject: Re: [PHP-DB] HELP PLEASE!! Get query error when inserting into
MySql
If any of the values you are trying to insert are not integers, you need to
put single quotes around the variables, ie. $SCRIPT_NAME, $date, $BName, etc
in the insert statement.
Robby Whiteside <robby <email protected>> said:
> Hi There,
>
> I have a query whenever I try to insert something into a mysql table.
> This
is
> the code I am using:
> <?
>
> $host1 = gethostbyaddr("$REMOTE_ADDR");
> $date = date("Y-m-d h:i:s");
> $link = mysql_connect("$host", "$user", "$passwd");
> mysql_select_db("$database", $link); $sql = "INSERT INTO vcstats
> VALUES('', $SCRIPT_NAME, $date,
$HTTP_USER_AGENT,
> $BName, $BVersion, $BPlatform, $REMOTE_ADDR, $host1)"; $result =
> mysql_query($sql) or die("query error<Br>" . mysql_error());
> mysql_close();
>
> ?>
>
> Thanks,
> Robby
>
> ---------------------------------------------
> This message was sent using Endymion MailMan.
> http://www.endymion.com/products/mailman/
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe <email protected>
> For additional commands, e-mail: php-db-help <email protected>
> To contact the list administrators, e-mail: php-list-admin <email protected>
>
---- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Jason Wong: "Re: [PHP-DB] Did you use PHP-Nuke? Need help."
- Previous message: Ricky Theil: "RE: [PHP-DB] HELP PLEASE!! Get query error when inserting into My Sql"
- Next in thread: Ricky Theil: "RE: [PHP-DB] HELP PLEASE!! Get query error when inserting into My Sql"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

