mysql

multiple value stored in single coloumn in MySQL database?

Hi all developers, How can i store multiple values in one attribute. for example: column name: telephone i want to store 5,7 and 16 this three different values in one column (telephone) in one row. ...

add login time using php mysql

hey can some one tell me query using php mysql that how to add date and time when a person logged in and logged out inside a database table. ...

How can I sort data before grouping in MYSQL

I have a big mysql query which needs to trawl through 4 tables to get all the 'items' for my application. Each item can have many categories and each user can have up to one of each item. The items and categories are easy: SELECT Items.itemId, Items.name, Items.type, Categories.name AS category FROM Items LEFT JOIN ItemCategories ON I...

Insert HTML to DB via form using php

Greetings, I'd like to insert html via a form into my database using php. Can anyone please tell me what function I can use to ensure something such as <p>This is a test</p> <h1>Turns up correctly</h1> Turns up in the database correctly. Right now when I do an insert the special characters are replaced with the HTML special charact...

How woud I join this query in one single SQL statement?

Let's say I have these tables, with these fields: companies: company_id | name | num_employees companies_countries: company_id | country_id countries: country_id | country_iso_code Assuming this is a 1:1 relationship: How can I join the country_iso_code directly into the company recordset, when I fetch all the companies? I think I w...

Linked pulldown lists using MySQL, PHP/JavaScript/Ajax/jQuery

I am quite new to web development and have a task to develop a web application that will basically show the user 5-15 pull down lists on one page, where each selection will limit the choices in all other lists. The user should be able to start with any one of the lists (so no set selection order) and when the user have selected something...

MySQL - Nested set model: searching in nodes

Hello. Let's just say I have tree in my table called "page": Foo -- Bar 1 -- Bar 2 -- Bar 3 -- Some foo -- Some value Bar -- Bar 4 I want to search by node's name. For example "bar%". Excpected output should be: Foo -- Bar 1 -- Bar 2 -- Bar 3 Bar -- Bar 4 I can't find solution to write right query in My...

jruby public database adapter

Hi I'm trying to deploy my rails application from jRuby to Heroku The db is giving me problems: $ heroku db:push Auto-detected local database: jdbcmysql://root:password@localhost/product_develo pment?encoding=utf8 Failed to connect to database: Sequel::AdapterNotFound -> Could not load jdbcmysql adapter: no such file to load -- /us...

Best update query for mysql table

Hello, I have a file hosting site where I provide a point for every unique download to user. Sample of my table These points can be redeemed by user. So for example if a user redeems 100 points than what is the best query to reduce points available from each row till 100 points are reduced. Thank You. ...

MySQL stored procedure causing problems?

EDIT: I've narrowed my mysql wait timeout down to this line: IF @resultsFound > 0 THEN INSERT INTO product_search_query (QueryText, CategoryId) VALUES (keywords, topLevelCategoryId); END IF; Any idea why this would cause a problem? I can't work it out! Hi guys, I've written a stored proc to search for products in cer...

Mysql ucfirst doesn't work.

Hello everyone, I have this table: CREATE TABLE IF NOT EXISTS `events` ( `evt_id` int(11) NOT NULL AUTO_INCREMENT, `evt_name` varchar(50) CHARACTER SET utf8 NOT NULL DEFAULT 'ucfirst', `evt_description` varchar(100) DEFAULT NULL, `evt_startdate` date NOT NULL, `evt_enddate` date DEFAULT NULL, `evt_starttime` time DEFAULT NU...

PHP, MySQL CSV Import - How would you do this?

Hello... So I'm working on a PHP project that needs to allow the user to import CSV files into MySQL. The CSV files contain a "column" with a unique ID... there are duplicates. Here is where the tricky part comes in... The duplicates need to go into a separate table and not into the main table. I have written code to do this but there...

How update order of rows stored in a mysql table?

I want to update the order so that GALLERY goes before PRODUCTS. What should be the query to do this? Sorry for my English. ...

MySQL Include a script within script.

I'm involved is a project to migrate a project from Oracle to MySQL. In Oracle I have the ability to create a SQL script that references or inlcudes other external SQL script files when the batch is run via command line. I Have a script called CreateAllTables.sql that looks like this internally: @tables\Site.sql @tables\Language.sql @ta...

Storing and Displaying Questionnaire Data, Easier Solution ?

Basically this is a questionnaire, but that does not only ask Yes/No type of questions. There are questions that are asked in the form of a table. Here is an example of one of the step pages for the questionnaire: The questionnaire allows for a client to save what they have entered, log out, come back at a later point in time and contin...

Mysql SELECT narrowing search

EDIT:That was fast. The reason why I have this is because the table is a pivot table between 2 tables one has "id" as primary key and the other "type" primary key Hello. I want the following: Find only find "id" where "type" is 1 AND 2 AND 3 This is not working: SELECT * FROM `table` WHERE `type` = 1 AND `type` = 2 AND `type` = 3; ...

mysql query - Need a little help with grouping...

I'm wondering how to write this query, it's a little complicated... This is an example of what's being stored in the table: KID Utype Qtype Qname Resp UID Q24-YYY Case T001 HM-99678 N8944 2455 Q24-YYY Case T001 HM-99678 N8944 9874 Q24-YYY Case F099 HM-99678 N8944 6554 Q24-YYY Case F099 HM-99678 SD789 2331 Q24-YYY Case F099 HM...

Securing tables vs databases on a mutitool web site with confidential information

I am working on a site that multiple projects will be using to enter confidential subject information for various research projects. Project data access will be limited to specific users and tools. But certain core data will be referenced in and joined to the project tables (username, project meta-data, etc). The current plan is that ...

Can I use a variable in SQL? If not, how to avoid this?

Can I pull out data by using variable in SQL? For example, In controller $frontbottom = $this->MProducts -> getFeatureProducts('Front bottom'); In model //This does not work. function getFeatureProducts($catname){ $data = array(); $Q = $this->db->query('SELECT P.*, C.Name AS CatName FROM omc_product...

how to reverse mysql table

I need to display what the table contains from the freshest data to the oldest. Something like this doesn't work: SELECT * FROM table ORDER BY DESC;. I know its becouse after ORDER BY should be name of the column. But I want to just reverse normal order (by normal I mean from the oldest to the freshest data). How to do this? ...