mysql

Optimum settings for apache/php webserver with separate mysql database server...

I'm having a mysql connection speed issue with my home development setup. I have two VM's (VirtualBox running on a Ubuntu host). One is my WEBSERV with apache2/php and one is by DBSERV with mysql and postgres (both are ubuntu server 10.4 LTS). Also, i have mysql installed on the WEBSERV as well and this was only done before i decided ...

How to combine results from multiple tables with different columns?

I have several tables with different numbers and types of columns, and a single column in common. +--------+---------+------------+-------------+ | person | beardID | beardStyle | beardLength | +--------+---------+------------+-------------+ +--------+-------------+----------------+ | person | moustacheID | moustacheStyle | +--------+-...

Help with writing MySQL query or queries

I'm trying to write a function in PHP who's job it is to check a date and time against these tables and determine if it's possible to schedule an appointment. Tables: locations --- id appointment_types --- id length_of_time (not sure what to store this as, but at the moment I would like it to be precise to the quarter hour) partners ...

Can anybody tell my what this error means

Can anybody tell my what this error means: java.sql.SQLException: Cannot absolute position to row 0 ...

PDO Uncaught Exception

This error appears when executing the code below: Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1065 Query was empty' in /home/content/63/6563663/html/inventory/pg.php:20 Stack trace: #0 /home/content/63/6563663/html/inventory/pg.php(20): PDOStatement->execute() ...

doubt regarding storing values in mysql databse

Hi, is it better to save the exact user input in the database or clean it for xss and store .. or is it good to store the direct user input , clean it and display it ?? please guide me . Thanks ...

php / mysql search query string

i'm trying to search terms that may or may not have a space... ex term: iPod Black 30. the results would be everything except, "ipod black used 30" and "used". so basically its finding all complete matching terms individual matching terms and skipping over any entry that may match but has a non-match word in it and of course the entry w...

ActiveRecord3 deadlock retry

Are there any plugins for Rails 3 (or ActiveRecord 3) that replicate the old deadlock_retry plugin? Or, does that plugin still work with Rails 3? ...

Running MySQL *.sql files in PHP

I have two *.sql files that I use when creating a new web site database. The first file creates all the tables. The second file populates some default records. I would like to execute these files from PHP. I also use the Zend_Framework, if that will help accomplish this. Additional Info I don't have console access I'm trying to au...

I need to restore a database (mysql) every 30 minutes using a cron job.

I'm new to cron jobs and I need to restore a database (mysql) every 30 minutes. Is there a cron job command that can restore a database from a .sql file that's been gzipped? Or do I need to create a php script to do this and create a cron job to call this script every thirty minutes? Also, and this is a separate question but still rela...

How to change id in existing MySQL tables with data to autoincrement from last highest id?

I have just managed to migrate a pretty big database from SQL Server to MySQL. I didn't set the primary keys to auto increment during the migration because the tables have relationships based on ids as primary keys which are foreign keys in another table. Now for adding new records I want to alter the primary key 'id' columns in all tab...

MySQL Match...Against vs. nulls?

I have a query that uses left joins like so: SELECT a.id, a.username, a.date_created, a.contact_id, a.role_id, c.first_name, c.middle_initial, c.last_name, c.email, r.role FROM accounts AS a LEFT JOIN contacts AS c ON a.contact_id = c.id LEFT JOIN roles AS r ON a.role_id = r.id WHERE ( MATCH (a.username, c.first_name, c.middle_initial...

php+mysql: insert a php array into mysql

Hi I have an array with 30000 plus entries that need to go into a MySQL table. What is the best practice? From here? Lets say [0], [1] and [2] in the database would be 'title', 'type' and 'customer' Is it add key names matching the column names in the table and call som "magic" function? Or build the query manually... Array ( [0]...

Slow select query with left join is null and limit results

I have the following query that is being logged as a slow query: EXPLAIN EXTENDED SELECT * FROM ( `photo_data` ) LEFT JOIN `deleted_photos` ON `deleted_photos`.`photo_id` = `photo_data`.`photo_id` WHERE `deleted_photos`.`photo_id` IS NULL ORDER BY `upload_date` DESC LIMIT 50 Here's the output of explain: id select_type table type...

How to figure out the Foreign Key Constraints of a MySQL table using Doctrine 1.1?

When two models are related to each other, Doctrine automatically generates foreign key constraints in the MySQL database beautifully. The default behaviour for onDelete and onUpdate RESTRICT, but can also be set to SET NULL or CASCADE. Now, I want to create a migration diff from an existing database compared to a YAML file. To do this,...

Html in my database!

Hello, I am faced with something I dont know where to start with. I currently have a news section on my website, the news is added into the database. However, it's very dull and has no formatting! How can I allow the admin thats adding news to make things bold or underlined and have colour etc. Will it be possible to save this in the d...

mysql and php - export specific row

Hello I have a test table with name mytable and with following data id name surname ================== 1 sotos val 2 john rik 3 peter ask How can id export for example the second row in mysql using php knowing the id? ...

Mysql cross table update permission problem

I'm doing a MySQL query similar to following: UPDATE my_articles a LEFT JOIN categorylinks cl ON a.pageid = cl.cl_from SET a.importance = 'High' WHERE cl.cl_to = 'High' The problem is, I don't have a UPDATE right for the categorylinks table (I do have that right for my_articles), so the query fails with the message UPD...

jdbc rollback not working

Hi, I'm testing rollback in java using JDBC (with mysql), but the code below is not working. The code is behaving as if I called commit() instead of rollback(). Can somebody tell me where I'm going wrong? Connection conn=null; try { conn = SqlConnectionHandler.getSqlConnection(); conn.setAutoCommit(false); } ...

How to avoid looping sql query in php?

What's the best way to make a select in this case, and output it without using nested queries in php? I would prefer to make it with a single query. My tables look like this: table1 id | items | ---|-------| 1 | item1 | 2 | item2 | 3 | item3 | .. | .. | table2 id | itemid | comment | ---|--------|----------| 1 | 1 | co...