mysql

MySQL/PHP update query error

I'm running a query to update a small group of 'items' in a table, from PHP. Running the code with "Sequel Pro" executes it perfectly, while running it on PHP using mysql("query here"); fails miserably. Is there anything wrong with my query? UPDATE `service_joblocation` SET `in_use` = '1', `in_use_since` = '1283488686',...

How to set our custom font and font size as default in TinyMCE?

How to set our custom font and font size as default in TinyMCE. Any body knows the solution please help me :( ...

Convert DateTime for MySQL using C#

i want to change the DateTime for MySQL in C# my MySQL database only accept this format 1976-04-09 22:10:00. in C# i have a string who have a date value string str = "12-Apr-1976 22:10"; i want to convert for MySQL then it look like 1976-04-12 22:10 How i can change them or how other programmer do this by using dd mm hh yy metho...

Alternative to ORDER BY RAND() on joined tables?

I have a table of approx 3500 Items. In another table I'm storing user votes - the Item id, the user id and the score. When a user hits this script, it must randomly select an Item they haven't already voted on. At the moment I'm using LEFT JOIN then testing for null to find the set of Items they haven't voted on. Trouble is, using ORDE...

how to using MySQLdb SELECT with for or while loop

import _mysql as mysql db=mysql.connect('localhost','username','password','database') db.query("""select * from news""") result = db.store_result() print result.num_rows()#two records #how to loop? without cursor print result.fetch_row() ...

MySql - Manage a display order of data

OK, a database of information. A column dedicated to a display order. If I make changes, like move rows or if I delete rows or add rows to the end of the database then move them up or down. I would prefer to keep the display order in sequential order with no gaps. like 1-2-3-4-5-6-7-8-9 if I delete a row 1-2-3-4-5-7-8-9 I may have probl...

View Database (MY SQL)

Hey All, I have SQLDBX, And it works perfectly for MSSQL, but it doesn't work for MySQL. And I would like to know if any of you know of any database viewers that can connect to MySQL database on a server? Just something simple I guess, doesn't have to be brilliant, just has to work Thank you :) ...

CodeIgniter configure different IP for READ and WRITE MySQL data

My company has been setting up a different server for read and write access of mysql DB. Previously, we use custom php script. However, I was recently given task to create tools by leveraging CI. I've done it on test server. Now, I'm confused, how to implement it on live server. ...

Can you make this query faster?

Hello! I'm currently doing a summer job and I have to extend an existing program. My boss asked me to make a tool for our clients so they can see how much their employees cost, per month. But that's not all. The thing is that a company can have one or more 'societies', or subcompanies. We want know how much an employee costs per society...

mysql join two tables

Hi I have a problem joining two tables: table1 id name 1 aaa 2 bbb 3 ccc table2 id table1_id name 1 1 x1 2 1 x2 3 2 s1 table1 is the main table, table2 contains attributes. I need to join and search both tables, but display distinct results from first table. When using JOIN I...

Changing language/culture in a MySQL/Dblinq project

Hi everybody, I'm not very familiar in programming databases, but I have a Mysql-Database which I access with Dblinq under C#. Now when I enter dates, numbers etc, the english notation is used, but my customer needs german. How can I switch my database from english to german? (The Database is still empty, I can easily re-create it, if ...

Large MySQL Table Update Slow

Hi this is my table structure CREATE TABLE IF NOT EXISTS `sms_report` ( `R_id` int(11) NOT NULL auto_increment, `R_uid` int(11) NOT NULL, `R_smppid` varchar(100) collate utf8_unicode_ci NOT NULL, `R_from` varchar(10) collate utf8_unicode_ci NOT NULL, `R_status` longtext collate utf8_unicode_ci NOT NULL, `R_message` text collate ut...

Is writing a PHP page for each query a good programming skill?

Actually I got selected in one of the company. They were working in PHP from quite a long time. I worked for just 1 week over there, but the thing which I saw over there is that they used to write one PHP page for each table and they used to include those file and pass some variables to it and getting the array of variables in return fr...

MySQL: Optimizing SELECT from 6 huge identical tables with different data split up by timestamp

Hello, please I have the same problem as I found here http://stackoverflow.com/questions/409705/mysql-selecting-data-from-multiple-tables-all-with-same-structure-but-different , I have to select data from many MySQL tables with identical structure, but different data (split up into table_0, table_1, table_2 etc to table_5 to distribute...

Zend multiple where

I have thi next code, but he doesn't work: $select_sell = $this->select(); $select_sell->from($this->_name, array('rank_id')) ->where('rank_id = ?', $id) ->where('type = ?', 'must_sell'); $result = $this->fetchAll($select_sell)->count(); I need to make this query ... WHERErank_id= $id ANDtype= 'must_sell'.. Th...

Create MySQL query to create a table from an existing table

I have quite a large and complex table in a MySQL database that would be a pain to have to build a query for manually to recreate if anything went wrong. Is there someway I can get MySQL or some other tool/script I can use to get a Query made automatically that would recreate the structure of the table? Ideally if you suggested a tool/...

How to select the name of the table in an SQL query?

I'm using a UNION and a LIMIT to select the earliest occurence of a type of table row from multiple tables. I need a record of which table satisfied the query in the result set. Is there a way of doing something like: SELECT id, someField, tableName FROM someUnknownTable WHERE someConditions = true ...

How to retrieve distinct values from more than one column?

I have two columns of data. I'd like to run select statement on them that grabs all the distinct pieces of data in these columns 1 time. For instance. *column 1* *column 2* dog monkey monkey elephant dog monkey I wanna be able to returna result set that has dog, monkey and elephant in it and that's all. ...

How to import CSV file to MySQL table

I have an unnormalized events-diary CSV from a client that I'm trying to load into a MySQL table so that I can refactor into a sane format. I created a table called 'CSVImport' that has one field for every column of the CSV file. The CSV contains 99 columns , so this was a hard enough task in itself: CREATE TABLE 'CSVImport' (id INT); A...

How does MySQL handle WHERE tests?

Hi, As I was coding a php page building a MySQL request according to GET parameters, I was wondering if MySQL does any kind of reorganization of WHERE tests in a request, or if it just takes them as they come. For example, if I execute this request: SELECT * FROM `table` t WHERE (SELECT `some_value` FROM `another_table` u WHERE `t.id`...