Sanitize MySQL Inputs
November 13th, 2009
No comments
If the mysql log - /var/log/mysqld.log (fedora distro) - says:
090728 02:56:59 mysqld started
090728 2:56:59 [ERROR] /usr/libexec/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
090728 2:56:59 [ERROR] /usr/libexec/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
090728 2:56:59 [ERROR] Fatal error: Can't ...
Linux - for mysql tunning use MySQLTuner script. MySQLTuner is a script written in perl that will assist you with your MySQL configuration & make recommendations for increased performance and stability.
Download the latest MySQLTuner version in plain text to your ...
1'st Solution, use Mysql COUNT(*) :
$sql = "SELECT COUNT(*) FROM my_table";
$result = mysql_query($sql);
$num = mysql_result($result, 0);
echo $num;
2'nd solution: use TABLE_ROWS and TABLE_NAME from information_schema:
$query = "select TABLE_ROWS from information_schema.tables where table_schema = 'my_data_base' AND TABLE_NAME = 'my_table' ";
$result = mysql_query($query);
$count ...
Solution is simple, use mysql_insert_id() php function.
mysql_insert_id() returns the value generated for an AUTO_INCREMENT column by the previous INSERT or UPDATE statement. Use this function after you have performed an INSERT statement into a table that contains an AUTO_INCREMENT field, ...
Z O E Y - Z A N E , este cauza pentru care astazi mai tot timpul am fost OffLINE. Observati ca nici nu am mai scris impreunat ;) iar in titlu am inlocuit din caractere ... nu mai ...
use MySQL REPLACE function!
1. BACKUP YOUR DATABASE FIRST.
2. From within phpMyAdmin, open your database.
3. And here is the SQL query to replace string in database table:
UPDATE table_name SET column_name = REPLACE(column_name,"original_string","replace_string")