RE: [PHP] Problem with inserting values into database through php
| From: | Jay Blanchard | Date: | Fri, 06 Sep 2002 12:52:44 +0000 |
| Subject: | RE: [PHP] Problem with inserting values into database through php | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-115449@lists.php.net to get a copy of this message | ||
[snip]
I´m quite a newbie in making php, but I managed to run the test you
suggested,
but nothin happened. This time it was propably the code I did:
first I added the "or die("Invalid query: $sql");" part and ran the form,
but everything happened just like when refreshing a page.
Then I did this:
$result = mysql_query($sql)
or die("Invalid query: $sql");
echo $sql;
but the database was silent....it just refreshed the page and cleared out
the form.
[/snip]
1. Here is a different method of error checking for queries;
if the query is
$query = "SELECT foo FROM BAR ";
if(!($result = mysql_query($query, $database_connection))){
print("MySQL reports the following error: " . mysql_error() . "\n");
exit();
}
2. Check your web access and error logs for clues.
3. Does the user have permission to INSERT and/or UPDATE? If you set those
on the database did you flush the grant tables?
HTH!
Jay
In clinical trials for diabetes medications do they give sugar pills as
placebos?
*****************************************************
* Texas PHP Developers Conf Spring 2003 *
* T Bar M Resort & Conference Center *
* New Braunfels, Texas *
* Contact jay.blanchard@niicommunications.com *
* *
* Want to present a paper or workshop? Contact now! *
*****************************************************