Updating a record in mysql
This function returns the number of deleted records plus the number of inserted records. ON DUPLICATE KEY UPDATE" queries, the return value will be 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.When use link identifier "mysql_affected_rows($this_sql_connection)" - everything is Fine.
In previous tutorials covered following topics:a)Simple login interface: Tutorialb)File upload module: Tutorialc)Admin dashboard for monitoring user logins: Tutorial In this tutorial we are going to update the code in file upload module to keep a track of number of files uploaded by the user at any given time.close(); /** HELPER FUNCTIONS BELOW **/ /** * Connect to a my SQL Database * The values used here are specific to this sandbox environment; * Replace these values with your my SQL server values.* */ function connect_to_db() function setup_table($db, $table) function add_three_records($db, $table) function print_table($db, $table) ?Where column_name is the name of the column to be updated and new_value is the new value with which the column will be updated.The following My SQL statement will update receive_qty, pub_lang, and receive_dt columns with new values 20, Hindi and 2008-07-10 if purch_price is more than 50.Next we create print Count variable in which we get previous upload/print count of the user and add filescount to it.
Now we need to save new print Count to database so we run UPDATE mysql query and update printcount where userid matches the currently logged in user.
If the last query was a DELETE query with no WHERE clause, all of the records will have been deleted from the table but this function will return zero with My SQL versions prior to 4.1.2.
When using UPDATE, My SQL will not update columns where the new value is the same as the old value.
We are first gettting userid from file using File function, then we run select mysql query to get userdetails of that userid from mysql database.
We get the user details paramter in “results” parameter.
This creates the possibility that may not actually equal the number of rows matched, only the number of rows that were literally affected by the query.