RE: [PHP-DB] Query Issues with MySQL
| From: | Daevid Vincent | Date: | Thu, 20 Jul 2000 21:59:49 +0000 |
| Subject: | RE: [PHP-DB] Query Issues with MySQL | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-1372@lists.php.net to get a copy of this message | ||
Dunno if this matters, but I'd use ' rather than "
$sql = "INSERT INTO FORMS_MAIN VALUES (NULL, 'Blah', 'Blah',
'Blah', 'Blah',
'blah')";
make sure the fields match up to the fields in the database 1:1 and are of
the right type too.
also, I put something like this in my PHP stuff...
$result = mysql_db_query("acnet", "INSERT INTO FORMS_MAIN VALUES (NULL,
'Blah', 'Blah', 'Blah', 'Blah', 'blah')");
if (!$result) { echo "<FONT
COLOR=#FF0000><P><PRE>".mysql_errno().":
".mysql_error()."<BR></PRE></FONT>\n"; exit; }
> -----Original Message-----
> From: Dave [mailto:xor1@adelphia.net]
> Sent: Thursday, July 20, 2000 2:48 PM
> To: php-db@lists.php.net
> Subject: [PHP-DB] Query Issues with MySQL
>
>
> The following code:
>
> $sql = "INSERT INTO FORMS_MAIN VALUES (NULL, \"Blah\", \"Blah\",
> \"Blah\",
> \"Blah\", \"blah\")";
>
> $connection = mysql_connect("localhost","user","passwd") or die
> ('Connection
> Error');
> $db = mysql_select_db("acnet", $connection) or die ('DB Error');
> $result = mysql_query($sql,$connection) or die ('Query Failed');
>
>
> Returns this:
>
> Query failed.
>
>
> My username and passwd are correct. The table exists and has those fields
> exists /w correct data types. What's going on? My sql appears to be
> accurate?
>
> -Dave
>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>