mysql

Mysql Order / Sort by before Group by

Every developer knows the horror of mysql sort/order by or select distinct using with group by. Mysql does group by before order by and you get mixed results not what you expected. This is a small solution with less performance problem:

SELECT * FROM 

(
select * from `my_table` order by timestamp desc
) as my_table_tmp

group by catid

order by nid desc

In this example we get latest news in each category. We create a temp table by sorting by timestamp and group by after it. It worked for me.

Tags:

Comparison of free Shopping Carts - 2009

This is a comparison of free -mostly open source- "shopping carts" / "e-commerce systems": Magento, osCommerce , Virtuemart (+ Joomla), Ubercart (+ Drupal), X-Cart , Zen Cart , ShopCMS , CS-Cart , Cube Cart , eCommerce Framework G5 (ECF), Ecommerce Templates , FlyingCart, Go Ecommerce EShop Builder , Interspire Shopping Cart , iScripts Multicart , JadaSite , JShop , LiteCommerce , PhPepperShop, PrestaShop, ProductCart , Ecommerce Shopping Cart Software , VP-ASP Shopping Cart , WebAsyst Shop-Script , Zeus Cart (AJ Shopping Cart).

Repair all mysql databases-tables with PHP

phpMyAdmin is a great tool but there is no option to repair all databases at once yet. Imagine you have no shell-access and need to repair all your 100 databases. It would take long time. This small PHP-Script lets you list, analyze and repair all your databases belong to same user at once.

If you already have shell access you can do it with mysqlcheck:

mysqlcheck -u root -p --auto-repair --check --optimize --all-databases


Repair with PHP:

  

How do I secure my web site?

  1. Brute force dedection should be enabled.
  2. Cache directories should be secured.
  3. Captcha's should be enabled and required for anonym users to avoid spam.
  4. Code Injection should be prevented.
  5. Cookies should NOT be used to store passwords and sensitive data.
  6. CSRF should be prevented.
  7. Directory listing should be disabled.

url encode decode directly with mysql

Are there core mysql functions like PHP's rawurlencode or decode ? I want to pull data (full url field) from mysql without using PHP.

Import big SQL Files under WAMP or LAMP ?

I want to import a sql file, which is larger than 100 MB. I cant upload it with Phpmyadmin, because PHP's upload limit is 8 MB. I tried with Mysql Console ie: "mydatabasename < c:\path\to\file.sql" but got en standart mysql query-error. How to do it easily?

Mysql Dump import export restore

Dont mix mysqldump and mysql commands when you try to import/restore. Following shell command gives no error but creates just an empty file.

mysqldump -u USERNAME -pPASSWORD YOUR_DATABASE_NAME < YOUR_DB.sql
Enter password:
-- MySQL dump 10.11
--
-- Host: localhost    Database: YOUR_DATABASE_NAME
-- ------------------------------------------------------
-- Server version       5.0.51a-3ubuntu5.4

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;

Mysql replace with regexp

Mysql uses regex and returns true/false, also just if matching but can not capture/catch. Is there a way to use mysql-regex to replace matching records without php?

Import Dmoz / ODP data to mysql

Dmoz export file is too big for PHP I think. It is over 4GB and my PHP cannot handle such big XML file. How can I import or convert it to mysql

What is the difference between Mysql inner and outer join?

What is the most important difference between inner, outer, left and right joins? Please explain easy. Thanks!

Syndicate content

CafeWebmaster.com(CW) is a free online community for webdevelopers and beginners. Anybody can share their code, articles, tips, tutorials, code-examples or other webdesign related material on the site. Newbies can submit their questions and reply to existing questions. CW does not guarantee or warrant reliability of code, data and information published on the site. Use the site on your own risk. The site takes no responsibility of direct or indirect loss or any kind of harm to its users. The site also doesn't take responsibility of infected files or source code with any kind of infection or viruses, worms, spywares, malwares, trojan horses. CW reserves the right to edit, move, or delete any of content for any reason.