mysql

How to send text messages to site users

I have a site that I would like to send all of the users (20-100) text messages about 2 or 3 times a year. What are my options? and how do I implement this into a php/mysql based site? Any and all suggestions are welcome. Feel free to let me know if I need to provide more information for clarity. ...

how to add/edit/manage related data in multiple tables

I have several tables that i need to create an admin interface for Table 1 Table 2 Table 3 Table 4 Table 5 each table's contents are reflected of which parent it belongs to in a field...so table 2, has a field for which row in table 1 it relates to, table 3 has a field for relating to table 2 and so on. Whats the best way to present...

Database Design: Register and Verification

Is it a good choice to have unverified users into the users_table or should I make a temp_users_table to add the unverified users? The first option would be to create the row on the users_table with a column, for instance, account_activated to hold a integer that defines if the account is verified or not. The Second option would be to ...

Getting the last inserted record id of a database table in java?

I have a database table A which stores records, A has a primary key (recordid) with auto_increment, each time i insert a record in to A, i get the inserted recordid and store it in another masterTable. I am using a select statement as soon i do an insert into A to get the recordid like this: select recordid from A order by recordid ...

Schedule an event to execute SQL statements everytime the mysql server is started

Hi, I want a stored procedure to execute so that it updates a specific column in a table every time mysql server is started (to be precise when windows boots and mysql is started as a part of service automatically). Can somebody point out the syntax? Or the care to be taken to do something like this. I know the events were included as...

Remote MYSQL Database Access

Hello Techies, I have developed an application in java that access remote mysql database. While I am running it by netbeans IDE of system which have running that wamp server. But while i try I make connection in another system to remote system database by netbeans it shows following error. Unable to add connection, Cannot establish a c...

DateTime difference from two tables

Hi,I am having 2 table by the name mt_upload and down_time and field are DownTime and DownTime1... i need to caluculate the time difference between 2 field from 2 difference table.can anyone help me out ...

how to solve lock_wait_timeout, subsequent rollback and data disappeareance from mysql 5.1.38

i am using a toplink with struts 2 and toplink for a high usage app, the app always access a single table with multiple read and writes per second. This causes a lock_wait_timeout error and the transaction rolls back, causing the data just entered to disappear from the front end. (Mysql's autocommit has been set to one). The exception ha...

Grab only the last post from all topics in a category from phpbb

Hello, I want to only grab the last post of all topics in a category (Category->Forum->Topic->Post) from a phpbb database in a single query. Currently I have cooked up this, but it returns only the first post, not the last. SELECT *, MAX(p.post_id) FROM phpbb_forums f, phpbb_topics t, phpbb_posts p WHERE f.parent_id IN (<categories>) A...

Complicated SELECT query

I have a table which defines what things another table can have, for example: CREATE TABLE `objects` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, `name` VARCHAR(50) NOT NULL ); INSERT INTO `objects` (`name`) VALUES ('Test'); INSERT INTO `objects` (`name`) VALUES ('Test 2'); CREATE TABLE `properties` ( `id` INT UNSIGN...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to total the miles for each person and then average those totals. There are 2 people - person 1 drove 300 miles, person 2 drove 1500 miles. ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don't want to hit the DB for every page view. Currently there are ~45k rows returned by this query. Here are some of the approaches I've considered: Cache the row count and update it every X minutes Limi...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I have an issue when data has been entered into a CMS component that stores data in MySQL. The MySQL collation is set to UTF8_swedish_ci (I read t...

Mysql session variable in JDBC string

hi, am using this connection string to connect to mysql from java: jdbc:mysql://localhost:3306/db?noDatetimeStringSync=true&useUnicode=yes&characterEncoding=UTF-8 is it possible to set the session variable in the string so that SET UNIQUE_CHECKS=0; would be executed upon connecting to server? the obvious jdbc:mysql://localhost...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I've found return a 2 dimensional array to access specific rows. I want to be able to return only 1 specific row, kinda like mysql_result... except for entire row instead of 1 cell in a row. I don't want to loop through all the...

Mysql NOT IN operator performance problems for large result sets?

I have the following two queries: select count(*) from segmentation_cycle_recipients scr , segmentation_instance si where si.access_code=scr.access_code and si.segment_id is NOT NULL; Returns 13429 rows in 0.2 secs 2) select count(*) from segmentation_cycle_recipients scr , segmentation...

MySQL: Sorting a Row, Then Sorting the Columns?

If I have 3 columns, X, Y, Z, that are each a number, how can I get each row returned greatest to least, and then the rows return greatest to least? So if I had: X Y Z 8 7 9 1 2 3 4 6 5 how could I get: 9 8 7 6 5 4 3 2 1 ...

What does a "set+0" in an SQL statement do?

Hi, I'm baffled as to what this SQL statement means: SELECT exhibitor_categories+0 from exhibitor_registry What is exhibitor_categories+0 ? It returns a number for each row returned. exhibitor_categories is defined as: set('contemporary', 'classical impression / transitional', 'outdoor', 'home accessories') Thanks for your time :...

Ajax problem not displaying data using multiple javascript calls...

I'm writing an app that uses ajax to retrieve data from a mysql db using php. Because of the nature of the app, the user clicks an href link that has an "onclick" event used to call the javascript/ajax. I'm retrieving the data from mysql, then calling a separate php function which creates a small html table with the necessary data in i...

How to get a records based on two conditions and second condition must be checked only if first one failed?

Hello! Is there a way to get a records in single query based on two conditions and second condition must be cheked only if first one failed. For example how can I get all records where time > NOW() and if there are no such records to get a record with max(id). ...