In previous article we have discussed that MySQL is depreciated and their alternative options are MySQLi and PDO(PHP Data Object) . In that you have learned.......
It is all about programming. A blog about PHP, MYSQL, Javascript, Jquery,AJAX,HTML & CSS tutorial. Get short trick, knowledge based snippet for programming and technology related ideas.
Showing posts with label MySQL. Show all posts
Showing posts with label MySQL. Show all posts
Tuesday, 5 February 2019
How to Setup MySQL Connection Using PDO in PHP
Thursday, 31 January 2019
Live Search System Using Ajax in PHP with MySQL
In this Tutorial we are going to discuss about instant live search in PHP using AJAX and jQuery. Live search .......
Saturday, 21 January 2017
CREATE ALGORITHM=UNDEFINED DEFINER In MySQL
Error: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
When try to import SQL file with below query on server
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mobile_registered_view`.....;
Solution:
CREATE VIEW `mobile_registered_view`
OR
CREATE ALGORITHM=UNDEFINED DEFINER=`control_panel_username`@`localhost`
When try to import SQL file with below query on server
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mobile_registered_view`.....;
Solution:
CREATE VIEW `mobile_registered_view`
OR
CREATE ALGORITHM=UNDEFINED DEFINER=`control_panel_username`@`localhost`
Thursday, 7 January 2016
function for query the database in PHP
//function of query
function runqueries($query) {
$result = mysql_query($query);
while($rowss = mysql_fetch_array($result))
{
$listingdata[] = $rowss;
}
if(!empty($listingdata))
return $listingdata;
}
//Where need to display Data
$sqls= runqueries("SELECT * from Products");
foreach($sqls as $rows)
{
}
function runqueries($query) {
$result = mysql_query($query);
while($rowss = mysql_fetch_array($result))
{
$listingdata[] = $rowss;
}
if(!empty($listingdata))
return $listingdata;
}
//Where need to display Data
$sqls= runqueries("SELECT * from Products");
foreach($sqls as $rows)
{
}
Friday, 18 December 2015
how to match comma separated values in column
select * from table where FIND_IN_SET("value to match", `column-name`)
Friday, 12 December 2014
to drop primary key in mysql
to drop primary key in mysql
ALTER TABLE `mycheck` CHANGE COLUMN `id` `id` INT(23) NOT NULL, DROP PRIMARY KEY;
Saturday, 15 November 2014
sql query to find second largest value
1> SELECT MAX( col ) FROM table WHERE col < ( SELECT MAX( col ) FROM table );
or
2> SELECT MAX(col) FROM table WHERE col NOT IN (SELECT MAX(col) FROM table);
or
3> SELECT `column` FROM `table` GROUP BY `column` ORDER BY `column` DESC LIMIT 1,1;
or
4>SELECT * FROM Table ORDER BY NumericalColumn DESC LIMIT 1 OFFSET 1;
or
5> SELECT * FROM Table ORDER BY NumericalColumn DESC LIMIT (1, 1);
or
6> SELECT `Column` FROM `Table` ORDER BY `Column` DESC LIMIT 1,1;
or
2> SELECT MAX(col) FROM table WHERE col NOT IN (SELECT MAX(col) FROM table);
or
3> SELECT `column` FROM `table` GROUP BY `column` ORDER BY `column` DESC LIMIT 1,1;
or
4>SELECT * FROM Table ORDER BY NumericalColumn DESC LIMIT 1 OFFSET 1;
or
5> SELECT * FROM Table ORDER BY NumericalColumn DESC LIMIT (1, 1);
or
6> SELECT `Column` FROM `Table` ORDER BY `Column` DESC LIMIT 1,1;
Saturday, 11 October 2014
MySQL SUM function is used to find out the sum of a field in various records.
| id | name | class | mark |
|---|---|---|---|
| 1 | A | Four | 75 |
| 2 | B | Three | 85 |
| 3 | C | Three | 55 |
| 4 | D | Four | 60 |
| 5 | E | Four | 60 |
| 6 | F | Four | 55 |
query:-
SELECT sum( mark ) FROM `student`
Result:-
| sum(mark) |
|---|
| 390 |
Wednesday, 17 September 2014
SQL: DISTINCT CLAUSE
The SQL DISTINCT clause is used to remove duplicates from the result set of a SELECT statement.
SYNTAX:
SELECT DISTINCT column_name,column_name
FROM table_name;
Subscribe to:
Posts (Atom)