mysql

How to dynamically add an option to a select list that is build using json data retrieved from a php script?

I have an HTML form that builds a drop-down from json data that is retrieved dynamically on page load from a php script. <html> <head> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"&gt;&lt;/script&gt; <script type="text/javascript" language="javascript"> $(document).ready(function() { jQuery ....

Can a stored procedure work with two different databases? How about two servers?

I am wondering if MySQL's stored procedures can work with two different databases on the same machine? How about if they are on different servers? ...

.NET and MySQL working together and is it scalable

Hi All. I'm working on an application that will use .NET as the application platform. Originally, we were going to use SQL Server as the database, but after some research, MySQL came up as a popular database that is used by some high transaction based applications(i.e. Facebook, Craigslist, etc...). The app we're working on will involve ...

MySQL find unused tables

Hi, I am working with a database which unfortunately has a lot of unused tables and I am trying to clean it up. I'm trying to find a way where I can be 100% confident that a particular table is no longer being used. After some googling, I still cannot find a good way to do so. I am only able to tell the last writes to a table (INSERT, ...

result of ifnull() in mysql

Hello freinds, i want to use the result of ifnull as a third parameter for concate(). my query is like select x.a, x.aa, x,bb, y.b, z.c concate(a,aa) ifnull((select P.name from p where p.id=x.name ), N.A.) as state concate(a,aa,state) // here it says state is ambiguous tha...

mysql schema changes with master & slave

If I have a MySQL master-slave set-up and I change the schema on the master (e.g. ALTER TABLE/CREATE TABLE, etc), will those changes get replicated over to the slave? ...

PHP 5.3.3 mysql_connect doesn't work with localhost

Hi! This does not work with my PHP 5.3.3 installation on WAMP / Windows 7: mysql_connect('localhost', 'root', ''); After Maximum execution time, this error is presented: Warning: mysql_connect() [function.mysql-connect]: [2002] A connection attempt failed because the connected party did not (trying to connect via tcp://localhost:...

Query between federated tables and local tables

Hy, I have problems with Mysql query's made between few federated tables and local tables. With multiple joins in querys and inserts that are using one or two federated tables with two or three local tables results in time-out .... How can this problem be resolved?Where is the problem? Is not recomended? If not what is the best way to...

Setting col widths of a mysql resultset in Php

Hi guys, I'm querying a MySQL table to get some data that I display on a php page. The problem is that the col widths are small for a few columns. Is there any-way I can specifically change those (not the rest)? Currently, I'm doing my printing via a loop, so it seems strange to me as to how to pin-point which corresponds to the col...

Need help with a complex SQL query - I think I need a two-stage inner join or something like that?

Okay, here's what I'm trying to do. I have a drupal table (term_data) in mysql that lists tags and their ID numbers and a second table, (term_node) that shows the relationship between tags and the data the tags refer to. For example, if node 1 had 3 tags, "A", "B" and "C". term_data might look like this: name tid A 1 B 2 C 3 ...

How to make a MySQL trigger run only when at least one OLD field is different from NEW fields ?

Hi, I am trying to audit table changes on MySQL but i want the "before update" trigger to run (add a line into an audit table) only when there is at least one changed field. Is there a way to easily check all fields for changes between OLD and NEW ? Thank you ! ...

How can I create a table with a column with 3 only possible given values?

I'm making a SQL database with MySQL. I need a column that has only 3 possible values: "Total" "Hours" "OnDemmand". I mean that user has to select one of these three values, he will can't select another value. How can I do it? ...

In PHP, can I get MySQL to rollback a transaction if I disconnect without committing, rather than commit it?

If I run the following PHP, I would expect no value to be inserted into the test table, because I have a transaction that I haven't committed: $db = mysql_connect("localhost","test","test"); mysql_select_db("test"); mysql_query("begin transaction;"); mysql_query("insert into Test values (1);") or die("insert error: ". mysql_errror()); d...

Help getting, or displaying, random records in ColdFusion from a MySQL query?

I've got a jquery roller/scroller that displays snippets of records returned from my 'Helpful Hints' database table query. I want to keep the scroller to about 15 records but not always the first 15 records. Is it more efficient to write a query like: SELECT * FROM table ORDER BY RAND() LIMIT n Which returns a random result or do I ...

Trouble with MS Access 2007 SQL Query

Are ordinary sql queries different from MS Access 2007 queries? I have this simple query but it is not working in MS Access query (SQL View). What is wrong with this? SELECT StudentSubject.*, Subject.*,Professor.*, Student.*, Church.* FROM ( SELECT StudentSubject.*, Subject.*,Professor.* , Student.* FROM ( SELECT StudentSubject....

How to implement MySQL::"LOAD DATA LOCAL INFILE" in PHP?

We have to implement the import procedure. The quantities of data is about 100 megabytes for one CSV files (the files already resides on server, so no upload necessary). Any advice on whether to implement the bulk "LOAD DATA LOCAL INFILE" or row-by-row "INSERT/REPLACE" on importing data into database. I've checked that "LOAD DATA LOCA...

Is Mysql (innodb) row level locking the solution?

Hello, Recently ran into a problem after putting my codeiginter application into a clustered environment. Users are able to get site rewards at point levels, after they click submit to retrieve the reward I have code that grabs the current point level of the reward is at and save that in a table with the user_id and what point level the...

How to select UNIX date = "2010" in mysql query?

Here is my code so far: SELECT `date`, title, category, url FROM cute_news WHERE category = '4' ORDER BY `date` DESC I want make pages based on the year, like, 2010 , 2009, 2008 and so on. The database saves the date as UNIX_Timestamp. Not sure how to query a recordset with a Year parameter? WHERE unix_timestamp(YEAR) = '2010' or som...

Equivalent of sp_lock, sp_who for mysql

Hi guys, Can anyone please tell me what is the equivalent of sp_lock, sp_who or sp_who2 in mysql server? Basically I want to know which tables are locked due to some query and which host is holding on to those exclusive locks. Thanks in advance ...

Optimal way to store in MySQL available dates in multiple years

We are developing a MySQL database (with frontend and backend) with holiday packages. We have everything figured out except for the best method to store the departure dates of the tour packages. Some packages are available almost every day of the year; others are only available on tuesdays and wednesdays; others leave every monday betwe...