Here are some examples of how to utilize mysql_error () mysql_connect(“your.hostaddress.com”, “username”, “password”) or die(mysql_error()) This will return an error if there is a problem connecting to your MySQL database $value = mysql_query($your_query) or die(“A MySQL error has occurred.<br />Your Query: ” . $your_query . “<br /> Error: (” . mysql_errno() . “) ” . …
Category Archives: MySQL
Quotes in mysql queries – security issue
Remember to check numeric data as well. If an application generates a query such as SELECT * FROM table WHERE ID=234 when a user enters the value 234,the user can enter the value 234 OR 1=1 to cause the application to generate the query SELECT * FROM table WHERE ID=234 OR 1=1.As a result, the …
Mysql auto Datetime timestamp
On default valeu of timestamp add this CURRENT_TIMESTAMP
Mysql Select within Select (sel into sel)
SELECT clients.id, (SELECT Count(clients_job.id) FROM clients_job WHERE clients_job.client_id = clients.id ) AS JobCounter FROM clients ORDER BY EPONIMIA ASC
PHP mysqli::set_charset
In connection file add the following lines $mysqli = new mysqli($hostname_###,$username_###,$password_###,$database_###); $mysqli->query(“SET NAMES ‘utf8′”);
Mysqli Tutorial
Moving from a procedural system to object-oriented can be a daunting task. One feature to assist you is the MySQLi class, which allows for an object-oriented approach to database manipulation. This tutorial gives insight into the structure and basic usage of the MySQLi class. If PDO isn’t an option for you, then try MySQLi!