Showing posts with label 9. MySQL. Show all posts
Showing posts with label 9. MySQL. Show all posts

MySQL (Part 1)

  • An Introduction to the PHPMyAdmin Interface. 
  • Creating a New Database  
  • Creating a new Table and entering the value of the field with the requisite datatype.
  • SQL Query displayed in the PHPMyAdmin window.

MySQL (Part 2)

  • Connecting to the database and inserting dummy data into the database. 
  • mysql_connect("server_addr", "username", "password") - Connect to the Database Server with the authorised user and password.  
  • mysql_select_db("database_name") - Selecting a database within a connected database server. 

MySQL (Part 3)

  • Writing some data into the database (INSERT and UPDATE Queries). 
  • mysql_query('TYPE_HERE_YOUR_MYSQL_QUERY') - This function is used to run specific queries on our database.  
  • INSERT QUERY - INSERT into table values ('att1', 'att2' , 'att3', 'att4' ,'att5') //Inserts Data into the table 
  • UPDATE QUERY - UPDATE table_name SET att1='xyz' //Updates the Existing values stored in the table of the database.

MySQL (Part 4)

  • Getting data from the database table and displaying it. 
  • SELECT QUERY - SELECT * FROM table_name WHERE att1='abc' // Query returns the value from the database where att1 = abc  
  • mysql_num_rows() - Gives us the number of rows there are in the query we have just given out. 
  • ORDER BY - Helps to order the output result as when selecting the values form the database.
  • {Use of DESC for Descending ordering / ASCfor Ascending ordering}  

MySQL (Part 5)

  • mysql_fetch_assoc — Fetch a result row as an associative array. 
  • array mysql_fetch_assoc ( resource $result ) //Returns an associative array that corresponds to the fetched row and moves the internal data pointer ahead. mysql_fetch_assoc() is equivalent to calling mysql_fetch_array() with MYSQL_ASSOC for the optional second parameter. It only returns an associative array. 

MySQL (Part 6)

  • Getting data from the database with the help of an HTML form.
  • Creating a FORM where a user can specify a name and selecting the appropriate value from the database.  

MySQL (Part 7)

  • Changing the existing values of the databse table using HTML Forms.
  • Update unique records using the id than individual values.  

MySQL (Part 8)

  • DELETE QUERY - To Delete the specific or all the entries of the Database.
  • DELETE FROM table_name WHERE field='xyz' // Deletes the entry from the database where the field = xyz.