mysql

IVRS response recorder...

Hi, I have a web based system built on php & mysql where the we have a complaint box with 5 different types of complain which are logged over phone by an operator. i want to build a system where the caller will press buttons on the phone like an IVRS system to book the complaint and a unique complaint number is sent to the caller. like...

Convert date format from mysql TIMESTAMP help

Hi. have one problem, I need the dates in Swedish format, for instance, october is in swedish oktober... How can I do this? This works so far for english dates: $date = date( "j F", strtotime( $row[insert_date] ) ); $display_table .= "$date"; ...

XML/MySQL: Storing complete XML in MySQL and performing CRUD operations.

Is is possible to store directly complete XML file into MySQL db and perform CRUD operations on XML data present in MySQL ? Scenario: I am getting XML file which has product related details like product_id, product_spec, product_price and many more and I have to store all this details into MySQL database and whenever user enter portal ...

Monitoring user tracking, statistics, and auditing for app

I'm trying to incorporate user statistics into a site and decided to go for this in my users table: time when the user registers time when the user verifies visit count time of last visit What other statistics am I missing? Should I track each login time in a separate table too? Is that considered good auditing or too much? There ar...

Storing 'debits' and 'credits' to maintain a 'transactions' table

Which is the better schema for a transactions table: customer_id type (enum, 'Debit' or 'Credit') amount (decimal, unsigned) or customer_id amount (decimal, signed... negative numbers are debits, positive numbers are credits) The second solution seems simpler, but I'm worried I'm missing some potential pitfalls. ...

MySQL query that computes partial sums

What query should I execute in MySQL database to get a result containing partial sums of source table? For example when I have table: Id|Val 1 | 1 2 | 2 3 | 3 4 | 4 I'd like to get result like this: Id|Val 1 | 1 2 | 3 # 1+2 3 | 6 # 1+2+3 4 | 10 # 1+2+3+4 Right now I get this result with a stored procedure containing a cursor and ...

Filter out rows by hardcoded list in MySQL performance

Hello, I have a hardcoded list of values like: 1,5,7,8 and so on. And I must filter out rows from table that have ID in list above, so I do something like this: Select * from myTable m left join othertable t on t.REF_ID = m.ID where m.ID not in (1,5,7,8...) But when I have more values (like 1000) and more rows (100) in other...

How to create Cron job to backup MySQL and FTP backup to my backup server?

I want to setup a cron job to run so that it will automatically backup my MySQL database, while the database is running, and then FTP that backup to my backup server. I assume I can do this using a bash script. Anyone know of a good way to accomplish this? Thanks in advance. ...

Problems using GROUP BY in MySQL in a query that does a JOIN on two tables

I have two MySQL tables, $database1 and $database2. Both have a field in them called ID. I am passing the name of a town to the file using GET (i.e. it's in the URL of the PHP file that holds this code). I can run this query... $PlaceName = $_GET['townName']; $PlaceName = mysql_real_escape_string($PlaceName); $sql="SELECT * from $da...

Downloading SQL schema for SVN in Eclipse

I develop PHP apps in Eclipse and I'm wondering, is there an easy way of downloading my MySQL schema to a specific folder so that when I commit to SVN it's included? EDIT: I'm using phpMyAdmin to export my schema. I'm just wondering if I can automate this step in Eclipse. ...

PHP warning problem?

I'm new to php and mysql I think I misplaced the mysqli_real_escape_string() I keep getting the following warning on line 3. Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given in Here is the php code. <?php $page = mysqli_real_escape_string($_SERVER['SCRIPT_FILENAME']); // Query member data from the database...

Help mysql grouping

Please help me figure a single query that will transform the data below... |id |status_a |status_b | |+++++++++++++++++++++++| | 1|active |inactive | ...into this one. |status_group |count| |++++++++++++++++++++++++| |status_a.active | 1| |status_b.inactive | 1| edit: If a single pass query is possible then that wil...

PHP and MySQL hit counter multiple pages count problem?

The following script will update the database, but it won't display the correct page count on each different page. It will freeze the page count on the page most of the time for some reason. Here is the PHP code: <?php $page = $_SERVER['SCRIPT_FILENAME']; // Query member data from the database and ready it for display $mysqli = new...

Incorporating Open ID with my current login System?

I am currently setting up Open ID authentication in my website and I am having troubles incorporating it with my current Login System and database... I've read the article at Plaxo & it recommends this type of table to store the openid info... create table user_openids ( openid_url varchar(255) not null, primary key (openid_url), ...

Diacritic insensitive mysql search?

Hello, How do I make a diacritic insensitive, ex this persian string with diacritics هواى بَر آفتابِ بارِز is not the same as with removed diacritics in mySql هواى بر آفتاب بارز Is there a way of telling mysql to ignore the diacritics or do I have to remove all the diacritics in my fields manually? ...

Debug irrelevant Wordpress search results

On Wordpress, I keep getting irrelevant search results. Some search strings that do not exist on the DB yield All Posts as results. Some search strings that DO exist, works great. What could be the cause of that behavior? I've uninstalled all related plugins. Is there a way to debug the search? Thanks! ...

Importing content from one/two Drupal installs into a fresh Drupal install

We're upgrading a large site, opendemocracy.net, from Drupal 4.7 to Drupal 6. Our existing install has a lot of superfluous tables in the database from once-used modules we won't be using: ideally, we wouldn't keep these, or our old blocks, etc. This is because: (a) it'd be nice to keep the database as small as possible, (b) it'd be nice...

PHP MySQL Transactions

Hi, Is there anyway to carry out an SQL transaction in one command? eg mysql_query(" START TRANSACTION; INSERT INTO table1 ....etc; INSERT INTO table 2.....; COMMIT;"); Or do you always have to use separate commands? eg mysql_query("START TRANSACTION;"); mysql_query("INSERT INTO etc etc Thanks ...

Select different field in mysql if a field is set to null?

I want to select displayname as username if username =null and if username is NOT NULL then select username as username eg. id username displayname 1 xyz NULL 2 NULL abc How can I do that in one single select statement...Thanks ...

MySql random category limited select

I'm trying to create a query that will select one item for first category, two items for second and 2 items for third category, for others just one item. The problem is it has to be one query. I think this is possible but I just can't figure it out. ...