mysql

Single result in a query using Left Joins

I currently have a query similar to: SELECT users.fname, users.lname, sales.date FROM users LEFT JOIN sales ON users.id=sales.user And this gives me the result of something like: Fname | Lname | Date Jeff | K | 2/12/08 Jeff | K | 5/18/08 Jeff | K | 2/22/09 Bill | D | 3/12/08 Bill | D | 12/9/08 This is wha...

reuse of resource in another sql statement

hi, i am using php with mySql server, pretty new to all the sql and i have a question: i have a query: $book_copy_user = "SELECT * FROM copy_book " . "JOIN copy_user_own " . "ON copy_book.copy_id = copy_user_own.copy_id " . "WHERE copy_user_own.user_id=1"; $res1 =mysql_query($...

Merging two tables with a common unique field in MySql

The problem if have is this. We have taken over a website which has an active member community. We've been given the application and database dump and have the site running on a new server successfully and the DNS has been switched. The problem is that the database has come out of sync in the time it took to get the files to us and t...

MYSQL : First and last record of a grouped record (aggregate functions)

I am trying to do fectch the first and the last record of a 'grouped' record. More precisely, I am doing a query like this SELECT MIN(low_price), MAX(high_price), open, close FROM symbols WHERE date BETWEEN(.. ..) GROUP BY YEARWEEK(date) but I'd like to get the first and the last record of the group. It could by done by doing tons of ...

Problem connecting to MySQL from ASP in IIS

I have a ASP application running on a IIS7 server on Windows Vista Home Premium (developing environment). The application has an ASA file to configure connections to the database: <SCRIPT LANGUAGE=VBScript RUNAT=Server> Sub Application_OnStart Application("db") = 2 Application("dbconnect") = "Driver={MySQL ODBC 3.51 Driver};Ser...

What is the best way to store 10 options in a mysql database?

I am modifying my PHP network's code to have "user roles" like wordpress here is my plan so far 0 = registred non email verified user 1 = registed and verified email 2 = moderator 3-9 = nothing yet 10= admin In my PHP code I will use an array like this that will set what a role number does. $user_role['10'] I was thinking of stori...

Move divtag and store position in database?

Hi, I want users on my website to be able to "move" div tags once they are 'unlocked' and then for a php script to store the positions in mysql database. So once the user re-logs in the div tags are positioned in the correct place. I know how to postion div tags in css, and am using php varibles within css to pull the data from the data...

List of Best Practice MySQL Data Types

Is there a list of best practice MySQL data types for common applications. For example, the list would contain the best data type and size for id, ip address, email, subject, summary, description content, url, date (timestamp and human readable), geo points, media height, media width, media duration, etc Thank you!!! ...

What is the best html form to use to get my signout button to work via php

I have a signout button that I need to make work...what is the best way to do that through mysql? thanks ...

Search for accentuated char in mysql

I need to find occurences of é ou è in a mysql table. First tried : SELECT "LéL" like "%é%"; which doesn't work : it returns word containing e or é or è. I also tried with regex without results (using the the letter L): SELECT "Lbc" REGEXP ".*L.*"; -- works : it finds L in the string LBC SELECT "Lbc" REGEXP ".*\u4C.*"; -- does...

Python list vs. MySQL Select performance

I have a large list with 15k entries in a MySQL table from which I need to select a few items, many times. For example, I might want all entries with a number field between 1 and 10. In SQL this would be easy: SELECT text FROM table WHERE number>=1 AND number<10; If I extract the entire table to a Python list: PyList = [[text1, numb...

How to write SQL query for these 5 tables?

I am writing an application that helps book exchange between users. I am using PHP and MySQL, and I am pretty new to them both. I have 5 tables, 3 data tables and 2 service tables: user: with user attributes (user_id, name, birth... etc). book: with book attributes (book_id, name, author, publisher... etc). copy: represents actual co...

Fulltext Search with InnoDB

I'm developing a high-volume web application, where part of it is a MySQL database of discussion posts that will need to grow to 20M+ rows, smoothly. I was originally planning on using MyISAM for the tables (for the built-in fulltext search capabilities), but the thought of the entire table being locked due to a single write operation m...

Adobe Air - MySQL or SQLite

i am very new to Adobe Air and i am having a hard time with it. i want to be able to create a desktop app for clients that communicates with a databse. im currently used to writing everything in php, which then communicates with MySQL. also, i plan on using Flex. 1: does Adobe Air communicate directly with the database? or does it co...

MySQL Drop Down to Return result...seems simple?

I have a PHP registration that calls a mysql db for a dropdown box. No worries, it works fine. What I can't figure out though is this: The box HAS TO populate with a name, but the POST needs to go to an id field. What I mean is this: REGISTRATION.PHP function generate_business_selections($default = '') { $output = ''; $applicatio...

MySQL cuts off string at special chars

Hello, I'm trying to insert remote POST data (articles sent by iSnare) into MySQL with PHP. Data comes successfully from remote POST sender and I can write it to plain-text file without a problem. Unfortunately, when it comes to insert it into MySQL, MySQL cuts off string (article) at special char. I tried many things but still I'm uns...

Order of an item in MySQL query result

Is there a way to know the order of an specific item in a query result with traversing the whole set? I have a web application that show user comments in Ajaxified way, I would like to send the user a link to their comments like this: http://my.web/post/12345#comment%5F45 and using the hash value "comment_45" load the comment page wit...

Logging in to MySQL via command line with unusual password

In MySQL, I have a user with a password that has a "<" in it. CREATE USER me IDENTIFIED BY 'ab>cd'; I can log perfectly in using this username and password using the MySQL Query Browser. Great. But then when I try to log in using the command line, it fails. C:\Program Files\MySQL\Server\bin>mysql -u me -pab>cd ERROR 1045 (28000): Acc...

Simple SQL - count function

My MySQL table is simple. I have 3 fields: an index a url a title making up 20 records. I'm trying to count the number of rows so that I can paginate with PHP. But count(*) is returning more than the number of rows that are there, 142 total. I get the same results counting the index. What am I missing? edit Sorry for the previous...

inserting a tuple into a mysql db

can anyone show me the syntax for inserting a python tuple/list into a mysql database? i also need to know if it is possible for user to pass certain rows without inserting anything... for example: a function is returning this tuple: return job(jcardnum, jreg, jcarddate, jcardtime, jcardserve, jdeliver) suppose the user didnt enter an...