mysql

What does this MySQL statement do?

INSERT IGNORE INTO `PREFIX_tab_lang` (`id_tab`, `id_lang`, `name`) (SELECT `id_tab`, id_lang, (SELECT tl.`name` FROM `PREFIX_tab_lang` tl WHERE tl.`id_lang` = (SELECT c.`value` FROM `PREFIX_configuration` c WHERE c.`name` = 'PS_LANG_DEFAULT' LIMIT 1) AND tl.`id_tab`=`PREFIX_tab`.`id_tab`) F...

How to only select numeric data from mysql?

Does mysql have a funcion like is_num() which can allow me determine the data is numeric or not? Thanks. ...

Is this safe? Is this OK to do in MYSQL?

I have always done this: mysqldump -hlocalhost -uuser -ppass MYDATABASE > /home/f/db_backup/MYDATABASE.sql mysql -uuser -ppass MYDATABASE < MYDATABASE.sql But, if I do this instead...is this safe? Is this identical to the above??? mysqldump -hlocalhost -uuser -ppass MYDATABASE | gzip > /home/f/db_backup/MYDATABASE.sql.gz zcat MYDATAB...

What is the use of mysql_rollback() function in PHP?

What is the use of mysql_rollback() function in PHP? How is it used? please explain me with some example, PS: Please Do not give me link to the php.net or, mysql site, I dont need AUTHOR language to understand it, I need the Developer way to understand... I hope u understand... Thanks in advance. UPDATE if i have Updated someth...

Table Design in mysql

Hi everyone, I need to create one table, Description : i need to create table based on schedule like daily, weekly & monthly, columns are like : sno, startdate, enddate, day, scheduletype For example i ll take weekly data, for my point of view : From sunday to saturday (1 - 7 )Id i create.... So lots of posibilities are creates lik...

MySQLDump without locking the tables

It seems that if you have many tables, you can only perform a MySQLDump without locking them all, otherwise you can an error. What are the side effects of performing a MySQLDump without locking all the tables; Is the DB snapshot I get this way, consistent? Do I have any other alternative for getting a backup of a MySQL DB with many tabl...

What are the best practices for storing PHP session data in a database?

I have developed a web application that uses a web server and database hosted by a web host (on the ground) and a server running on Amazon Web Services EC2. Both servers may be used by a user during a session and both will need to know some session information about a user. I don't want to POST the information that is needed by both serv...

database design suggesion

Hi , am going to start new travel site, I want some advise from guru's regarding database design , Things coming to picture are, Book taxi online , This is the core idea, So i like to implement lot of jquery,ajax stuff in my site , Main thing site must run veryt fast,safe,security, In mysql , which typw shall i use, MYISAM OR INNODB ...

group by with 3 diffrent

I have 2 table and I wanna a query with 3 column result in on of them 2 column with view count and title name and in the other 1 column with type_ and i wanna to grouping type_ with max(view count) and show the them title but i didn't have any idea about grouping expression. i think we can solve in by using sub query but i don't kno...

MySQL configuration that allows for locking many tables?

I need to do a MySQLDump on a DB with ~700 tables and when I try with my current configuration, I get an error: mysqldump: Got error: 1016: Can't open file: './my_db/content_node_field_instance.frm' (errno: 24) when using LOCK TABLES Searching around I've found that this happens because it tries to lock all tables and fails because...

Help with MySQL Join Statement

Hi, I just built a website and have realised that I need to have a top 3 highest rated albums.. I haven't built in something that keeps track of the ratings. Ratings are stored separately. Can someone show me how to put these together please. SELECT id, name FROM albums LIMIT 3 SELECT rating FROM ratings WHERE url=CONCAT('albums/show/...

What could be done to get the old values back in the table after execution of any update query on it?

What could be done to get the old values back in the table after execution of any update query on it ? I am using PHP and Mysql DB ...

How to do a geometric search using latitude and longitude using php and mysql

Hi all, Did any know about how to search using latitude and longitude using latitude and longitude using php and mysql as back-end. I am having zip-code and latitude and longitude for the corresponding city. If i enter for a search with latitude i need to know the name of the city with that corresponding latitude and longitude. With ...

How to get data from database but from the exact row?

Hey Guys, I am using mysql. Now I want to write that query in which i will give mysql the row number then mysql will data from that column no only. means.. if i have twenty rows in database but i want to get only 10th no of rows data? so how to write that kind query? ...

If we export the table into another DB then does its all triggers also gets exported along with it?

If we export the table into another DB then does its all triggers also gets exported along with it? Update In context of Randy Minder's reply is it possible to transfer the schema table from one DB to another? UPDATE In context of MATT's Reply But What should I do If i have to script this export? as in this case I ha...

using joins or multiple queries in php/mysql

Here i need help with joins. I have two tables say articles and users. while displaying articles i need to display also the user info like username, etc. So will it be better if i just use joins to join the articles and user tables to fetch the user info while displaying articles like below. SELECT a.*,u.username,u.id FROM articles a JO...

Get column of a mysql entry

Is there a possibility to get the name of the column a database entry belongs to? Perhaps I have three columns with column names col1, col2 and col3. Now I want to select for every column the column with the maximum entry, something like this. Select name_of_column(max(col1,col2,col3)). I know that I can ask for the name of the colum...

How to load data on option box in php

I'm having trouble loading the mysql data to the option box using php. Here's my code: <?php $con = mysql_connect("localhost","myuname","mypassword"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("school", $con); $idnum= mysql_real_escape_string($_POST['idnum']); $result = mysql_query("SELEC...

mysql query for this problem

hi i have a table as follows id,school,address,city,state,phone,email,fax . There is almost 40 cities . I need to select 1 entry from each city. can any one guide me example city a1 30 entries a2 12 entries ...... a40 36 entries Pick 1 from each a1,a40 ...

Selecting two field in MySQL with PHP

Hi guys, i'm relatively new to php and mysql and would like to know how to select two value in mysql with php. What i have is $query = sprintf("SELECT COUNT(id) FROM table WHERE UPPER(username) = UPPER('%s') AND password='%s'"... in this case, i'm only selecting and count if the id exist and i use list($count) = mysql_fetch_row($res...