mysql

Get authed user's settings

Sorry for the title but as im pretty worthless at php/mysql i couldnt figure out a good title I'm currently creating a community for the fun. I need to be able to get the all of the authed user's info all throughout the site. Whats the best way to do this? Right now I just have a query in index.php (i include all pages thru index.php)...

mysql pivot to a postgres pivot table...

I was using mysql just fine until I recently switched one of my rails apps to heroku and had to change over. Almost everything works as expected except I have one query which does something totally funky. This is the postgres, but under mysql it is mostly identical except for the EXTRACT DOW and some group by additions, but that isn't ...

How to create unique temporary tables in MySQL procedures?

I was creating a temporary table in my procedure, but I always got an error "table already exists". Then I tried to create a random name to avoid collision but I don't know enough about how to execute SQL strings SET @tbName = CONCAT('temp', random_id); PREPARE stmt1 FROM 'CREATE TEMPORARY TABLE ? (`FIELDNAME` float NOT NULL);'; EXECU...

php , mysql,coding

i uploaded my images in mysql using blob with php coding. now how can i retrieve them and display inside a browser. ofcourse i also want swf files ...

Maximum number of columns in a table

Problem1: What is the maximum no of columns we can have in a table Problem2: What is the maximum no of columns we should have in a table ...

Special care/settings for databases that hit a few tables in particular

I suspect that lots of business related software is designed to manage a particular set of information; customers, orders, leads or products and/or a combination. This has been the case in most of my experience. All other tables are usually data supporting the major ones. If this isn't the case, then assume it is for a moment :) because...

MYSQL - Retrieve Timestamps between dates

All, I have a MYSQL table with a column called timestamp. It is of DATETIME datatype and has values like "10/1/2009 3:25:08 PM', "10/1/2009 3:30:05 PM', "10/4/2009 3:40:01 PM', etc.. I want to write a SQL query to select all the values in the timestamp field occuring between two dates.. something like this: select timestamp from table...

MySQL 'Update Timestamp' Column - Trigger

I'm adding a column tsu (timestamp update) of type DATETIME to a number of my tables. I need to write BEFORE UPDATE triggers that will update the column to CURRENT_TIMESTAMP(), but I can't get it right. Tried: DELIMITER $$ CREATE TRIGGER `cams`.`tsu_update_csi` BEFORE UPDATE ON `cams`.`csi` FOR EACH ROW BEGIN UPDAT...

MySQL Query for displaying all rows of one table with yes/no if matching other table?

I apologize in advance for the non technincal description on this problem! I have two tables: UsersOptions and OptionsList.. For simplicity sake, OptionsList is below: ID - NAME 1 - Red 2 - Blue 3 - Orange UsersOptions has many rows eg; ID - CLIENT - OPTION 1 - John - Red 2 - John - Orange 3 - Mary - Red 4 - Jill - Blue 5 - Jill ...

Spring queryForLong - Loss of precision

I have a Spring application running against a MySql database. I have a sales table like: +-------------------+------------------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------+------------------------------+------+-----+---------+-----...

Some problems searching mysql database via php

So I have this website that has a search feature which searches a table in my mysql database. The database at the moment has 1108 rows. It contains music info such as Artist and Album. Since its possible for every character to be in an artist name or album name, I've urlencoded each of those variables before being added to the database. ...

How to run the equivilant of PHP and MySQL on portable media (eg CD, USB and/or iPhone)

I use a local installation of Apache, MySQL, and PHP with XAMPP which require a bit of configuration and installation - is there an alternative language or database system that can be used on portable media such as a CD or DVD-Rom? Although this question is similar to apache-php-and-mysql-portable - I'm looking more for the best portable...

Representing text with number MySQL

Hello, I am building a survey, in which participants use a html form to enter details. For example: What gender are you? Male | Female The Male/Female option can be selected using a radio button. However, I would like to store the answer in my database as an INT value, which is 0 for male and 1 for female. How do I write a quer...

MySQL: Last 10 entries per user?

I have a table storing transactional data for users. To find a users rating you take the average score of the last 10 entries for that user. Is there a way to get that with SQL? I need to be able to work it out for a single user given their ID. And to get a list of all users ordered by their score. Currently I'm working it out outside ...

MySQL - Multiple tables vs. single table

I have been working on saving/loading, and i came across that i have to load/save alot of tables, cause i split my tables into categories eg. characters, character_appearance, character_preferences, character_session, etc (i use the LEFT JOIN clause to load) Would it be better if i just put all the columns into a single table instead of...

What is "enough sanitization" for a URL

The URL would be Saved to a MySQL database Used to display a picture on the user's profile would strip_tags() and mysql_real_escape_string() be enough? ...

How do I get the page source of the html page using php codes?

How do I get the page source of the html page using php codes and then save all all of those codes into a database? Is it possible? Please help. Thanks. Database is MySQL ...

Rails - Shared Database Tables between two apps

We’ll be releasing shortly a companion Rails application to our existing Rails app. We will be running the companion app alongside our existing app on the same servers. My question concerns the databases. My hosting provider generally would configure a 2nd distinct database for the new application - secondappname_production. However,...

MySQL - Best method to saving and loading items.

Hello, So on my older work, I had always used the 'text' data type to store items, like so: 0=4151:54;1=995:5000;2=521:1; So basically: slot=item:amount; I've been looking into finding the best ways of storing information in a sql database, and everywhere i go, it says that using text is a big performance hit. I was thinking of doi...

how to drop database

hi..i used the following sytanx drop database filmo; and got the following error: ERROR 1010 (HY000): Error dropping database (can't rmdir './filmo/', errno: 17) any ideas.. ...