mysql

PHP File Validation using If statements uploads.

Hi I am quite new to php but i have been following some tutorials but they don't seem to work so I have tried to adapt them. I have tested this code and it works to a point but theres something else I can't get my head around, the php file is not uploading (fine) but the details are still being writen to the datbase although the $ok is...

MySql Union not getting executed in a view

Hi, I am trying to create a view for a UNION of 2 select statements that I have created. The UNION is working fine when executed individually But the problem is only the 1st part of the UNION is getting executed when I am executing it as a view. The query I am using is as below SELECT DISTINCT products.pid AS id, p...

Coding of parameter-value for SELECT in PHP-MySQL

alt A below is a statement from a php-mysql tutorial. It works as it should. I found the id-value rather obfuscated and tested alt B. This also worked! What is the point with the id-value of alt A? MySQL 5.0.51, PHP 5.2.6 // alt A : $sql="SELECT * FROM exempel WHERE id = '".$q."'"; // alt B : $sql="SELECT * FROM exempel W...

How to fix "dlopen(/Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundle, 9): Library not loaded: /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib"?

I've upgraded to Rails 2.2.2 and installed the MySQL 2.7 gem and am seeing this error when I try to run a migration or start the server: dlopen(/Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundle, 9): Library not loaded: /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib Referenced from: /Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysq...

How do I 'load data' with multiple tables?

I have three tables. For simplicity let's say they are: tbl1, tbl2, tbl3 both tbl2, and tbl3 have f-keys linking to tbl1 I am using 'load data infile...' as I really need the +16,000 writes/second I am getting right now with it. I don't use auto-increment because I need the f-keys for my child records. So I create my txtfile on the ...

Best way to handle storing/displaying dates in different timezones in PHP?

I've been reading up on this topic for the past few hours, and I think I've got a handle on it, but I'd like some confirmation. Situation I want a user in, say, California to be able to post a comment that will be stored in MySQL. I then want a user in, say, Texas to be able to view the comment with the post date adjusted to his or her...

Select Users by Total Submissions

I know this is an easy one, but it's driving me nuts... I have a users table, comments table, and pictures table. I want a list of the top 10 users based on submissions (total of their comments and their submitted photos). That's it. Shame me. UPDATE: based on Ed's answer. here's my setup: users table (user_id, username) image...

MySQL Simple Table Synchronization?

Ok, So I'm developing a website which to begin with will have 3 clear sub sites: Forum, News and a Calendar. Each sub site will have it's own database and common to all of these databases will be a user table which needs to be in each database so that joins can be done. How can I synchronize all the user tables so that it doesn't matte...

Classic database insert problem

I have a SQL database which i use to store some info and every record has a unique id generated by the database. MY program is written in flash and runs over the web, the program runs fine and it inserts records into the database and pulls the idnumber of the last record and displays it for user, my question is though how do i handle mul...

Has anyone installed MySQLDB for Python on Cygwin?

Hi, I'm trying to install MySQLDB for python on Cygwin. Unfortunately, when I run python setup.py build, I get the following error: $ python setup.py build /bin/sh: /usr/local/bin/mysql_config: No such file or directory Traceback (most recent call last): File "setup.py", line 16, in <module> metadata, options = get_config() Fil...

How to create dynamic links from database in Zend Framework?

Basically I'm a bit stuck, I've been following the quick start on Zend site, and wish to make a dynamic navigation to the framework, I've got layout.phtml with $this->render('navigation.phtml); this has static links, but I wish to make them pull from a database table could someone in plain english not geekcaneeze explain the correct way...

Way to automate deletion of expired records in MySQL?

I've googled around and searched the MYSQL docs ad nauseam and couldn't find a succinct way of automating deletion of records that exceeded a given timeframe. I've been able to get a query in 5.1 to cast a value of TIMESTAMP to DATETIME within a DIFF function with the current time to see if it meets the criteria of expiration. I've read ...

What would use for versioned (large) text storage for the web app backend?

Arguing with a friend of mine — I am advocating git/hg, he is advocating CLOBs MySQL. What is your preference? ...

Google maps api database interaction

I am currently working on a project where users need to be able to enter geological data (such as a certain street name) into a website which will be put into a database and then retrieved and displayed on a Google map for all users to see. I've done a little research and so far it looks like the best way to do this is to use a php scri...

Base 64 encode vs loading an image file.

So I am working on something in php where I have to get get my images from a sql database where they will be encoded in base64. The speed of displaying these images is critical so I am trying to figure out if it would be faster turn the database data into an image file and then load it in the browser, or just echo the raw base64 data and...

Help with SQL query.

Hello. I have the following table on a MySQL 5.1.30: CREATE TABLE article ( article_id int(10) unsigned NOT NULL AUTO_INCREMENT, category_id int(10) unsigned NOT NULL, title varchar(100) NOT NULL, PRIMARY KEY (article_id) ); With this information: 1, 1, 'foo' 2, 1, 'bar' 3, 1, 'baz' 4, 1, 'quox' 5, 2, 'quonom' 6, 2, 'qox' ...

Rewriting a MySQL query

I'll try to explain this better on another question. This is the query that I think should work but, off course, MySQL doesn't support this specific subselect query: select * from articles a where a.article_id in (select f.article_id from articles f where f.category_id = a.category_id order by f.is_stic...

retrieve a multi-column PK in MySQL

How do I retrieve a multi-column PK in MySQL? For example I have my primary key setup as PRIMARY KEY (donor_id,country_id) Now if I want to get the primary key value without concatenating those 2 fields in a select query, how do I do that? I want to use this in a view (or better yet, directly in phpmaker). ...

Storing a binary array in MySQL

I have an array of values called A, B... X, Y, Z. Fun though it would be to have 26 columns in the table I can't help but feel there is a better way. I have considered creating a second table with the id value of row from the first table, the id of the item in the array and then the boolean value but it seems clunky and confusing. Is th...

SQL "ON" Clause Optimization

Which query would run faster? SELECT * FROM topic_info LEFT JOIN topic_data ON topic_info.id = topic_data.id WHERE id = ? or SELECT * FROM topic_info LEFT JOIN topic_data ON topic_data.id = topic_info.id WHERE id = ? The difference is the order of expressions on the "ON" clause: the first query is checking topic_info.id aga...