Mysterious problem with INSERT query
johnnyboy10017_at_yahoo.com
Date: 12/07/04
- Next message: AC: "PHP5, Windows Installer and MySQL"
- Previous message: Chris Hope: "Re: PHP Classes"
- Next in thread: Steve: "Re: Mysterious problem with INSERT query"
- Reply: Steve: "Re: Mysterious problem with INSERT query"
- Reply: konsu: "Re: Mysterious problem with INSERT query"
- Reply: Steve: "Re: Mysterious problem with INSERT query"
- Reply: Dani CS: "Re: Mysterious problem with INSERT query"
- Reply: Pedro Graca: "Re: Mysterious problem with INSERT query"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 7 Dec 2004 10:48:36 -0800
I am having a hell of a time with what I think is a very simple query:
It won't actually insert a new record into the specified table, but
returns no error, in fact it returns "1" (or true) that the query was
successful.
Things to know:
1. id field is auto-incrementing primary key
2. Other queries SELECT, UPDATE, and DELETE all work no problem
3. INSERT works via phpMyAdmin
4. Query generated by phpMyAdmin and pasted into my PHP doesn't work
5. Use or omission of quotes and backticks have no effect
Here is my query:
$query = "INSERT INTO `columns`
(`id`, `date`, `status`, `title`, `author`, `abstract`, `asker`,
`askeradd`, `question`, `response`)
VALUES (NULL, '" . date("Y-m-d") . "', 'inactive', '$title', '1',
'$abstract', '$asker', '$askeradd', '$question', '$response')";
Here is the php (trying to generate some kind of helpful feedback):
if ($res = mysql_query($query)) {
print ('$res = ' . $res . "<br>\n");
print ("Error: " . mysql_error() . "<br>\n" . mysql_errno());
} else {
print (mysql_error() . "<br>\n" . mysql_errno());
}
This is what it returns:
$res = 1
Error: BLANK (error message would be here)
0 (error number)
If anyone can suggest other things to try I would really appreciate it;
I have tried everything I can think of.
Thanks,
- Next message: AC: "PHP5, Windows Installer and MySQL"
- Previous message: Chris Hope: "Re: PHP Classes"
- Next in thread: Steve: "Re: Mysterious problem with INSERT query"
- Reply: Steve: "Re: Mysterious problem with INSERT query"
- Reply: konsu: "Re: Mysterious problem with INSERT query"
- Reply: Steve: "Re: Mysterious problem with INSERT query"
- Reply: Dani CS: "Re: Mysterious problem with INSERT query"
- Reply: Pedro Graca: "Re: Mysterious problem with INSERT query"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|