Tag Archives: SELECT

Select Records using PHP MySQL Select Statement

online tutorilas

You can use SELECT statement to select data from a database. Syntax SELECT column_name(s) FROM table_name To get PHP to execute the statement above we must use the mysql_query() function. This function is used to send a query or command to a MySQL connection. For Example: The following example selects all the data stored in the “student” table (The * character selects all the data in the table): <?php $con = mysql_connect(“localhost”,”username”,”password”); if (!$con) { die(‘Could not connect: ‘ . […]

Sorting using MySQL ORDER BY Statement

Sorting using PHP MySQL ORDER BY Statement

We use Sorting using MySQL  Order by statement in a recordset.The ORDER BY keyword sort the records in ascending order by default. If you want to sort the records in a descending order, you can use the DESC keyword. SELECT column_name(s) FROM table_name ORDER BY column_name(s) ASC|DESC You can sort on multiple columns, and you can sort different columns in different directions This query would return me the results ordered by the species in the order I need and then sort […]

Mysql Full Text Search – Mysql


In this post you’ll learn how to build a basic full-text search engine using PHP and MySQL. What is full text search? The full-text search in mysql allows you to quick and very accurate search for single or multiple keywords from multiple columns. It does this by using an index on the columns that you want to search. There are a few limitations that you should know. Indexed columns can only be TEXT, MySQL does not by default index words […]

Mysql interview questions


Q 1- How to setup admin user for MYSQL ? Ans: Login as super user ‘root’ in mysql and execute the following commands. mysql> use mysql; mysql> create user ‘test’@’%’ identified by ‘test’; mysql> grant all on *.* to ‘test’@’%’ with grant option; mysql> flush privileges; Q 2- What types of privileges are there in MySQL ? Ans: There are 4 types of privileges. i). Global privileges like *.* (all hosts connecting to Mysql db server) Example: GRANT SELECT, INSERT […]

Smarty PHP Template Engine


Introduction Smarty is a template engine that allows developers to easily separate their HTML and CSS from their PHP. It also provides added functionality such as date formatting and cycling through values. It’s caching capabilities are extremely flexible and useful in increasing performance and lowering bandwidth usage. From personal experience Smarty can decrease development time up to 40% by greatly reducing the amount of code you must write. It also makes it easier to organize your files and maintain a […]

Mysql Join Syntax


SQL joins are used to query data from two or more tables, based on a relationship between certain columns in these tables. This means everything you have learned so far can be applied after you’ve created this new, joined table. How Does a Join Work?  A join works through the use of keys. Continuing our example, our supplier table contains a column designated as the supplier_id. This column is configured as the primary key (for details on primary keys see Database […]