Error updating database php mysql
This is a handy bit of knowledge that helps if you have a large site with lots of scripts.If you create one function to connect to a db, and call that function in all your scripts, it makes for easier code maintenance since you only have to update one line of code to change your mysql connection instead of updating all your scripts individually.For details, see: little note if your scripts sleep a lot, you want to run exactly the same SQL statement 2 times and you have the "My SQL has gone away" error a lot.Try setting the 4th parameter to TRUE as it seems sometimes PHP doesn't spot that resource ID x which it used for the last identical lookup is now dud and so tries to use it, thus bypassing tests such as is_resource() and causing a failure. This can tie up many connections and is not really needed for My SQL as new connections are really fast.2.Apache children are hanging around for too long - combine this with pconnect and you have recipe for disaster. The file of your database should contain the following lines:default-character-set=utf8default-collation=utf8_general_ci It means that your database is created to use the utf8 characterset.
I wouldn't say this is a bug per-se, but it's something to look out for. Both are [email protected] in my win2k install, so my advice for windows is:- create a My SQL user named ODBC with no password- add localhost to ODBC user [right-click ODBC]- set schema previleges to [email protected] use mysql_connect() with no parms, or do not use ;)This turns to work also with odbc_connect:odbc_connect("my DSN", "", "") to use load data local infile function from mysql (at mysql 4.0.16, php 4.3.3), set fifth parameter of mysql_connect() to CLIENT_LOCAL_FILES(128), which based on MYSQL C API ( also mysql server support load file, check by "show variables like 'local_infile' ")Thank 'phpweb at eden2 dot com' to point this out The post from 'Graham_Rule at ed dot ac dot uk' should include the following WARNING: WARING: THE VALUES OF THESE DIRECTIVES WILL BE EXPOSED IF ANY OF THE CODE INCLUDES THE phpinfo() FUNCTION.Suggestions: reduce the amount of time apache child processes stay connected to the client and how many connections before they are killed off. One way to accomplish this is: CREATE DATABASE my_database DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; Then, after connecting to it from PHP you should use:mysql_set_charset("UTF8", $connection); If you don't do this, you will get ugly problems in case other software is reading and writing to the same database!!!!!!In case anyone else is getting "Client does not support authentication protocol requested by server; consider upgrading My SQL client" error.fcgid_module modules/mod_Fcgid Max Request Len 209715200Fcgid Connect Timeout 240Fcgid IOTimeout 240Fcgid Busy Scan Interval 240Fcgid Busy Timeout 240# Esta línea instruye al servidor web para que reconozca un tipo nuevo (php)Add Handler fcgid-script .php# Esta línea indica al servidor web donde está instalado PHP.Fcgid Initial Env PHPRC "c:/php"# Esta línea indica al servidor web que debe ejecutar la aplicación# cuando un cliente (navegador) solicite una página con# extensión Fcgid Wrapper "c:/php/php-cgi.exe" .php# Con esta línea damos los permisos necesarios para que los clientes puedan# acceder/ejecutar a los archivos Just in case you didn't know.
Instead put them into an Apache configuration file and make sure that it is not world-readable.