mysql

In symfony, how to set the value of a form field?

I'm overriding my doSave() method to basically do the following: I have a sfWidgetFormPropelChoice field that the user can either choose from, or type a new option. How can I change the widget's value? Or maybe I am approaching this the wrong way. So here is how I overrode the doSave() method: public function doSave($con = null) { // S...

Mysql Database design - Storing single and multi lat longs

I have a mysql database table that will store locations for buildings and events and a few other things. All locations are stored in one table, and linked to buildings, events etc through their own many to many table. That way I can just display dots on a map, and also allow filtering etc. However the problem comes with some things havi...

Advanced Web Development Tutorials

While I can find the answer to almost any specific question I have concerning PHP + MySQL development, one resource I haven't been able to find is good solutions to advanced problems. I want to implement a minor messageboard type system that can be queried by AJAX, but it I have too many specifications for it to be filled by a prebuilt ...

I have latin1 encoded data sitting in a UTF-8 mysql database, how do I fix this?

I have latin1 encoded data sitting in a UTF-8 mysql database, how do I fix this? There is no original data to go from unfortunately. I figured out this much as the only way I could display the data correctly was to set everything latin1 in PHP, HTML and MySQL. Once this is completed, I can change everything back to utf-8 in my html an...

Do I really need to switch from VARCHAR to VARBINARY for UTF-8 in Mysql & PHP?

Do I really need to switch from VARCHAR to VARBINARY and TEXT to BLOB for UTF-8 in Mysql & PHP? Or can I stick with CHAR/TEXT fields in MySQL? ...

PHP and MYSQL SHOW 5 Rows

How do you get php to show 5 rows from mysql Then create a new line and show another 5 ect.... Thank you ...

Problem in storing value in database.

Hi, I am using CakePHP framework with MySQL database and I have problem in saving one particular value to the database. I have a table called 'Attributes' with fields,id,form_id,label,type,size and instructions. When a link is clicked,default values are stored in the table for these fields. Now I added a new column called 'required' t...

Problem in storing value in database (cakePHP).

I have a checkbox named required,where if the checkbox is clicked its value is 1,otherwise its 0. The value is correctly passed form the view file to the controller. The model file gets the value from the controller, but the value is not being saved. I echoed the required value in the model,to check if the value is received. The value i...

JSF, Hibernate

Hi, I have a table called Items. When I tried to do 'Hibernate Reverse Enginering' in MyEclipse and run the program, I got this error: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?tems0_.ItemID...

MySQL WHERE timestamp >= SUBDATE(MAX(timestamp), INTERVAL 5 DAY)

What's the best way to express this in one SQL query? "Select a few random items that fall within x days of the newest item in the table." I tried the following: SELECT * FROM table HAVING `timestamp` >= SUBDATE(MAX(`timestamp`), INTERVAL 5 DAY) ORDER BY RAND() LIMIT 10 But this only gives me a single result, not 10. WHERE instead o...

In MySQL, what are the practices to backup databases?

I am using mysql How often do you back up your database? How do you normally backup your database? Export all data into sql or cvs format and keep it in a folder?? ...

How to speed up "select count(*)" with "group by" and "where"?

How to speed up select count(*) with group by? It's too slow and is used very frequently. I have a big trouble using select count(*) and group by with a table having more than 3,000,000 rows. select object_title,count(*) as hot_num from relations where relation_title='XXXX' group by object_title relation_title, object_title i...

How to make drupal 6 support Master-Slave MYSQL ?

Is there any solutions in Drupal 6 to split query READ to Slave and WRITE to Master ? ...

Ordering items inside a table based on user preferences, what is the correct way?

After seeing joomla's way of having arrows to order items (articles, menu entries and the likes), I was wondering what is considered best practice to shift elements inside a table. You obviously must have a field inside a table that hold numbers, letters, or anything you may want to use to define an order, then you have to change this o...

Why does SQLyog returns MySQL query results 10x faster than my Delphi program?

select rectype,jobid,jobrecid,template,assignedto,entereddt,enteredby,ref1,processed,processeddt, processbydt,title,description,connectlanhandle,finished,updateddt,ref2,cancelled, requireaccept,acceptrejectstate,acceptrejectbydt,alert1dt,alert2dt,alert3dt,despatchallowed, flag,ref3,projectid,duration,skillset,postcode,prefschedulefrom,pr...

MySQL: carriage-return in query

I have a query that exports data from two columns of each row into a file. In the file data from each column should be separated by carriage-return, something like this: row1column1 row1column2 row2column1 row2column2 row3column1 row3column2 I tried using char(13): SELECT CONCAT(column1, char(13), column2) FROM my_table INTO outfile '...

Mysql OPTIMIZE TABLE for all fragmented tables

Id like to run optimize on all currently framgmented tables. These tables should be those that have information_schema.DATA_FREE > 0. Is it possible to optimize all tables with this property in one command in sql or will I have to write external code to do this? ...

Should one steer clear of adding yet another field to a larger MySQL table?

I have a MySQL-InnoDB table with 350,000+ rows, containing a couple of things like id, otherId, shortTitle and so on. Now I'm in need of a Bool/ Bit field for perhaps a couple of hundreds or thousands of those rows. Should I just add that bool field into the table, or should I best create a new table referencing the IDs of the old table ...

What's the best solution for huge amount of data,fulltext search?

I'm currently using MYSQL, and it becomes the bottle neck of the whole system ...

Can I restore a backup if a table is corrupt?

I'm hoping this will be a simple answer for one of you. We've got PHP/MySQL running on a single board computer for a product that will be a web-based admin tool. This product will be a 'set it and forget it' application. One of our concerns (whether or not it's valid) is MySQL table/dbase corruption. We have processes running continu...