mysql

Getting the actual (absolute) execution time of the last query in PHP (excluding network latency etc)

I want to get the actual Mysql query execution times while they run in my project so running PHP microtime() before and after and subtracting won't work. When we run a query in command line, the result displays the timing information something like this:- xxx rows affected in YY sec How to get the same time information using PHP. I s...

SQL queries result size - does it matter much?

Hi, I have an sql query (MyQSL DB, using .Net's SqlClient) that returns a dataset. If the dataset's size is 4000 rows long or it's 20, is there a significant difference in runtime? Also, how much of the query's execution time is spent in opening a connection etc. comparing to the time to fill the results' table? Thanks. Clarification ...

Unsure how to join tables 3 times to get the desired result

I am trying to put together a query that gives me a report of number of sales of products and their stock level in 3 seperate locations (store branches) The idea is to group together the results as follows: Prod. | Loc1 Sales | Loc1 Stk | Loc2 Sales | Loc2 Stk | Loc3 Sales | Loc3 Stk Item 1 | 323 | 34 | 23 ...

Mysql function to generate millisecond precision timestamp as a BIGINT(13)

I am aware that mysql does not support storing timestamp columns with millisecond precision. My question: is there a mysql function I could write that will output the current time as a BIGINT(13) to millisecond precision. For example, as now() outputs a timestamp: mysql> select now(); +---------------------+ | now() | +-...

Is there a hosting that is best suited for Symfony deployment?

Hi all, I'm going to put a new application I created the last few weeks in production. Is there a hosting company that is best for Symfony or doesn't that matter at all? Or are there hosting companies you recommend or don't recommend in my case? It's a very small application written in php (Symfony 1.4) and a db mysql with phpmyadmin. ...

PHP echo() MySQL result containing <> characters?

I am retrieving data from my SQL database... data exactly as it is in the DB = (21:48:26) <username> some text here. is it ok? when i try and echo $row['log']."<br>"; it displays it as = (21:48:26) some text here. is it ok? i assume this is due to the <> brackets making it think its an HTML opener... would this be the case? and if so...

How to install rails 3.0 on Redhat 4.0 with mysql2 support?

When trying to install rails 3.0 on a redhat 4.0 server, the 'bundle install' fails during the installation of mysql2. Is it possible to solve this? 'bundle install' command returns the following output: ~/rails/trial# bundle install Fetching source index for http://rubygems.org/ Using rake (0.8.7) Using abstract (1.0.0) Using activ...

Size of database . PHP - MySQL

Hello. I want to know the size of my database using php. How to display the size in megabytes entire database? Size in megabytes a specific request? ...

Mysql command line restore error "The system cannot find the file specified."

Hey, Ive got a rather strange issue, ive got an automated build tool that is calling through to the mysql command line to teardown then setup a database from an SQL file. On one computer it is working fine, and its basically calling: Mysql -h {Connection::Host} -u {Connection::User} --password={Connection::Password} < {sqlFile} Ive j...

Ordering MySQL Query By Random and a Field?

I am trying to find a way to pull 10 random records and then order those 10 records by a field. I have tried the following: SELECT name FROM users ORDER BY RAND(), name LIMIT 10 but it does not order by name with 10 rows returned, just return 10 random record in any order. Is there a way to order by rand() and a field within a query ...

best E-Commerce Shopping Carts for Zend Framework developer

What is the easiest, most friendly and robust E-Commerce Shopping Carts for a Zend Framework developer. I want invest my time in somethink forward-looking. I'm also interested in a solution with a big tutorial base. It should be free. I found this solutions for PHP/MySQL : Magento Commerce Opencart PrestaShop OsCommerce Zen Cart Digis...

mysql count row occurances in a date range, but convert null to 0 so it shows

This is my current query SELECT DAYNAME(date_created) AS Day, COUNT(*) AS my_count FROM sometable WHERE (@date_created >= '2010-10-20 21:02:38' OR @date_created IS NULL) AND (@date_created <= '2010-10-27 21:02:38' OR @date_created IS NULL) GROUP BY DAY(date_created) It only returns data for that day if the count exists. I was muc...

In MySql is it possible to have tables locked with only SELECTs?

Is it possible that, using only query statements in my code (and not using select lock) I still get tables locked for some time because of the way MySQL does the processing? (for example, MySQL can lock while ordering the table, or something like that) Is this possible or selects just don't lock? ...

Is it possible to make "password" validation without refreshing a window?

Hello again, I've made a simple web application where a lot of things is done without refreshing a window. Now I faced a problem which I haven't realized before. If I won't find a solution, I'll have to redesign the whole app which will take a lot of time and probably kill some coolness of using it. Ouch. Ok, back to the problem. To re...

I need to strip dynamic information from a html/php file with PHP

Hi there, I have been trying to strip information out of a dynamically generated page and then insert the information into a database, this is only a one time thing. to explain the layout: I have a list of 700 IP addresses in my database currently but they have no location linked to them, I am using the following code to retrieve the ...

sql caching disadvantage?

Hi. I have a web server with a lot of web sites with many database operations, and i am tryng sql caching as a way to improve the performance of my server. In general, is there any disadvantage about sql caching in a common environment? Thanks ...

mysql returns not exact value in max function when dealing with floats?

Look at this query please SELECT max( val_amd ) FROM `best_deposits` I have the max value in the table equal to 14.6(the fields has type float), But it returns 14.3599996566772 why does it happen, and how can i get the exact value? Thanks much ...

update a field to null or delete row if another field is null MYSQL

I am looking for the most efficient way to update a table in the following way. If field A has a value in it and the contents of field b are being removed (null)then just update field b to null If field A has no value in it and field b is being updated to null then delete row. I'm a MYSQL newbie and am aware of insert/update/delete bu...

How should I structure my MySQL database?

Hi all! First of all, sorry if this might be a stupid question. I'm very new to the world of MySQL, so... Anyway, my question is this: I'm planning on having a database that deals with (for now) two types of users, let's say Admins and Users. My aim is to have ONE table containing all users, aptly named "users". Below is a rough outlin...

Why are two separate MySQL statements duplicating each other?

I've got a require file that I use to display random products. On the home page it gets used twice, once in the main content section and then again in the sidebar. The problem I'm having is the second require doesn't overwrite the first sql results, it adds to them? The results I'm actually getting for the 2nd set of results are the 1st...