mysql

Are there any MySQL functions to get all rows with with a start or end date that fall between a given start and end date?

I have a table of events with a recorded start and end time as a MySQL DATETIME object (in the format YYYY-MM-DD HH:MM:SS. I want to find all events that occur in a specific date range. However, events can span multiple days (and go outside of my date range, but I want to return them if they even overlap by 1 second or more with my date ...

Best way store a date/time for different timezones

What's the best way to store timezone information with dates/times in a uniform way so people can enter times from anywhere in the world in their own local time? Other users would then have the ability to view the times in their own local time and the original localtime on the web page. ...

What are the technical considerations for running MSSQL and MySQL off the same Windows server?

Our application runs off MySQL, but a client has another application that requires SQL. We want to run them both on the same box. What are some technical considerations for this configuration... is this really just a matter of making sure there are no port conflicts? ...

PHP5: calling external functions, and logging errors

I'm painfully new to PHP, and was trying to set up phpBB on my local site. I have a stock debian install of apache2 and php5. The phpBB installer ran fine, connected to the database and created all its tables with no problem. But when I tried to open the login page, I got a 0-byte response. A little digging showed that it was never m...

How do I keep the variable value in a MySQL stored procedure from changing when records are updated?

I must be overlooking something simple. I'm setting a variable from a query result in a MySQL stored procedure like this: SELECT @myName := username FROM User WHERE ID=1; So, @myName is storing the username of userid 1, which is 'Paul'. Great. But later in the stored procedure I run an update on this record: UPDATE User SET username...

UTF-8 all the way through...

I'm setting up a new server, and want to support UTF-8 fully in my web application. I have tried in the past on existing servers and always seem to end up having to fall back to ISO-8859-1. Where exactly do I need to set the encoding/charsets? I'm aware that I need to configure Apache, MySQL and PHP to do this - is there some standard c...

Using MySql From .Net - Licensing Concerns

I am working on a project and trying to determine what platform to use. Right now, my first choice would be to use ASP.Net MVC with a MySql database. My concern with this is that the MySql drivers have a GPL license. I am creating this for a company and therefore it can't be an open-source project. Here are the questions I have: If I u...

multiple mysql_real_query() in while loop

It seems that when I have one mysql_real_query() function in a continuous while loop, the query will get executed OK. However, if multiple mysql_real_query() are inside the while loop, one right after the other. Depending on the query, sometimes neither the first query nor second query will execute properly. This seems like a threadin...

Persistent database connections in fastcgi

I'm porting an application from php to fastcgi (c). My host runs apache. Since the fastcgi app would be running in a loop, I could open a mysql connection, and leave it open for all incoming requests. Is this recommended? I think I've read about an equal number of opinions saying the connection is way more expensive than the request an...

mysql recursive update

Hi all I have two mysql tables, one containing details on cars and one containing all the possible models of the cars, as such: cars: car_id model [more details] models: model_id model_name Now, my problem is that the model details stored in the 'cars' table is the model_name, rather than the model_id which is what I want ...

MySQL collations not working as advertised in documentation

I'm trying to get my MySQL table to behave as the utf8 table in Example 2 from this MySQL Reference page: CREATE TABLE germanutf8 (c CHAR(10)) CHARACTER SET utf8 COLLATE utf8_unicode_ci; INSERT INTO germanutf8 VALUES ('Bar'), ('Bär'); SELECT * FROM germanutf8 WHERE c = 'Bär'; According to the example, this should yield: +------+ | c ...

Is there a way to bind an array to mysqli prepare

I'm trying to make a class that will execute any one of a number of stored procedures with any amount of variables Im using php and mysqli My class enumerates an array and constructs a string based on the number of elements if any giving something like this CALL spTestLogin(?,?) for example I now need to bind the input from my array u...

Weighted Mean

I have an existing web app that allows users to "rate" items based on their difficulty. (0 through 15). Currently, I'm simply taking the average of each user's opinion and presenting the average straight from MySQL. However, it's becoming clear to me (and my users) that weighting the numbers would be more appropriate. Oddly enough, a...

ZRM snapshot vs InnoDB hot backup for MySQL

Are there major advantages to InnoDB hot backup vs ZRM snapshots in terms of disruption to the running site, the size of compressed backup files, and speed of backup/restore on a medium-sized to largish all-InnoDB database? My understanding is that InnoDB's approach is more reliable, faster, does not cause a significant outage when runn...

Does the MySQL TRIM function not trim line breaks or carriage returns?

From my experiments, it does not appear to do so. If this is indeed true, what is the best method for removing line breaks? I'm currently experimenting with the parameters that TRIM accepts of the character to remove, starting with trimming \n and \r. ...

How to increase mysqld-nt CPU usage

I have a pretty much default installation on mysql on Windows 2003. I am rebuilding some indexes and the process only seems to use 3-20% of the CPU. Is there a way to allow it to use more and speed up the process? ...

Query: count multiple aggregates per item

Often you need to show a list of database items and certain aggregate numbers about each item. For instance, when you type the title text on Stack Overflow, the Related Questions list appears. The list shows the titles of related entries and the single aggregated number of quantity of responses for each title. I have a similar problem b...

php access to remote database

Help! I have a PHP (PHP 5.2.5) script on HOST1 trying to connect to an MySql database HOST2. Both hosts are in Shared Host environments controlled through CPanel. HOST2 is set to allow remote database connections from HOST1. The PHP connect I'm using is:- $h2 = IPADDRESS; $dbu = DBUSER; $dbp = DBPASS; $DBlink = mysql_conn...

Using varchar instead of date field types in MySQL

Is there any reason to use a varchar field instead of a date field in MySQL? I'm looking at an existing site and I see the developer has done this. Is there any reason to? ...

can UPDATE clause in MYSQL using PHP update multiple records in one query?

well i have this messages table with sample values like these: msg_id recipient_id read locked new 0 1 N Y Y 2 1 Y N N ok, so lets just say this is a messaging table, and i want to reset all messages addressed to recipient with id=1 i was wondering why UPDATE `m...