Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MYSQL


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Room Reservation: See If A Time Period Is Open For A Particular Room...


this is stumping me...

i need to see if a time period is available for a something (in this case a room reservation).

it's not as simple as starttime < end and endtime > start...

for example a room is scheduled from 12:00 to 1:00pm and from 2:00 to 3:00pm.

how can you check if a user entered: from 1:00pm to 2:30pm?

i'm trying to UNION but that doesnt seem to work.

subselect?




View Complete Forum Thread with Replies

Related Forum Messages:
Time Based Reservation System - Only 1 Query Should Succeed
a user can select a time they want and submit the page

* The code selects all the bookings for a range of time.
* It then counts how many concurrent bookings there are for each hour.
* If there's less than the total (4) it inserts another row ( the user's requested booking ) into the booking table.

We also notify people if there has been a cancellation

This has led to a situation where a few different people are trying to book the same session at the same time, and succeeding!
We've ended up with 5 sessions booked

In the course of 2 page requests this seems to happen:
User1 - submits their booking
site selects to see if there's availability ( there is!)
User2 - submits their booking
site selects to see if there's availability ( there still is!)
site inserts User1's booking
site inserts User2's booking

View Replies !
Time Period Results
Can anyome tell me the php script to return data from a table which is less than 24 hours old. I have a timestamp on my table when data is added.

View Replies !
Dumping Data From A Certain Time Period
Every time I make changes to my MySQL database on my local PC, I have to dump the whole table on the server. This can get a bit annoying when the table contains thousands of records.Is there a way for MySQL to log all the updates you've made since a certain time and then use this file to dump it on the server?

View Replies !
Removing Data After A Certain Period Of Time
What I want to do is run a query that inserts data into my database, but removes itself on a set date. Is there any way to do this?

Basically, I have something like this:

INSERT INTO table (blah, blah2) VALUES (blah blah, 1)

I would like to do something like:

INSERT INTO table (blah, blah2) VALUES (blah blah, 1) {{{ INSERT CODE TO MAKE VALUES GO AWAY WHEN CURRENT TIME = SET TIME TO GO AWAY }}}

There is an alternative to this if I have to. This is all for a PHP script, and instead of having MySQL automatically remove the data, I could add a time to remove to the table, insert the value for it in the INSERT query, and run a query on the index page consisting of something like

<?php
$timeToRemove = SELECT_TIME_TO_REMOVE_FROM_DB;
if($currentTime => $timeToRemove)
{
REMOVE;
}
?>

so that every time someone hit the index page, it checks if it is time to remove the values from the DB and if it is, it does so. But of course, that adds an extra query/queries, and I'd like to avoid that.

Edit: It may be useful to note that this is for a message board system, and I am dealing with making usergroup changes temporary. So instead of removing the values, perhaps it would be more useful if I could simply have MySQL reverse itself after a certain time has passed.

But that seems unrealistic for some reason now that I think about it, so the alternative may be my best choice. Any suggestions from you all would be nice as well, if you've any ideas.

View Replies !
Generating DAILY Min&amp;Max Over A Period Of Time, Based On A "DateTime" Field
how to print the minimum and maximum of a specific field, between two datetimes (both having the time 02:00:00) - so I did this:

WHERE ((tblvalues.dtLPDateTime)>="2006-01-01 02:00:00" And (tblvalues.dtLPDateTime)<"2006-01-03 02:00:00"))

