prosoxi.com | Archive | MySQL

Archive | MySQL

php mysql backup

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, PHP0 Comments

Mysql utf-8 characters

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, PHP0 Comments

Storing Hierarchical Data in a Database

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, PHP0 Comments

Mysql Concat + Join fields

SELECT CONCAT(last_name,', ',first_name) full_name
  FROM mytable ORDER BY full_name;

[ad code=1]

Posted in MySQL0 Comments

Dates in PHP and Mysql

$mysqldate = date( 'Y-m-d H:i:s', $phpdate );
$phpdate = strtotime( $mysqldate );

Posted in MySQL, PHP0 Comments

MySQL Tips and Functions

MySQL Tips and Functions

Comparison operators
= Equals
< Less than
<= Less than or equal to
> Greater than
>= Greater than or equal to
<> Not equal to
!= Not equal to
LIKE Compare strings
Continue Reading

Posted in MySQL0 Comments

MySQL errors into PHP?

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, PHP0 Comments

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 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 MySQL0 Comments

Mysql auto Datetime timestamp

On default valeu of timestamp add this  CURRENT_TIMESTAMP

Posted in MySQL0 Comments

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

Posted in MySQL, Programming0 Comments

PHP mysqli::set_charset

In connection file add the following lines

$mysqli = new mysqli($hostname_###,$username_###,$password_###,$database_###);
$mysqli->query(“SET NAMES ‘utf8′”);

Posted in MySQL, PHP0 Comments

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! Continue Reading

Posted in MySQL, PHP, Programming, Tutorials0 Comments

ORDER BY using specific order from IN

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, Programming0 Comments

Php, MySql, .htaccess: friendly urls

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, PHP0 Comments

mysql console backup restore

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 MySQL0 Comments

mysql: “not cleanly closed and upgrade needing tables” problem

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 MySQL1 Comment

Domain Name Finder, Lookup, Whois

Domain Finder Tool by Truste.gr

read more for domains

Advertise

Sponsors

Wedstar all about wedding - gamos - γαμος
Κατασκευή ιστοσελίδων
Domain Names | Hosting