mysql

Is it possible to 'store search criteria' and the reuse it at some other time?

I have a classifieds website where users may search ads. I wonder if I can somehow store search criteria and whenever the users wishes, reuse that search criteria to make another search again, exactly the same... ? This would make it easier for users to search for a specific car for instance, and not have to fill in all the details suc...

Update a row if ID exists else Insert.

This is the code of a .php file. The column "memberid" has a unique index. When a user enters a record with an existing memberid, the record must get updated else a new row is created. I also want to show an alert box. For test purposes I added like the way below, but it is not firing. No message is displayed. I also want to know wheth...

How to store search criteria or search results?

I have a php classifieds website (mostly) and I am currently using MYSQL as a database. Later on I will use SOLR or maybe Sphinx as a "search engine". I want to make it possible for users to view "results" of searches they have made before, but I don't know where to start... How is this done? Currently I have a form which is filled i...

For a mysql procedure, Do I need to specify INTO to display the results?

Do I need to specify the INTO parameter for every column I want sent out of the procedure? If I have the following: SELECT col1, col2, col3, col4 FROM table WHERE col1 = 'something' Do I need to specify INTO for each column? ...

Error when install python mysql module on windows?

When i try to install mysql on windows i get this error MySQL-python-0.9.2>python setup.py build running build running build_py running build_ext building '_mysql' extension error: Unable to find vcvarsall.bat ...

Hibernate, MySQL Views and hibernate.hbm2ddl.auto = validate

I can use MySQL views in Hibernate by treating them like tables - ie. the entity is no different than one created for a table. However my application won't deploy when Hibernate is set to validate the model as it can't find the View as it assumes it's a table. Is it possible to use Hibernate Entities with deploy time validation turned o...

searching mySQL by first char(s) in fields with php

I have a database that's setup in the following way id coach team event status 14 test 8,7,12,13,15 4,1,2,14,4 2 13 test 8,12,13,14,15,16 1,2,8,16,16 3 What i need to do, is search for rows where the first number in the "event" column matches the query. They are s...

How to search using the LIKE syntax and % WILDCARD % across multiple tables.

How can you use mysql and the like/wildcard syntax across multiple tables, would it be as simple as: (SELECT * FROM `table1` WHERE `name` LIKE '%tom%') AND (SELECT * FROM `table2` WHERE `name` LIKE '%sam%') Not tested, just thinking about it. ...

Can´t INSERT values with Foreign Key in MySQL

I have a MySQL (5.1.42 on OsX) running. I added a Foreign Key with this sql statement: ALTER TABLE `Portal`.`Mitarbeiter_2_BlackBerry` ADD CONSTRAINT `fk_Blackberry` FOREIGN KEY (`id` ) REFERENCES `Portal`.`Blackberry` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION , ADD INDEX `fk_Blackberry` (`id` ASC) But when i try to i...

Smart (?) Database Cache

I've seen several database cache engines, all of them are pretty dumb (i.e.: keep this query cached for X minutes) and require that you manually delete the whole cache repository after a INSERT / UPDATE / DELETE query has been executed. About 2 or 3 years ago I developed an alternative DB cache system for a project I was working on, the...

Escaping values in SQL queries (C# with SQL connector)

Hi, I know I can use the parameters, but what is the right way to escape string sequences? The query could be like this: "INSERT INTO records (ReferenceID,Name,Note,Author) VALUES ('" + ID+ "','" + addlevel.textBox1.Text + "','"+addlevel.textBox2_note.Text+ "','"+Program.Username+"')"; I am ONLY curious, just want to know :) EDIT: Bu...

MySQL - query for last created table

Is there a query that will show the last created table in a database? ...

Given a column name how can I find which tables in database contain that column ?

Given a column name how can I find which tables in database contain that column ? or alternatively How can I find that particular column exists for all tables in Database ? Note: Kindly explain answers with Examples as that I get most knowledge from the answer. Edit: I am using MySQL Database. ...

mysql null to 0

SELECT * from book; how to convert NULL result to 0 from the sql ? ...

Get a column value (like id) after mysql INSERT

Can I get from PHP a value back like the new id from the row I've just added to the database or should I make a SELECT to retrieve it? <?php $sql = "INSERT INTO my_table (column_1, column_2) VALUES ('hello', 'ciao')"; $res = mysql_query ($sql) or die (mysql_error ()); $sql = "SELECT column_id FROM my_table WHERE column_1 = 'hello'"; $...

Is MySQL performant with select ... in (ID1,ID2,ID3,...ID100)?

Will this kind of query bring performance issue? ...

Is the method Doctrine_Table::find() deprecated?

Hi, I had a problem with the method Doctrine_Table::find(), since it's thorowing an exception of SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens I solved the problem by using Doctrine::getTable('City')->findOneById($id); instead and it works fine. When I tried to invistigate about t...

get list of products in stock at any given date

I have two tables: one holding products and one holding related inventory moves. Product table: Seq | Name | Barcode Move table: Seq | ProductFK | Direction | Date Each product can have multiple IN and/or OUT move records. How can I get a list of all product that are in stock at any given date? I tried the following but t...

Using derived expressions in MySQL views

The examples here show a very simplified version of a VIEW that I am constructing in MySQL. The goal here is to create a view from which I can select a single set of results to be populated into a HTML table. The purpose of me using a view is, in part, to show calculations over this data as columns in the view. I can do this easily by g...

Extract information from Apple App Store

Does anyone know how to extract the title, cost, description and icon for a list of apps from the App Store? I have seen various sites do it, ie. link text. I do not need all of the apps, just 30-40 different ones, mostly from the education category. Also if possible is there a way to dump it into a MySQL database? Thanks! ...