MySQL Archive
Triggers are powerful and versatile tools that enable database administrators and developers to automate actions based on specific events or changes in the database. They act as stored programs, invoked automatically when a predefined condition occurs, such as data insertion, deletion, or modification. This blog explores the concept of triggers in MySQL, their benefits, and
MySQL stands tall as a popular choice due to its efficiency and versatility. One key feature that sets MySQL apart is the CASE statement, which enables developers to implement conditional logic within their queries. This powerful tool empowers programmers to perform dynamic transformations and make data-driven decisions based on specific conditions. Let’s explore the intricacies
To import the large database in MySql, Below are the changes required in MySql my.ini (Configuration file): Step 1: Stop the MySQL server from your control panel. Step 2: Open the file C:\xampp\mysql\bin\my.ini Search and Change the below lines (setting): innodb_buffer_pool_size=4G innodb_log_file_size=2GB innodb_log_buffer_size=256M innodb_flush_log_at_trx_commit=0 innodb_lock_wait_timeout=500 innodb_strict_mode=0 Step 3: Start the MySQL server from your control
Sometime it’s require to submit the form on server without submit button, like on dropdown change. So this can be done with the help of JavaScript. I am taking “tbstudent” table, that we have created on “day12”. Program 41: Submit form through JavaScript <?php $con = mysql_connect(“localhost”,”root”,””); mysql_select_db(“mydb”,$con); if(isset($_REQUEST[‘drpEmp’])) { $selectedId = $_REQUEST[‘drpEmp’]; $query =
Is it better to validate form of our website both client and server side. Both have their own advantages. In client side validation we use JavaScript so it’s faster than the server side validation but sometimes when JavaScript disabled on browser then JavaScript doesn’t work then server side validation will work. Create below mentioned table
Note : In this assignment, I am taking the same database (mydb) that we was created in Day9, but create below new tables for this assignment and add some records in all three table i.e. tbcity, tbcourse and tbstudent. create table tbcity (id int primary key auto_increment, name varchar(50)) create table tbcourse(id int primary key
We have done database connectivity in Day 9, now we will manipulate data in database (i.e. insert, edit, update and delete) with PHP. To manipulate the data I have created more than 1 PHP files, So take a separate folder (I am taking Day11) to put all those below mentioned files. Note : In this
Database is used to store information. In PHP we are using MySql as database server. Below are the steps to use MySql server with PHP: Step 1 : Start MySql from your xampp panel. Step 2 : Open “http://localhost/phpmyadmin/” in browser. Step 3 : Create new database in your localhost server (let’s take database name
There are many cases where we need AUTO_INCREMENT ID that generated from the previous INSERT operation, we can get that by using mysql_insert_id() function. Like:- $con = mysql_connect(“localhost”, “root”, “”); mysql_select_db(“my_database”,$con); $query = ”insert into emp (name,salary,phone) values (‘amit’,9000,’9847476744’)”; mysql_query($query); echo “Last inserted id is ”. mysql_insert_id(); Some time programmer use “select max(id) from tablename”
following is the query through which we can fetch duplicate records in our table, let’s take a example of emp table:- “SELECT name FROM emp GROUP BY name HAVING COUNT(name) > 1” we will get duplicate names from emp table.