Re: function problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> '$shippingCountry1')")))
>  {
>    echo "the insertiont cannot be done";

echo mysql_error();

http://php.net/mysql_error

>    exit();
>  }
>     header("Location:http://$HTTP_HOST/$DOCROOT/allright.html";);

DON'T DO THAT!!!

Just do:
include 'allright.html';

The Location header is for a document that has *MOVED* to a new URL.

Your document has not moved.

>  exit();
> }
>
> When i try to insert ->  the problem is in the insertion. The message
> "the
> insertiont cannot be done"; appears. Do you know what could be the
> mistake?

We don't know, but any time you get an error like that, the software that
caused that error will have more infomation available if you dig for it.
http://php.net/mysql_error
is just what you use for MySQL.

If it wasn't MySQL you were using, but something else in some other code,
there would still be some function to tell you what went wrong.

Get in the habit of not only checking for errors, but LOGGING them
somewhere and reviewing those logs.

You can use:
http://php.net/error_log to do like this:
error_log(__FILE__ . ': ' __LINE__  . ' ' . @mysql_error() . " $query ");

Or you could even get serious and use http://php.net/error_handler with
http://php.net/trigger_error to catch and log all errors.

By default, your errors will be in the Apache error_log file (usually
/usr/local/apache/logs/error_log) but you can send them any place you
want.


-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux