mysql

mysql a query to show trend in views

I have a cron job that runs hourly. The cron job adds a record to table 'update' table - 'update' update_id (primary) timestamp and adds a record for each page of my website into table views table - 'views' page_id update_id view_count What I am looking to achieve is a query which can compare the most recent update (highest updat...

Preferred MySQL tools

Hi what are the preferred mysql tools with professional developers. I am a recent computing graduate and have used the query browser and administrator from mysql throughout university and i have found them to be very useful. I start a new job in a couple of weeks though as a web developer and was wondering whether they would be exepcti...

How does one deal with multiple TimeZones in applications that store dates and times?

I realize this is a bit subjective, but I'm hoping to pick everyones brain here on how they deal with multiple timezones? There are a variety of similar questions here and an equally wide variety of accepted answers. How have you delt with this in apps you've built, and what issues did you have to overcome? ...

Sanitizing Integer Database Input

Hey guys, I have an application that takes data via a POST request. I am using this data to insert a new row into the database. I know that using mysql_real_escape_string() (plus removing % and _) is the way to go for strings, but what about integer values? Right now, I am using the PHP function intval() on them. However, I wanted to m...

Referential integrity problem upon migration from myisam to innodb

I want to migrate one of my database from myisam to innodb. The main reason is to allow my application to honor referential integrity. This is what I did Exported the current myisam database Dropped the database Switched to innodb database http://parasjain.net/2010/06/08/how-to-switch-to-innodb-database-in-mysql/ Verified the engine ...

selecting distinct rows

I am trying to select distinct but its not working SELECT Distinct `table1`.`myID` AS `myID`, `table1`.`TypeID` AS `TypeID`, Is there any thing I am missing? ...

Grouping by not working correctly

I have a guests table, with fields name and country, both varchar. At the moment, I have two records, one with country being USA, and one with country being USA. I am trying to group my records and then order them to see the most populous. I first tried this: SELECT * FROM ( SELECT count( country) AS countryCount, country FROM guests...

Anybody ever used PayPal Website Payments Standard with SESSION variables?

Note: Our site is built in PHP and uses MySQL databases. I already manage another site with shopping cart in its entirety using Authorize.net so please dont respond with suggestions to use another provider. A new product/service we are releasing is classified as "High Risk" to the merchant providers and they want to charge us out the a**...

Running repetitive maintenance processes on LAMP

I am developing an auction site that requires maintenance scripts to be run in the background to ensure smooth running. Things such as ending auctions, starting auctions, etc... There seem to be many options and no definite answers when I research the subject. Is there a standard for doing this sort of thing? My research so far has unc...

php (fuzzy) search matching

if anyone has ever submitted a story to digg, it checks whether or not the story is already submitted, I assume by a fuzzy search. I would like to implement something similar and want to know if they are using a php class that is open source? Soundex isnt doing it, sentences/strings can be up to 250chars in length ...

MySQL dynamic JOIN

Let's say that I have these tables on my db: items categories weapons shields swords And I need to create a join like this: SELECT items.*, {swords}.* FROM items INNER JOIN categories ON categories.id = items.category_id # <-- here I know that the item is a sword INNER JOIN {swords} ON {swords}.item_id = item.id WHERE items.id = ...

How do you use MySQL spatial queries to find all records in X radius?

I have a table in a MySQL database with a spatial geometry column of type POINT. I'd like to be able to take a point at the center of a map and find all records within X miles (or whatever distance) of it. I can't seem to find a good example or explanation of how to do this that doesn't get heavily into geometric math. I'm happy to go th...

my.cnf mysql phpmyadmin

Hi, Problems:- Whenever I try to select all tables in a database the connection is just lost and unknown error is given by the server to the browser and the browser just reloads with its own error page stating that the server gave unknown error. (This is in phpmyadmin) I tried to solve this by adding max_allowed_packet to my.cnf first ...

PHP MYSQL, How to show records in four columns ,

Here is my code the records shows in four columns but if my records is blank it shows three balng images, any suggestions? $query = mysql_query("SELECT * from rbf_events_images where event_id='".$_GET['id']."'"); echo '<table border="1">'; if(count(mysql_num_rows($query)>0)): $tropentags='<tr>'; $troclosingtags='</tr>'; $formTags=""; $t...

slow query log analyzers

What kind of tools are available to read & interpret slow queries and missing indexes? I am aware of MySQL Query Analyzer, can you suggest other tools which are simpler to configure and maintain (both open source and commercial) Database environment: MySQL, H2 ...

Web Developer vs. Web Application Developer vs. Web Software Developer

Basically I want to know what each of those title means? What would be other names for people who develop websites using php and mysql? ...

MySQL SELECT question.

How do I select the id, user_id specifically from the comments table and how do I select username, date, posts from the users table specifically? here is the code. SELECT users.*, comments.* ...

MySQL Query problem.

I can't seem to get this query to work can someone help me fix it. Here is the MySQL code. SELECT users.(user_id, pic, first_name, last_name, username), comments.(id, user_id, date_created) FROM users INNER JOIN comments ON users.user_id = comments.user_id WHERE comments.user_id = '$user_id' GROUP BY comments.date_created ...

php mysql if sum not working

trans_id trans_product trans_user trans_date trans_date2 trans_description trans_inventory 13 6 1 1278604284 1278547200 -1000 9 5 1 1278601462 1278547200 New Arrival 200 11 7 1 1278601743 1278547200 ...

PHP-MySQLi connection randomly fails with "Cannot assign requested address"

Since about 2 weeks I'm dealing with one of the weirdest problems in LAMP stack. Long story short randomly connection to MySQL server is failing with error message: Warning: mysqli::real_connect(): (HY000/2002): Cannot assign requested address in .. The MySQL is on different "box", hosted at Rackspace Cloud Today we downgraded it's v...