mysql

Simple SQL question - pulling value between min and max

Okay, this is probably really simple but for some reason I'm totally fried on this and need some advice. I have two columns in my database, budget_min and budget_max. Oh the front end, I'm trying to build a search that will find everything between two budgets, say 1000 - 2000, or 2000 - 4000. Need something like where budget_min > 100...

MySQL stored procedures in SVN

What is the best way to save MySQL stored procedures and table structures in SVN? I have around 100 tables and 200 stored procedures, dumping all procedures in a single file makes no sense as it contains thousands of lines and hard to maintain. I'm now thinking of creating separate separate files for each table and procedure, but it wi...

Select ALL fields that contains only UPPERCASE letters

How do you select a field that contains only uppercase character in mysql or a field that doesn't contain any lower case character? ...

qt mysql query giving different result on different machine

QSqlQuery query; QString queryString = "SELECT * FROM " + parameter3->toAscii() + " WHERE " + parameter1->toAscii() + " = \"" + parameter2->toAscii() + "\""; bool retX = query.exec(queryString); above code when bundled as an application returns true on the machine it has been created. it returns false on other machines. how is it possi...

MySQL Connection String Using PHP

Hi, I am trying to connect to the database that is hosted on my server through my local machine. my server has cPanel 11, and it is a typical shared server, powered by CentOS, PHP and MySQL installed. to be precise i am holding the reseller account in the same server. i want to access the database between different accounts or domai...

Mysql & PHP Error: Column count doesn't match value count at row 1

Hi guys, I'm getting this error when trying to insert data from a form into a database. I know what it means, I just can't figure out why I'm getting it. Perhaps I've been starting at it for too long and have missed something? Here is my code: <?php $q1 = mysql_escape_string($_POST['q1']); $q2 = mysql_escape_s...

Problem with sorting results over two different columns

Hello, I have two MySQL tables, one with categories and one with products. For the first one, I also have a column which describes the category order. What I want to do is get all the products and sort them by category (which needs to be sorted ascending according to the 'order' field) and by price (also ascending). The tables are: c...

Printing all the queries that mySql generates

I work with Workbench and phpMyAdmin with mySql, I use Procedures and Function etc... Sometimes one procedure triggers another Function and so on... eventually something goes wrong somewhere. Is there any tool known to anybody that can show all the queries mySql runs? Like a command prompt that shows every command MySql runs it would b...

a strange popup window opens in website

Hi there, i have a games website. in that there are more than 4000 flash games available. Now my problem is in my website i am getting a strange popup window whenever i first open up my web site in a day that pop up appears with sometimes google, sometimes yahoo sometimes and somee other sites..i dont know how the popups are coming.. ...

LAST_INSERT_ID() MySQL

I have a MySQL question that I think must be quite easy. I need to return the LAST INSERTED ID from table1 when I run the following MySql query: INSERT INTO table1 (title,userid) VALUES ('test',1); INSERT INTO table2 (parentid,otherid,userid) VALUES (LAST_INSERT_ID(),4,1); SELECT LAST_INSERT_ID(); As you can understand the current co...

PHP MySQL Website to External SQL System Integration

Hello, I am after opinions from some expert web developers as to the best solution to my problem. THE SETUP In my job, I look after an online shop, which is based upon osCommerce, with many additional features and tweaks. This is on Linux shared hosting and uses PHP and MySQL as its main technologies. We are going through the process...

handling null paramaters in mysql procedure - not working

I am passing null to below procedure as below its is not returning any values even if data is there in the table? call view_ads (NULL,'vehicles',9); call view_ads ('placename',null,9); ===================================================================================== below is the code delimiter $$ drop procedure view_ads$$ create...

MySql Regular Expression Select Columns Matching (dynamic)multiple Values within Stored Procedure

I am trying to generate a query where I want to select columns(text) matching multiple values. eg: I have two columns, id and description. suppose my first row contains description column with value Google is website and an awesome search engine , second row with description column value Amazon website is an awesome eCommer...

Select * from table where date = today

Need help with PHP/MySql. Need to select all the records from 'today'. My table has a coloumn which holds a unixtime stamp and I want to just select from the table where the unixtime stamp = today. Happy to do this on linux command line just need to basic MySql query? ...

is this the correct way to optimize MySQL Query?

$sql="update users_contain set wood_max = (Select building_production from building_level where merge_id=$subPrimaryKey and empire_id=$user_empireID) , iron_max = wood_max, clay_max = wood_max where user_id = $user_id"; Now there is a question. will wood_max will always be updated first than iron_ma...

Inser Ignore into table is not working

insert ignore table ( field2 , name) Values ( 22 , 'value3'); its adding duplicating the value and table strcture : +------------------------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------------------+------------------+...

Sequel::AdapterNotFound while trying to run Ruby On Rails application

Hello everyone. This is my first question asked here so I apologize in advance if I break any rules. I'm trying to get a project going on my system, I have imported the source code via GITHub, and are running it locally with WEBrick. When I do, the following error is printed: => Booting WEBrick => Rails 2.3.8 application starting on 0....

Select * from tbl where id>=5 /* then add the result from id<5 to query */

I have a table with 9 rows. $id=5 If i use SELECT * FROM tbl WHERE id>=$id i get the 5,6,7,8,9 rows. To this query I want to add the result of SELECT * FROM tbl WHERE id<$id so I will get the final 5,6,7,8,9,1,2,3,4 rows. This is to avoid going two times in database then add the result set in php. EDIT: Yes order is important. Thank ...

ON DUPLICATE KEY UPDATE with a multi field index

I have this test table with one row entry and 2 indexes, the first a primary key and then a unique index for a and b columns: CREATE TABLE IF NOT EXISTS `test` ( `id` int(11) NOT NULL AUTO_INCREMENT, `a` int(11) NOT NULL, `b` int(11) NOT NULL, `c` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `a` (`a`,`b`) ) ENGINE=InnoDB...

Exporting MYSQL functions with different access privileges based on creator

Hi, From phpMyAdmin, I was exporting the functions/procedures used by the user assigned to a particular database and 3 functions didnt get exported because they were created by the 'superadmin'. I was able to see these functions within localhost > database_name -> Structure -> Routines BUT, I was not able to modify their structure o...