mysql

MySQL Insert Query Randomly Takes a Long Time

I am using MySQL to manage session data for my PHP application. When testing the app, it is usually very quick and responsive. However, seemingly randomly the response will stall before finally completing after a few seconds. I have narrowed the problem down to the session write query which looks something like this: INSERT INTO Session...

Web Application Benchmarking

I have a web application written in PHP using MySQL that I would like to test to see how many users it can handle, how much activity, etc. What method should I use to do this? ...

No Exact match when using LIKE in SQL statement

SELECT bp.*,r.rating,COUNT(r.review_for),bp.business_name,bp.profile_member FROM ibf_business_reviews r LEFT JOIN ibf_business_profiles bp ON ( r.review_for=bp.profile_member ) WHERE bp.sub_category LIKE '%{$id},%'{$location_sql} GROUP BY r.review_for HAVING COUNT(r.review_for) >=1 ORDER BY r.date_posted DESC LIMIT 0,2...

Load Spikes on a Apache MySQL Server with Wordpress MU

Hi there, I am trying to investigate the reasons for some mysterious load spikes on a Linux Apache server (2.2.14) running PHP 5.2.9 on a dedicated server with enough processing power and memory. My primary web application is a Wordpress MU (2.9.2) installation. I have investigated and ruled out DOS attack, MySQL or Apache configuratio...

SQL query determine stopped time in a rnge

hi i have to determine stopped time of an vehicle that send back to server its status data every 30 second and this data store in a table of database, the fields of a status record consist of (vehicleID,RecieveDate,RecieveTime,Speed,Location). now what i want to do is, determine each suspention time at the point that vehicle spee...

java - POST vs JDBC

OK so here's the code: import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; public class Main { public static void main(String[] args) { try { URL my_url = new URL("http://www.viralpatel.net/blogs/"); BufferedReader br = new BufferedReader(new InputStreamReader(my_url...

Query in sql involving joins of two table

EDIT 2 I have two tables reports and holidays. reports: (username varchar(30),activity varchar(30),hours int(3),report_date date) holidays: (holiday_name varchar(30), holiday_date date) select * from reports gives +----------+-----------+---------+------------+ | username | activity | hours | date | +----------+--------...

Can't fill a column of NULLs with actual values by making an association to the proper values in the reference table.

I have a table with separate columns for months, days and a varchar column for 6 hour increments for each day ('12AM', '6AM', '12PM', '6PM'). There's also a column that's supposed to have calculated numeric values for each of those 6 hour increments. These calculated values come from some reference table. This reference table contains va...

how i group do this mysql query

i want to make charts system and i think it must be like that 1 jan 2009 = 10 post 2 jan 2009 = 2 post 4 jan 2009 = 10 post 6 jan 2009 = 60 post and i have posts table that has id,user_id,date how i can select from posts to show it like that ...

mysqldump command not working?

I am using mysqldump to take backup of my database, but the command is not working.. the command i am using is mysqldump -u root dbname> 'c:\backupdatafolder\backup.sql' i am running this command in MySQL cli but not running,..is there any thing wrong in the command? ...

Can't use MySQL extract() function in the WHERE clause.

I've run the following query: UPDATE main_table, reference_table SET main_table.calc_column = (CASE WHEN main_table.incr = "6AM" THEN reference_table.col1+reference_table.col2+... WHEN main_table.incr = "12AM" THEN reference_table.col7+reference_table.col8+... WHEN main_table.incr = "...

uploading file size

As we all know, By default in PHP+MySQL, we can upload a file of size 1.4MB (max). 1) My Question is how can i increase the limitation of this uploading file size? 2) What is the maximum limitation for file to be uploaded in database? Thanx for viewing my query and special thanx for answering my questin. ...

Read binary data from a MDB-file running under LAMP

I need to be able to connect to an MDB-file in a LAMP-environment (running on Linux) and ultimately insert converted data into a Mysql db. The data I need to access is stored as a BLOB (Long Binary Data according to Access) in the MDB file. I have not yet been able to actually have a look at the data but I have been told that the BLOB ...

inserting datetimes into database using java

Hi, I am wanting to insert a datetime into a MySql data base using Java and a prepared statement: Calendar cal = Calendar.getInstance(); PreparedStatement stmnt = db.PreparedStatement("INSERT INTO Run " + "(Time) VALUE (?) "); stmnt.setDate(1, new java.sql.Date(cal.getTime())); stmnt.executeQuery(); N...

connect to mysql server using realbasic

Hello, tried connecting to mysql server in realbasic using the folowing code: dim db as MySQLCommunityServer db=New MySQLCommunityServer db.host="192.168.240.129" db.port=3306 db.databaseName="test" db.userName="test" db.Password="test" If db.Connect() then txt1.Text = "Connected" else txt1.Text = "Connection ...

Best way to fetch last 4 rows from a result set using mysql

Can any one please let me know, that, i need to fetch last 4 rows from a result-set using mysql. The result-set returns totally 6 records. but, i need the records to be fetch from last4...i.e, Record-3 Record-4 Record-5 Record-6 ...

How to run a set of SQL queries from a file, in PHP?

I have some set of SQL queries which is in a file(i.e query.sql), and i want to run those queries in files using PHP, the code that i have wrote is not working, //database config's... $file_name="query.sql"; $query=file($file_name); $array_length=count($query); for($i=0;$i<$array_length;$i++) { $data .= $query[$i]; } echo $data; ...

Web page database query optimization

I am putting together a web page which is quite 'expensive' in terms of database hits. I don't want to start optimizing at this stage - though with me trying to hit a deadline, I may end up not optimizing at all. Currently the page requires 18 (that's right eighteen) hits to the db. I am already using joins, and some of the queries are ...

SQL validation!

I am pretty new in SQL so this may be a stupid question... I have a form in PHP which fills in few fields in my SQL table. I have this code: $sql="INSERT INTO $tbl_name (app_name, app_path, short_desc, full_desc) VALUES ('$_POST[app_name]', '$_POST[app_path]', '$_POST[short_desc]', '$_POST[full_desc]')"; But even app_name and app_pat...

How to optimize this MYSQL table?

This is for an upcoming project. I have two tables - first one keeps tracks of photos, and the second one keeps track of the photo's rank Photos: +-------+-----------+------------------+ | id | photo | current_rank | +-------+-----------+------------------+ | 1 | apple | 5 | | 2 | orange | 9 ...