mysql

php code to mysql database export

i want php code to import *.sql file to database and export db to *.sql file without going to phpmyadmin ...

MYSQL - Help with a more complicated Query

I have two tables: tbl_lists and tbl_houses Inside tbl_lists I have a field called HousesList - it contains the ID's for several houses in the following format: 1# 2# 4# 51# 3# I need to be able to select the mysql fields from tbl_houses WHERE ID = any of those ID's in the list. More specifically, I need to SELECT SUM(tbl_houses.Hous...

MySQL: Get only count of result set.

I am using MVC with PHP/MySQL. Suppose I am using 10 functions with different queries for fetching details from the database. But at other times I may want to get only the count of the result that will be returned by the query. What is the standard way to handle such situation. Should I write 10 more functions which duplicate almost w...

Ways to update a dependent table in the same MySQL transaction?

I need to update two tables inside a single transaction. The individual queries look something like this: 1. INSERT INTO t1 (col1, col2) VALUES (val1, val2) ON DUPLICATE KEY UPDATE col2 = val2; If the above query causes an insert then I need to run the following statement on the second table: 2. INSERT INTO t2 (col1, c...

libmysqlclient hangs on vmsplice()

Hi I am running an executable that uses libmysqlclient.so.15 on a 64bit kernel & 32bit user space compatibility mode. Once in a while, my program hangs on something from libmysql: #0 0xf7f01430 in __kernel_vsyscall () #1 0xf7b451e3 in vmsplice () from /lib/i686/cmov/libc.so.6 #2 0xf7e72c10 in ?? () from /usr/lib/libmysqlclient.so.1...

Why does this query only select a single row?

SELECT * FROM tbl_houses WHERE (SELECT HousesList FROM tbl_lists WHERE tbl_lists.ID = '123') LIKE CONCAT('% ', tbl_houses.ID, '#') It only selects the row from tbl_houses of the last occuring tbl_houses.ID inside tbl_lists.HousesList I need it to select all the rows where any ID from tbl_houses exists within tbl_lists.HousesL...

Query to find tables modified in the last hour

I want to find out which tables have been modified in the last hour in a MySQL database. How can I do this? I am new to MySQL so please try to explain it as simply as you can. thank you! ...

Many-to-many relations in RDBMS databases

What is the best way of handling many-to-many relations in a RDBMS database like mySQL? Have tried using a pivot table to keep track of the relationships, but it leads to either one of the following: Normalization gets left behind Columns that is empty or null What approach have you taken in order to support many-to-many relationsh...

Filtering A MySQL Result Set Based On The Return Value Of A Function

I'm a SQL noob, and I need a little bit of help understanding the big picture of if it is possible, and if so how to go about filtering a result set based on the return value of a function which is passed one of the fields of the record. Let's say I have a table called "Numbers" with just one field: "Value". How could I correctly speci...

Few question about client application to be networked

I have made a registration program. Making use of mysql database. Can I still use the traditional programming for client applications. If I want to network it. Do I have to modify the codes a little in order to make it work? -Please enlighten me, I'm just a beginner. I don't have any idea on how this works. Do I have to install wampse...

User registration for postfix w/ mysql

I would like to create a user registrations(using PHP) page for my postfix (w/ mysql), any one could lead me, how this can be done? ...

mysql query to get unique value from one column

i have a table named locations of which i want to select and get values in such a way that it should select only distinct values from a column but select all other values . table name: locations column names 1: country values : America, India, India, India column names 2: state/Province : Newyork, Punjab, Karnataka, kerala when i selec...

mySQL - How to select a date interval

Hello, this is my table : ------------------------------------- | user | item | date_time | | 10 | 01 | 10-10-10 20:10:05 | | 10 | 02 | 10-10-10 20:10:10 | | 10 | 03 | 10-10-10 20:10:10 | | 20 | 02 | 10-10-10 20:15:10 | | 20 | 02 | 10-10-10 20:20:10 | | 30 | 10 | 10-10-10 20:01:10 | | 30...

XML creation using DOM and MYSQL

I am trying to create a XML document from information extracted from a mysql table. I am using a tutorial to accomplish this http://www.tonymarston.net/php-mysql/dom.html#a5 what I want to do is to create each element separately, instead of creating them all at once as shown in the tutorial. In order to do that I am trying to place th...

get list of ODBC data source in local pc using PHP

I'm looking for a way to get a list of ODBC data sources in local PC using PHP is there any body can help me ...

Transfer records from one MySQL DB to another.

How can I transfer specific rows from one MySQL DB on one server to another in a completely different server. Also the schemas don't necessarily have to be the same. For example on server "A" I could have a Users table with 2 columns and on Server "B" have a Users table with 4 columns. Thanks. ...

SQL simple query

I have the following table, Persons_Companies, that shows a relation between persons and companies knowns by these persons: PersonID | CompanyID 1 1 2 1 2 2 3 2 4 2 Imagining that company 1 = "Google" and company 2 is = "Microsoft", I would like to know the ...

Caching Mysql database for better performance

Hi, I'm using Amazon cloud and I've performance issue since the HDD is not located on my machine. My database is small (~500MB) and I can afford to keep it all in my RAM. I do not want to keep queries in my RAM, i need all the tables there. How can i do it? Thanks, Koby P.S. I'm using ubuntu server... ...

When does a MySQL Query actually execute in PHP?

This sounds like a really simple question, but I am new to PHP. If I have a statement like this: $r =& $db->query("insert into table (col1, col2) values (10, 20)"); Do I have to still execute it, or does it get executed when I reference it? I have another case where I have a select query, which seems logically to run only when I cal...

Can we control LINQ expression order with Skip(), Take() and OrderBy()

I'm using LINQ to Entities to display paged results. But I'm having issues with the combination of Skip(), Take() and OrderBy() calls. Everything works fine, except that OrderBy() is assigned too late. It's executed after result set has been cut down by Skip() and Take(). So each page of results has items in order. But ordering is done...