Updating a mysql table with php

They could even copy them into their own scripts and modify your databases!Even if local users are trusted, there is always the possibility of a rogue script (PHP or some nastier language) being installed by an ignorant user.As long as your don't have multiple, possibly untrusted, users on your machine then that's OK.

I am using mysql_connect() in a database class I wrote and the class destructor calls mysql_close.

Because I have several of these database objects, mysql_connect reuses existing connections.

This is fine except when the script reaches the end of execution and PHP's garabage collection calls all the objects' __destruct() functions.

mysql_close() throws a warning that the connection is invalid, in my case for one object.

You can read more about the problem at:(Link too long and had to be broken up)

Since mysql is on localhost, I can just enable named-pipes (which is how you should have mysql setup if you don't need networking) to get around the problem instead of the workaround listed on that page.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 have frequent problems with PHP being unable to connect to My SQL after periods of extreme DB activity.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!!!!!! Long story short, it was because I was not running mysql via named-pipes and Windows was running out of available ports to serve PHP.This is happening with objects which use an existing connection, as the connection has already been closed.I solved the problem by forcing mysql_connect() to create a new connection each time.Tables are uniquely identified by their names and are comprised of columns and rows.


  1. Follow the instructions on the Web site to use the driver with a fresh installation of Windows XP.

  2. Atlanta sports fans have a bold new choice for news and information about their favorite sports teams.

  3. When her oldest friend Luna arrives in town to stay with her for a while, she cooks up a plan to give him a real Latina introduction - and Moka is invited along for the ride Read the rest of this entry ...

  4. Right now you can take 34% off Miss Ling Ling — the price, not the lady — and savor every voluptuous Asian curve this big beauty has to offer.

Comments are closed.