mysql

How to structure this query...?

Hi Everyone... Consider the following table.... hotel facilities 1 internet 1 swimming pool 1 wi-fi 1 parking 2 swimming pool 2 sauna 2 parking 3 toilets 3 bungee-jumping 3 internet 4 parking 4 swimming pool I need to select only the hotels that have parking,...

Mysql error in stored procudure

This stored procedure is to search through all tables and columns in database. DELIMITER $$ DROP PROCEDURE IF EXISTS get_table $$ CREATE /*[DEFINER = { user | CURRENT_USER }]*/ PROCEDURE `auradoxdb`.`get_table`(in_search varchar(50)) READS SQL DATA BEGIN DECLARE trunc_cmd VARCHAR(50); DECLARE search_string VARCHAR(250); DECLARE ...

Database Testing

Can anyone expalin in detail how to perform Database Testing. I've basic idea about DDL, DML statements. ...

UPDATE REGEX MYSQL

I have a table of contacts and a table of postcode data. I need to match the first part of the postcode and the join that with the postcode table... and then perform an update... I want to do something like this... UPDATE `contacts` LEFT JOIN `postcodes` ON PREG_GREP("/^[A-Z]{1,2}[0-9][0-9A-Z]{0,1}/", `contacts`.`postcode`) = `postcod...

Is it possible to apply trigger on any table in information_schema?

Is it possible to apply trigger on any table in information_schema? ...

php import utf-8 txt file to latin1 database

I have an UTF-8 encoded txt file and I want to import it to latin1_general_ci table. Problem is that some characters display as ? in database and not as they supposed to. I tried mb_convert_encoding($str, "ISO-8859-1", "UTF-8"); but that didn't do anything. What am I doing wrong? ...

Mysql SELECT with an OR across 2 columns

I'm creating a 'similar items' link table. i have a 2 column table. both columns contains product ids. CREATE TABLE IF NOT EXISTS `prod_similar` ( `id_a` int(11) NOT NULL, `id_b` int(11) NOT NULL ) INSERT INTO `prod_similar` (`id_a`, `id_b`) VALUES (5, 10), (5, 15), (10, 13), (10, 14), (14, 5), (14, 13); I want to select 3 ...

Why does my Perl CGI complain "Can't locate Mysql.pm"?

I have two folders php and perl. They contain index.php and index.pl, respectively. My Perl code looks like: #!/usr/bin/perl use Mysql; print "Content-type: text/html\n\n"; print "<h2>PERL-mySQL Connect</h2>"; print "page info"; $host = "localhost"; $database = "cdcol"; $user = "root"; $password = ""; $db = Mysql->connect($host, $dat...

mysql export sql dump alphabatically,which cause foreign key constraints error during import

I have 10 tables in my database, where tbl_city and tbl_state. structure of tbl_state is below state_id |int(10) |UNSIGNED ZEROFILL auto_increment state_name |varchar(40) and structure of tbl_city is below city_id |int(10) |UNSIGNED ZEROFILL auto_increment city_name |varchar(40) | state_code |int(10) | UNSIGNED ...

Give people a price on my website when they join my facebook network

I was wondering if it is possible to give people something when they join my network on Facebook. I am working on an website where people have to buy credits to get certain services. I want to give them 3 free credits when they join the group on Facebook. Is this possible? I am also new to Facebook, so i don't know what to create. Sho...

storing image_id after uploading image in article table

According to this question i successed to create upload image , but now i need to store the image_id to another table called articles , i do not know if this is correct , but i tried to select the image_id from table image like this $select_image=mysql_query("select image_id from image where image_name = $fileName") or die(mysql_error()...

How to make every word in the text clickable and send it to the script

I have a text for example "The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog." When i click on word i must get data from XML or from mysql about this word. How i can make every word active for click and se...

Using mysqlimport where the filename is different from the table name

Hi all, I've been playing with mysqlimport and I've run into the restriction where the filename has to be the same as the table name. Is there any way to work round this? I can't rename the file as it is used by other processes and I don't want to copy the file as there will be many of them, some being very large. I want to use mysql...

mysql_query( "CALL... multiple results

I am tapping into a service that provides zip codes tax information - there service is a bit shakey, so I want to copy their database over and run the results off my own server while using their service to just update my table. However I'm not sure I'm able to loop through multiple results with this query: mysql_query( "CALL zip2tax.z2t...

Query in multiple tables with MYSQL

I have 2 tables. Table_1 has product 3 rows : ID, Quantity and Price. Table_2 has 2 rows : ID, Special_note. Not all products have a special note. When a product doesn't have a special note, there is no row for that product in table 2. I'm trying to use a select query that will get all the information from table_1 but also grab the sp...

So i've been recommended Zend search lucene php for search functionality, but is it better than mySql full text?

i've playing around with mysql's full text search and I'm not sure if it is the best. let's say I search for "how do I book an appointment?" it will give me the correct results from the database, so "how can I book appointments?" I think it is because "book" is an uncommon word. What if the user searches "how can I schedule an appoint...

sql query for fetching 10 rows with near values

Please help me with writing a sql query - I have a table with id, name and marks columns. If I arrange the table in ascending order of marks, how can I fetch 5 names whose marks are close to a particular name. ...

php mysql parallel array checkboxes

I have an array of checkboxes that I edit at once to set up a 'tinyint' field. the problem comes in when i uncheck the checkbox and post the vales to mysql. since it posts an array of checkboxes and another parallel array of values to edit, unchecking a checkbox results in the 0 value been ignored by PHP_POST and hence the checkbox array...

mysql - union tables by unique field

I have two tables with the same structure: id name 1 Merry 2 Mike and id name 1 Mike 2 Alis I need to union second table to first with keeping unique names, so that result is: id name 1 Merry 2 Mike 3 Alis Is it possible to do this with MySQL query, without using php script? ...

jQuery Connected Sortable Lists, Save Order to MySQL

Hello Hoping that using something like this demo it is possible to drag items within and between two columns, and update their order either live or with a "save" button to MySQL. Point being that you can make changes and return to the page later to view or update your ordering. http://pilotmade.com/draggable2.html Doing it for just on...