Posted on 22 November 2010. Tags: backup, MySQL, PHP
Welcome to phpMyBackupPro
Here on the offcial homepage you will find all informations about phpMyBackupPro (pMBP).
phpMyBackup Pro is a very easy to use, free, web-based MySQL backup application, licensed under the GNU GPL.
You can create scheduled backups, manage and restore them, download or email them and a lot more! Continue Reading
Posted in MySQL, PHP
Posted on 12 November 2010. Tags: MySQL, PHP
mysql_query(“SET CHARACTER SET utf8″);
mysql_query(“SET NAMES ‘utf8′”);
mysql_query(“SET COLLATION_CONNECTION=utf8_general_ci”);
mysql_query(“SET CHARACTER_SET_CLIENT=utf8″);
mysql_query(“SET CHARACTER_SET_RESULTS=utf8″);
[ad code=1]
Posted in MySQL, PHP
Posted on 09 November 2010. Tags: catid, class, function, id, MySQL, parent, parent id, PHP, tree
Whether you want to build your own forum, publish the messages from a mailing list on your Website, or write your own cms: there will be a moment that you’ll want to store hierarchical data in a database. And, unless you’re using a XML-like database, tables aren’t hierarchical; they’re just a flat list. You’ll have to find a way to translate the hierarchy in a flat file.
Storing trees is a common problem, with multiple solutions. There are two major approaches: the adjacency list model, and the modified preorder tree traversal algorithm. Continue Reading
Posted in MySQL, PHP
Posted on 07 November 2010. Tags: concat, join fileds, MySQL
SELECT CONCAT(last_name,', ',first_name) full_name
FROM mytable ORDER BY full_name;
[ad code=1]
Posted in MySQL
Posted on 09 September 2010. Tags: development, PHP, scripting
$mysqldate = date( 'Y-m-d H:i:s', $phpdate );
$phpdate = strtotime( $mysqldate );
Posted in MySQL, PHP
Posted on 08 September 2010.
Posted in MySQL
Posted on 19 April 2010. Tags: development, PHP, scripting
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() . ") " . mysql_error())
When you encounter an error, this will return your custom message (A MySQL error has occurred.<br />) followed by a line number, and the actual
thanks http://php.about.com/od/phpwithmysql/f/mysql_error.htm
Posted in MySQL, PHP
Posted on 10 March 2010.
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 server retrieves every row in the table. This exposes every row and causes excessive server load. The simplest way to protect from this type of attack is to use single quotes around the numeric constants: SELECT * FROM table WHERE ID='234'. If the user enters extra information, it all becomes part of the string. In a numeric context, MySQL automatically converts this string to a number and strips any trailing nonnumeric characters from it. It means that if the user enters 234myname the value remains 234. Another option is to do a check before the mysql query if the value is numeric.
Source http://dev.mysql.com/doc/refman/5.0/en/security-guidelines.html
Posted in MySQL
Posted on 05 March 2010.
On default valeu of timestamp add this CURRENT_TIMESTAMP
Posted in MySQL
Posted on 14 January 2010.
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
Posted in MySQL, Programming
Posted on 12 January 2010. Tags: development, PHP, scripting
In connection file add the following lines
$mysqli = new mysqli($hostname_###,$username_###,$password_###,$database_###);
$mysqli->query(“SET NAMES ‘utf8′”);
Posted in MySQL, PHP
Posted on 08 January 2010. Tags: mysqli
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! Continue Reading
Posted in MySQL, PHP, Programming, Tutorials
Posted on 19 October 2009.
You can use FIND_IN_SET to do that:
SELECT * FROM tablename WHERE id IN (1,10,8,5) ORDER BY FIND_IN_SET(id, ’1,10,8,5′)
Posted in MySQL, PHP, Programming
Posted on 26 July 2009. Tags: .htaccess
Php, MySql, .htaccess: friendly urls
There are a lot of tutorials that show how to change an address like:
- www.mysite.com/products.php?product_id=1234
into others like:
- www.mysite.com/products/1234
- www.mysite.com/products/1234.html
In this article I’d like to go one step forward and to create something like:
- www.mysite.com/easy-to-remember-product-name
- www.mysite.com/easy-to-remember-product-name.html Continue Reading
Posted in .htaccess, MySQL, PHP
Posted on 21 July 2009.
Question: How to backup the whole database?
Answer: Just omit the “table_name” argument. For example, mysqldump -u root -pwordpress > D:\wordpress.sql
Question: How to backup all the databases in MySQL?
USE –force to continue on errors
Answer: Use “–all-databases”. For example, mysqldump -u root -p –all-databases > D:\db.sql
linux mysqldump -u admin -p –all-databases > db.sql
Restoring
Now let’s to restore it. Enter the following command in the command line window (or shell):
mysql -u root -p wordpress < D:\wordpress_posts.sql
This will restore the “wp_posts” table. You need to specify the database name. Here, it is “wordpress“. The following command restore the whole database:
mysql -u root -p wordpress < D:\wordpress.sql
If you want to restore all the databases (you used “–all-databases” argument to generate a backup file before), you don’t need to specify the database name.
mysql -u root -p < D:\db.sql
Posted in MySQL
Posted on 25 June 2009.
I have used mysql server on my laptop with gutsy on xfs file system. I have tested on hardy version and have same output as following
Quote:
sudo /etc/init.d/mysql start
* Starting MySQL database server mysqld [ OK ]
* Checking for corrupt, not cleanly closed and upgrade needing tables.
I google and couldn’t find a clean solution. I have already do
Quote:
myisamchk *.MYI
myisamchk –recover *.MYI
myisamchk –safe-recover *.MYI
But unfortunately problem still there. I need your help about why and how this can be solved. Thank a lot for your help.
Posted in MySQL