Php application for inserting updating and deleting record
See also My SQL: choosing an API guide and related FAQ for more information.Alternatives to this function include: Returns the number of affected rows on success, and -1 if the last query failed.PROBLEMYou notice that the second query is not failing as you had expected even though the record being inserted is an exact duplicate of a record previously inserted.CAUSEWhen the first query (the REPLACE query) deletes a record from t1 in the first stage of the REPLACE operation, it cascades the delete to the record that would be duplicated in t2.Therefore, processing the My SQL database we must first master is on the My SQL database connection.The following php script to call the database server : Each data processing, call php connection and put it on the database My SQL script processing.
ON DUPLICATE KEY UPDATE" syntax, on PHP 5.3.29 and mysql_affected_rows() was returning either 2 for updated row, 1 for inserted new row, and also 0, which was not documented, evidently when nothing was inserted. I see that when try to use mysql_affected_rows() with "mysql_pconnect(...)" without link indetifier as param in "mysql_affected_rows()" the result is allways -1.For example, it is used for registration application, verification applications, applications on a cms and others.If you create own a website, you will be in desperate need of a My SQL database processing system.Inside this post, we will learn about the various types of processing using a My SQL database from php programming language.Read this tutorial : Create PHP Connect to the My SQL Database Server Each summoning the My SQL database, then we have to open a connection to the database server first.
Another way is to put the php connection to another file and do the calling php file with the following script : CREATE TABLE 'people' ( 'id' int(11) NOT NULL auto_increment, 'name' varchar(100) NOT NULL, 'email' varchar(100) NOT NULL, 'country' varchar(25) NOT NULL, PRIMARY KEY ('id') ) ; I hope this tutorial can help you in understanding how to call a My SQL database table through php script.