RE: [PHP] Problem with inserting values into database through php
| From: | bbonkosk at tampabay dot rr dot com | Date: | Thu, 01 Jan 1970 00:00:00 +0000 |
| Subject: | RE: [PHP] Problem with inserting values into database through php | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-115454@lists.php.net to get a copy of this message | ||
Just and FYI update, in case someone else has this problem...
The problem was the example was using $PHP_SELF as the form action variable,
of course it has been discussed on this list that in the newer versions
of PHP, register_globals is turned off in php.ini, so $PHP_SELF had no real
meaning, so no data was actually being passed. So, just an update to change it
to:
<form action="<?php echo $_SERVER['PHP_SELF']?>" method=post>
-Brad
> [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
thos> e
> 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! *
> *****************************************************
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>