Now I want to print those min and max values but for each day in this cycle, i mean, for this example, there would be two records like:
Day Min Max
2006-01-01 02:00:00 -> 2006-01-02 02:00:00 | 40 | 59
2006-01-02 02:00:00 -> 2006-01-03 02:00:00 | 49 | 68
where at this point i`m getting min=40 and max=68

View Replies !
Open And Close Time 2000 Kills The Connection
I am moving some data from a text file into mysql and my code in c# using ODBC fails.

Actually I created a loop to test mysql and realized that mysql goes banans when

for(int i=0; i < 5000; i++) {
connection.Open();
connection.Close();
}

This code is for illustration purposes ONLY but it should work!? When I reache around 2000 the connection.Open() loses the connection to localhost and terminates the program! After a minute I can get access to mysql again? Inserting a delay of 100ms seems to keep things going.

View Replies !
Display Period In Month Into Period In Year And Month
If i've below table,
NoOfMonth
------------
9
12
36
16
...

How to query to make it my result as follow,
NoOfMonth | Period_InYear | Period_InMonth
-------------------------------------------
9 | 0 | 9
12 | 1 | 0
36 | 3 | 0
16 | 1 | 4
...

View Replies !
MySQL Reservation
I have a products table that has a bunch of products, and I need a query that will query another table and find out if there are any reservations for the project during a set period.

For instance, I have three things:
1. Car
2. Boat
3. Toy

The boat is reserved on 2-12-07 to 2-16-07 and the others are not reserved. I need a way to do it in one query if I give to days to query another table to just see if there is a reservation for that time period.

If I type in 2-10-07 to 2-15-07 I should find the Car and Toy unreserved, but the Boat reserved. I know I can do a loop, but when I have 131 products, its alot of queries to access the database.

View Replies !
Autoincrement 'prediction'/reservation
We have a piece of code that 'predicts' the next order number, simply by adding one to the last one (it's an autoincrement key).
This just about works in basic testing, but rashly presumes that the customer you give the number to will complete the secure payment page and commit his order before we try to 'predict' a number for anyone else.
The obvious solution is just to have a separate table containing the next number, increment it when we predict, and use the predicted number when we commit.
Obviously we'll get holes (when someone fails to commit) - this is not a problem.
Is there a better solution in mysql ? I'm thinking of some kind of 'reserve' functionality. I can't find anything in the manuals, apart from the discussion of startup, which suggests reserve isn't possible (it determines the next value from the existing values).

View Replies !
Add A Period 5 Places From The Right?
I'm trying to modify some latitude/longitude columns which have the values like:
3482787, -11782842

They're stored in text fields currently. I basically just need to put the decimal in the proper place, which should always be 5 places from the right, so i need to make the above value (and the other 6.3 million rows) look like this:
34.82787, -117.82842

I cant seem to find the function syntax to do this in MySQL, tho I'm sure it exists. I dont want to write a PHP script to do this because it seems like PHP chokes on me if I work on more than 500 thousand rows at a time.

View Replies !
Grouping By A Date Period
Let's say I have a table with dates that range from January to May in each record.
Is it possible to group the records by a date range, for example:

I want to group the records by a date period of 1 month, starting at the 3rd day of each month. So what I'd want to see is, five records for each month (jan 3 to feb 3, feb 3 to march 3, march 3 to april 3, april 3 to may 3).At the moment I have the following:

select id, _date, sum(cost) from test
where
_date >= ' 2005-01-03' and
_date <= date_add('2005-01-03', interval 1 month)
group by extension
union
select extension, _date, sum(cost) from test
where
_date >= date_add(' 2005-01-03', interval 1 month) and
_date <= date_add('2005-01-03', interval 2 month)
group by extension

The trouble with this is that each month interval has its own select query and that the increase in the month is hard coded (interval 1 month for example). Is it possible to use SQL to inrement the month?

View Replies !
Selecting First Occurance In A Given Period Of Record
I have a table to log sessions and user (connect_id) id's, start time etc - see below

+---------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------+-------------+------+-----+---------+-------+
| connect_id | varchar(12) | | | | |
| session_id | varchar(32) | | | | |
| start_time | int(11) | | | 0 | |
| client_ip | varchar(16) | | | | |
+---------------+-------------+------+-----+---------+-------+

I need to create a report that will tell me, for instance, how many sessions were started today, that's easy I know but I also need another report that will tell me how many of those sessions were
first-time visitors.

View Replies !
Date Calculation For 24 Hour Period
I would like to automatically get the number of assignments received between a 24 hour period for the past 8 days. I am using

"where received >= date_add( now() , interval -1 day)" to get yesterdays assignments....

View Replies !
Select And Displaying 90 Day Interval Over A Period
SELECT DATE_ADD('2008-09-07', INTERVAL 90 DAY)

What I'm basically after is to display a range of dates with a 90 day interval till a given date. As per the nultiple select statements below.

SELECT DATE_ADD('2008-09-07', INTERVAL 90 DAY)
SELECT DATE_ADD('2008-12-06', INTERVAL 90 DAY)
SELECT DATE_ADD('2009-03-06', INTERVAL 90 DAY)
SELECT DATE_ADD('2009-06-04', INTERVAL 90 DAY)
SELECT DATE_ADD('2009-09-02', INTERVAL 90 DAY)
SELECT DATE_ADD('2009-12-01', INTERVAL 90 DAY)
SELECT DATE_ADD('2009-12-01', INTERVAL 90 DAY)

View Replies !
Selecting First Occurance In A Given Period Of Record (log Sessions And User)
I have a table to log sessions and user (connect_id) id's, start time etc - see below ...

View Replies !
PHP/MySQL Sorting By Date & Time (using Non Military Time)
This is probably a simple issue but I have searched online and can't find an answer.

I am using PHP/MySQL and I guess the most intuitive would be to have three select boxes containing HOUR / MINUTE / AM,PM option. Then store the time into mysql using there functions so I can output the data sorting them all by date and time. All the examples I have seen are for military time only but I'm sure there has got to be a simple mysql function or php function that converts non military to military and a formatting function to display with the AM / PM. But I have not found it.


View Replies !
Compare Time Posted With Current Time Not Working
May I know how to get records with interval of 1 hour in database where the posting time is in this format '2008-05-15 00:10:40'

I tried with this :

$query="SELECT date,name FROM message WHERE (timediff(date,NOW())<=CRUDATE() CURTIME())";

But is not working. May I know what is the correct way of doing it?

View Replies !
Different Timestamps For Time Of Creation And Time Of Update
What is the syntax to be used in MySQL when you want one timestamp to be set when the record is created, and the other only when it is updated?

I tried something like that but got a syntax error.

View Replies !
Open Db
When I open Mysql, I see the command line, although I see no commands for opening a db. Likewise, I cannot find anything in the help file..... Double clicking on the file does nothing...

View Replies !
How To Open My.cnf?
!I would have some configuration need to be done in the file of my.cnf in xampp.However it showed as a SpeedDial in Windows,how can I open it?

View Replies !
MAX OPEN CONNECTIONS
My site has available by default 15 connections to MYSQL. Many connections remain open for much time, so when a new user enter the page it shows a message UNABLE TO CONNECT TO DB. How do I avoid this, without need change the number of connections of the server?

View Replies !
How Many Connections Are Open?
We have a large database that has suddenly become extremely slow. It is running on Fedora core 4. How can I find ou thow many connection are open?

When I look at CPU usage thru CPanel this appears to use a lot of CPU, sometimes over 90%

/usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/mail.realivent.com.pid --skip-external-locking

View Replies !
Connection Take 30 Sec. To Open
I am using the ADO.Net Provider from mysql and the connection takes *forever* to open. Well maybe not forever,but it takes 30 seconds.And each time I modify my *.aspx page I have to wait another 30 seconds to see the result.

View Replies !
No. Of Connections Open
I am using mysql 4.0.12 with asp.net 1.1...

I want to find no. of connections open for a given database using any query...

Do anyone has any idea?

View Replies !
Open Second Database
i have a db opened and run sql with
mysql_query($query)

now what I want to do is open a second database -- run one sql insert statement and close the db.

View Replies !
Open MySQL Files
Is there a danger limit to how many often used files (tables) mysql can have open.
I currently run mysql and it has about 3000 tables total, thats 9000 open files in total if you cound 3 files for each table.

View Replies !
Can't Open File (errno :1)
I'm doing a project with Visual Studio.net with database(there's 4 tables inside it)on MySql.But I'm having problem connecting them both..I've done the programming codes but when I try to open my database in QueryBrowser.it says "can't open file (errno :1)" n below it would be "A MySql error was encountered. The message is : cannot fetch table information. The following error occured. Can't open file".

It's the same with Visual Studio.net whenever I execute it..it says "type mysqlconnection/mysqldatareader is not defined"

View Replies !
List Open Tables
I have been having trouble with the number of open tables in my mysql database. I have mysql 4.1.18 running on Windows Server 2003.

Basically, I have a few instances of PHP-Nuke running, and a version of Xaraya, and some other handwritten apps.

Lately I have been having trouble with the number of open tables. Sometimes it reaches close to 500 and they don't go away or close themselves. Is there anyway using MySQL Administrator to view a list of currently open tables so I can see what is in use?

View Replies !
Number Of Open Connections
our J2EE application opens connections to a mysql server.
I would like to know how can I use the mysqladmin (or any other tool) to get (at a given time) the number of open connections.

View Replies !
Can't Open Priviledge Tables
Trying to get mysqld running on my Slackware 10 machine and seeing the following error:

Fatal error: Can't open priviledge tables: Table 'mysql.host' doesn't exist

Any ideas?

View Replies !
Open Additional Port
I need to access an external MySQL db through a firewall. I'd like to open up an additional port (leaving 3306 as is) to the same MySQL instance.
For example, I have my mail server running on both ports 25 and 26 (ISP blocks outbound 25).

View Replies !
Mysql On Open SUSE 10.2
I installed open SUSE 10.2 and it works fine.
I tried to look at Mysql. No it didn't work.
---------------------------------------------------

niss@linux-flei:~> mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
niss@linux-flei:~> show databases;
bash: show: command not found
niss@linux-flei:~>

View Replies !
Open Session From Client
I have Mysql running fine on a Linux box. From host I can run mysql and mysqladmin without problems (MySql root user hasn't password yet).

Now I would like to execute some sql commands from MySql administrator running on a windows PC. but when I tried to open the connection the error 1130 appears. What can I do to do SQL queries from Windows (or any other supported OS) to MySql server?

Host server has firewall disables (to avoid any problem).

View Replies !
Database Won't Open Anymore
Then I downloaded Xampplite and am running Apache and MySql (same version as previous)so I can see the php stuff I am adding without having to publish remotely every time.

I moved my database to the new MySqlData directory.

I can see the database/table, but can't open it.

the previous MySql has a password to access, now it goes straight in.

Is this the issue?

View Replies !
FD Still Open But Files Are Deleted
on 2 of my servers running mysql 5.0.67 . File descriptor remain open while the files are deleted. After a while it fulls my /tmp .

Filesystem Size Used Avail Use% Mounted on
/tmp 9.9G 1.1G 8.3G 12% /tmp

[root@maestro tmp]# du -sh .
14M .

[root@maestro fd]# /usr/sbin/lsof -s +L1 /tmp/
COMMAND PID USER FD TYPE DEVICE SIZE NLINK NODE NAME
cmasm2d 4464 root 3r DIR 253,5 0 0 145363 /var/spool/compaq/hpasm/registry/crib (deleted)
cmasm2d 4469 root 3r DIR 253,5 0 0 145363 /var/spool/compaq/hpasm/registry/crib (deleted)
mysqld 5648 mysql 6u REG 253,3 10599 0 20 /tmp/ibF3ScMx (deleted)
mysqld 5648 mysql 7u REG 253,3 0 0 21 /tmp/ibIOB0yu (deleted)
mysqld 5648 mysql 8u REG 253,3 0 0 22 /tmp/ibt1wOlr (deleted)
mysqld 5648 mysql 9u REG 253,3 6646 0 24 /tmp/iblKFAsp (deleted)
mysqld 5648 mysql 18u REG 253,3 0 0 25 /tmp/ibSG0pXV (deleted)
mysqld 5648 mysql 32u REG 253,3 18974469 0 31 /tmp/MLG5sFxo (deleted)
mysqld 5648 mysql 36u REG 253,3 17973782 0 32 /tmp/MLgMLlfs (deleted)...

View Replies !
Open A File In The Database
i would like to load data in my database from a file and i do:

mysql> SOURCE "C:Documents and SettingsuserDesktopcreate_sql.txt";
ERROR:
Failed to open file '"C:Documents and SettingsuserDesktopcreate_s
ql.txt"', error: 22
mysql>

It's just that i would like to create a table using a file.The file already consists of statements like :

create table Store(sid integer,
address varchar(20),
eid integer,
name varchar(20),
primary key (sid));

What am i supposed to do in order to create tables using a file?

View Replies !
Open Local Database
I have a file called local.db. I suspect that this is a MySQL database. How do I verify this and how do I open it? I have installed the Administration tool and the MySQL server database on my local machine.

View Replies !
How Do You Open Mysql To Outside Connections?
I have a DB server and an APP server.

I am trying to open MySQL on the DB server so the APP server can connect to it.

I did the command:

GRANT ALL PRIVILEGES ON *.* TO 'USERNAME'@'%'
IDENTIFIED BY 'PW' WITH GRANT OPTION;

However, it still won't connect.

View Replies !
Failed To Open File
I get the error failed to open file and then the filename.. wondering how do I get the file to open / where do I stick files to open them.

trying to create the database from script file. I used:
source create_dd_database.sql;

also tried:
source . mysqlcreate_dd_database.sql;

the file is currently in c:mysql

I don't get how to specify for it to look in the c:mysql directory for the create_dd_database.sql file.

View Replies !
Can't Open Mysql Table
I can no longer open one of my tables. I get this error:

Can't open file: 'top_horses.MYD'. (errno: 144)

When I view all my tables, this particular tables says "in use".

I think I inadvertently clicked on "repair" table.

View Replies !
Connection Must Be Valid And Open
I am getting an "Connection must be valid and open" error. After some
research I have found two possible reasons for this: malformed sql or bad connection string. Since the error is being thrown on a second .executescalar statement I will assume the connection string is working. I have two questions. First - if I can cut and paste the sql
statement into mySql's query browser and it returns the information, is the sql malformed? (e.g. select user_id from cms.accounts where
user_id='scott@scottrider.com') Next - are there other reasons for the error message.

View Replies !
How Can I Open MySQL Shell
I want to see shell in following stage:

Code:

View Replies !
#1016 - Can't Open File
one of our client was working on a stsyem when suddenly they cant insert any record. they gave us a copy of their livedatabase and when i studied the database, the table concerned was "in use". when i try to repair it, optimize or whatever, it returns an error

#1016 - Can't open file: 'license.ibd' (errno: 1)
i research a bit but i cant see a proper tutorial in repairing this error. the database is in myisam, so i dont have any *.ibd file in my database directory. other tutorials on how to solve this covers recovering the table, but i cant see how their solutions can recopver the data itself.


View Replies !
Mysql.exe Will Not Stay Open
I'm trying to install MySQL and PHP on my Windows XP computer.

I have followed Kevin Yank's book, followed another tutorial, reinstalled Windows XP twice on this machine, installed MySQL and PHP many times (after uninstalling). I've tried installing on an other machine.

"Dr. John" and "Mainlink" suggested that I "use xampplite to install apache, mysql, php etc" - I tried this, after a reinstalling Windows XP.

All works well, including the PHP test ("today.php"), till I try to open "mysql.exe". The "command prompt/dos" window flashes up, then disappears immediately.

Can anyone please point me in the right direction?

View Replies !
Open Source Question
We are in the process of designing and building an application to collect a relatively small amount of discrete data (less than 100 data elements) from a potentially large group of industrial facilities. This system needs to be Open Source so other organizations can use the application by simply "plugging" in the app to do authentication/authorization (Open LDAP?) with a home-grown security design, access a web app (J2EE & probably Linux O/S), and MySQL as the backend. Certainly it's more complicated than what I describe, but I have my doubts of the capabilities of MySQL to be "robust" (yuk, I hate that word) enough to handle the potentially large number of simultaneous connections, among other issue including remote connection to Oracle DBs. I'm new to the organization and my boss's boss is the driving force behind the development. He's gung ho to get it built, but (beyond the political nightmare) I would like to "caution" him that the chosen platform is suspiscious at best.

View Replies !
Minutes + TIME = TIME Function
I need some way to convert minutes (e.g. 80 mins) to SQL TIME (e.g. 01:20:00) in order to add it to another TIME var.

Is there any way to do this? I really dont want to convert my whole db. Basically, I want to do: e.g. 80 + 10:00:00 = 11:20:00.

View Replies !
How To Retrieve Mean Time Between Time Stamps
I have a table that stores failure information of external application. The time stamp of every failure event is stored. Now I'd like to make some system performance & reliability statistics calculations based on time stamps in certain recordset; mean time between failure MTBF, down time DT, etc.

Example:

2007-09-27 12:23:52
2007-09-27 08:50:23
2007-09-26 23:31:34
2007-09-26 21:45:33

Here the times between are (hours:mins): 3:33, 9:18, 1:46 and MTBF=4:52

Any effective possibility to make this example within a single query - or a procedure is needed?

View Replies !
Time Format Military Time
I know the time format it HH:MM:SS in mysql but can I input military time?
reason I can is that I want to later extract that information for calculations and military time is easier to work with.

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved