How To Save Accounts Based On Variable Amounts Of Time
I'm currently building a website where users can signup for various accounts.
An account may last 30 days, 12 months or 24 months.
If a user's account is about to expire, an email notification is send, via a CRON Job.
I want to save the different account types in the database, but I'm not sure how to save the duration of an account. If it was all months, I could simply save ཈' or པ' as an INT, but it also has an account for 30 days, which is more flexible.
Edit:
It would also be nice if I could ORDER BY duration..
View Complete Forum Thread with Replies
Related Forum Messages:
Adding Amounts Of Time
I am looking for a way, as the title suggests, to add a length of time to a time-type field.I needed to type something, and this is what I logically typed (of course, incorrect): SET playtime=playtime + '$length' Let's say playtime = 00:10:30, and $length = 00:04:30. What do I need to change the above statement to, so that the new value of playtime = 00:15:00 ?
View Replies !
Selecting Based On Time Range
I'm writing a series of queries on a transactions table. I'd like to find all transactions from: Today Yesterday Last Week Last Month This Year The table contains a datetime field called txn_timestamp. What is the appropriate code to filter the table for each time window? SELECT transaction_id FROM transactions WHERE <?>
View Replies !
GROUP BY Date With Variable Is Unix Time
I am saving the Unix time every time a record is created in a field called "Time" and would now like to write a report to group on Date ... is there a in-built function to do this .. SELECT * FROM tblTemp GROUP BY [Date] ?
View Replies !
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 !
Generating DAILY Min&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 !
Mammoth Amounts Of Self Joins
I have a table that contains keywords (Varchars) each one mapped to a product. so the database schema is just an id column, product column and keyword column. I want to select the products that contain x,y,z keywords. Now if this query involves many keywords I end up with a massive amount of self joins on the keywords table, is there a better way to do this than self joins? What would work perhaps is multiple unions where I could discard non duplicated rows but you can't seem to do that. Any ideas... ?
View Replies !
Import Large Amounts
My client has a large database in MS Access. I need to put a section of this (approximately 900 rows) into MySQL to be displayed on a website. The thing is, every month I will be resupplied with updated data, which will need to replace the data that is currently in the SQL database. I am operating on a Mac and they've given it to me as an EXCEL spreadsheet, which I am trying to import into MYSQL using phpMyADmin with no luck. I've tried exporting from EXCEL to various formats, such as CSV, but I can't seem to get it to import into the MySQL database Does anyone know what I can do? I need it to be relatively simple so that every month I can simply reimport the new data. Is there some trick to importing the data from EXCEL, or should I ask the client to supply the data from MS Access in a different format.
View Replies !
Getting The Sum Of Amounts For Each User - How To Join?
I have a simple table for transactions that will store information like a bank account. To find the balance for a given user I want to sum all the amounts and display the result How can I do this for more than one user at a time? CREATE TABLE `transactions` ( `id` int(5) NOT NULL auto_increment, `user_id` int(10) NOT NULL default Ɔ', `created` datetime default NULL, `modified` datetime default NULL, `description` text character set latin1 collate latin1_general_cs NOT NULL, `amount` decimal(10,0) NOT NULL, PRIMARY KEY (`id`), KEY `user_id` (`user_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 I'm hoping to get output like: user_id | balance(sum of amounts) ------------------------------------------ 1 | 70 2 | -70 3 | 10 4 | 5
View Replies !
Handling Large Amounts Of Text
I am desiging a web store to hold and manage up to 150,000 to 200,000 items and have run into a problem which I believe can be fixed but I am not sure about the way to go about it.The problem is that every product has a rich text description that contains a lot of extra HTML code that goes into the database with the product description. I would estimate every product has an average of 10k of description and code. Now instead of putting all of this into the database would it be possible to write this to a .txt file and keep it in a products_desc folder? Would this keep the database at a respectible size and optmize everything?Does anyone have any good examples or tutorials on going about this with PHP?
View Replies !
Inserting Large Amounts Of Data Into Mysql
I have a whole bunch of numbers and state, county, city, etc. data that i'm trying to load into a database for a demographics website. The data is all in excel currently so I could easily copy and paste it to a text file or another medium if necessary but I'm wondering what the quickest and most efficient way to get it all entered into mysql is.
View Replies !
Resetting User Variable Causes Variable To Not Hold Decimals
I am currently working on a query that makes use of user variables. I notice one small issue (bug?) depending on whether or not I reset a user variable with the "SET" command or don't before executing the query. When I do reset the user variables, some of my variables will not hold decimal points (7.56734234 gets turned into and stored as 7). However when I run the query afterwards without resetting the user variables, the correct value (with the decimal) is stored. Example with query: ..
View Replies !
Db Accounts
Does anyone know of a good isp where I can pay for just the use of a mysql database? I don't know when my provider (pair nwetworks) is going to upgrade and I absolutely need the latest version with unicode support as I need to have many different scripts in the same table.
View Replies !
Accounts
also, can someone please tell me what is the relationship/difference/similarity and interaction betweeen: 1.phpmyadmin login/access 2.mysql login/access 3.database login/access if a user signs up on my website, how can i give him a separate db automatically upon sign up, with default tables and access to only his db with his login username and password? also, before accessing his own db, will he connect to the mysql server using a diff p/w?..how exactly will it work?
View Replies !
MySql - Accounts
What privileges does a user need to be able to create new accounts? I have an account with all privileges including the grant privilege, but when I try to create a new user with this account, I always get an access denied error. I'm using an old mySql Version (3.22.32) and a windows-client with an ODBC connection. There is no problem to connect, select or update any data in my database, only with my superuser, only the creation of new user fail.
View Replies !
MySQL Accounts
When I installed mySQL I created administrator account with a different name to root and set a password. Having just had a look there's 5 accounts: root (host set to: localhost) root (host set to: %) localhost (host is blank) % (host is blank) my administrator account (host set to: %) Can I safely delete root, root, localhost and % accounts? All of my server applications user the administrator account I created.
View Replies !
Mutiple Accounts
I am looking for a solution for this and havent been able to find it anywhere i think i am searching for the wrong keywords or strings... i want to be able to allow users to create there own database's in there account but limit the database's that they can create to a prefix on every data base (diffrent prefix for diffrent users)Also is it possible they can create users that only have access to the database's in the master account?.i am trying to stay out of the admin role as much as possible it's just internal office applications that staff can use mostly a sandbox so security is not an issue.
View Replies !
MYSQL Password Accounts
I have been having problems with password accounts in MySQL. I'm setting up the environment for the first time. from the mysql website the intructions are to set the password on Windows: shell> mysql -u root mysql>SET password ......... My question is where do i access "shell>" to start off the code I have little expreience in writing in the command window so I do apologise if this question is overly remedial
View Replies !
User Accounts With Passwords
I am able to connect to the database using users that are not password protected. After updating privileges to use passwords and changing login info(in a php document) I recieve the following error from the php document: Warning: mysql_query(): Access denied for user 'ODBC'@'localhost' (using password: NO) in c:inetpubwwwrootgindex.php on line 9 Warning: mysql_query(): A link to the server could not be established in c:inetpubwwwrootgindex.php on line 9 I am attempting to connect as 'test'@'localhost' with the password 'test'. If I remove the password, I can connect no problem.
View Replies !
Setting Up New Mysql Accounts
I have followed the manual for MySQL 5.0 for adding new accounts to MySQL but it will not work for me. I am typing these commands on the root on the actual computer with Every time I input these following commands, the command just returns this: mysql> Query OK, 0 rows affected (0.00 sec) mysql> GRANT ALL PRIVILEGES ON *.* TO 'myusername'@'localhost' -> IDENTIFIED BY 'mypass' WITH GRANT OPTION; mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP -> ON mydatabase.* -> TO 'myusername'@'localhost' -> IDENTIFIED BY 'mypassword'; I've also tried this one mysql> CREATE USER 'myusername'@'localhost' IDENTIFIED BY 'mypassword'; But it returns mysql> ERROR (HY000): Opteration CREATE USER failed for 'myusername'@'localhost' .
View Replies !
User Accounts Not Recognized
I am the administrator and asks for my password (that's ok because I am the administrator). The downside is, no where did it ask me for a user name. I've tried using "root", because, well it is the root file and I am the administrator. Just to test this out, I set up another account and password. MySQL acknowledged it and going through and being set up correctly, but I can't log on as that person or access it through PHP. I was reading in the reference manual that GRANT files should be automatically set up. When I go into my MySQL file,I don't see anything there regarding grants or privileges or users. When I start writing PHP to create and access databases, how will it recognize me if I never set up a user name? Perhaps this should be in the PHP forum?
View Replies !
Sum, Union And Balancing Accounts
One of my clients has a very complex accounts system, which has issues that I've been brought in to fix. The first stage I want to start with is a report showing which transactions don't balance. Code:
View Replies !
Setting Up Initial Accounts In MySQL
I'm a newbie to MySQL. In setting up my initial accounts, I see two anonymous users in the mysql database in the user table. My book says to delete them which I did, but I still see what looks like two root accounts. Is this normal? If not, which one do I delete? I see one doesn't yet have a password; should I delete the one without a password? First I'll log out and log back in as root to see if that other root user is a phantom or is really an account. Next, I'll need to add a few users, but I need to make sure this root thing is correct. Here's a screen shot of wht I did: mysql> use mysql Database changed mysql> select user.user from user; +------+ | user | +------+ | | | root | | | | root | +------+ 4 rows in set (0.02 sec) mysql> delete from user where user=''; Query OK, 2 rows affected (0.01 sec) mysql> select user.user from user; +------+ | user | +------+ | root | | root | +------+ 2 rows in set (0.00 sec)
View Replies !
Moving Data And Accounts When Upgrading
Before upgrading my directory structure looks like: /usr/local/myslq-4.0.21 /usr/local/myslq@ -> mysql-4.0.21 After I install an upgrade it looks like: /usr/local/mysql-4.0.21 /usr/local/mysql-4.1.12 /usr/local/mysql@ -> mysql-4.1.12 The upgrade instructions then say to run "mysql_fix_privilege_tables" but the privilege tables should not need fixing since the only thing in the mysql-4.1.12/data directory are the new "mysql" and "test" databases and they should not need fixing. Also none of my old user accounts and data are there. Am I supposed to do something to copy the old data directory to the new data directory and then fix the privilege tables? Something like "(cd mysql-4.0.21; tar cf -) | (cd mysql-4.1.12; tar xf -)"? Or should my data directory be independent of the mysql directory and used from each installation?
View Replies !
USer Accounts Creation With MySQL
I am trying to create a website that uses ASP.NET interfacing wth a MySQL database, this is more of a Design based question (I think!). I need users to automatically register an ccount online and create entries within the tables in a specific database. How do I manage this, do i have to create a new user each time by the query GRANT? If so I am planning to have many users logging in to a big table that has a lot of other data for other users (they will be identofoable by an ID column i.e Joe_Bloggs). what do I set as permissions to that particular table, as potentially they could change someone elses information. I may just need a pointer to how you actually go about designing a system as I have described and manage all the users information to allow a good level of security and scalability for expanding the application at a later date. Is it better just to create a new table within the databse each time a new user is created as that way I would be able to grant that particular table (i.e. Joe_Bloggs_Table) the correct permmisions.
View Replies !
Backup/restore User Accounts
I have mysql 5.0.14? installed. I need to make a fresh installation of 5.0.18 (no update). I can create a backup of my database (export) and import it into the new version. But how can I migrate my useraccounts? The probem is, I tried re-creating a user with same pwd in the new version, assigned privileges to that user and the user to my freshly imported database, but when trying to access the DB using a script, it tells me that "user" has no access.
View Replies !
Connect To Database With Passworded Accounts
I am migrating my databases from mysql 4.0.x to 4.1.7 and i'm having the following problem: When i create accounts with passwords, i can't connect to databases with them. It only works with non-passworded accounts. I tried to put old_passwords=yes in my my.ini file, but it didn't work.
View Replies !
Adding New User Accounts :: Access Denied
I have read Ref Manual 5.9.2 Adding New User Accounts and 5.8.8 Causes of Access Denied. I am running SUSE 10.1: /usr/sbin/mysqld Ver 5.0.18 for suse-linux on i686 (SUSE MySQL RPM) This works: mysql -u root -ppassword mysql Using user root, from Python I can access sql, add data to tables, etc. but I want to set up other users and access mysql from other than localhost. I tried this (as suggested in 5.9.2): mysql> GRANT ALL PRIVILEGES ON *.* TO 'pwh'@'localhost' -> IDENTIFIED BY 'password' WITH GRANT OPTION; mysql> GRANT ALL PRIVILEGES ON *.* TO 'pwh'@'%' -> IDENTIFIED BY 'password' WITH GRANT OPTION; But this happens: mysql -u pwh -ppassword ERROR 1045 (28000): Access denied for user 'pwh'@'localhost' (using password: YES) Ref man 5.8.8 says if all else fails, reinstall from the source. I started to do that but got stuck. I would rather not if it can be avoided.
View Replies !
Number Of User Accounts For Large Database
I have a large database (816 tables with 11 fields each, each field could hold up to 50 entires) and I'd like to know if each table should have its own user account (created in Cpanel and used in the config file to access the database). May sound like a simple question to some but I need to know in case we have a lot of traffic and 1 user account is not "enough" for all visitors to access the database info.
View Replies !
Most Efficient Way Of Storing Data From Multiple Accounts
As part of a system I am putting together I need to allow users to create thier own accounts on my servers. Each user can create their own account, and then have their users register for it. Each account needs it data seperate from the others, a member registered for one account should not be able to view another account and a username registered with one account should still be available to the other accounts. The ways I have been looking at are: 1. Create a new database for every account created so that all users are kept in seperate databases. 2. Have one table for users, one for topics, one for posts etc and then associate each row within this table with the relevent account. So for example a user could register with the forum with the ID 4, so their user entry would be Userid: 234 Username: xxxx Password: xxxx Forumid: 4 Then when a new member registers with any account I simply check that there is not another user with the same account ID and username. Indexes on relevent fields in this system could help speed up huge tables. I expect to quickly have 20,000 plus accounts (and in theory it could go up to hundreds of thousands). I guess my question is which of these methods is better from a speed point of view once we get a large number of accounts and users. Also, are there restrictions on the number of fields in a table that could cause problems? Using MySQL by the way, on an Apache server.
View Replies !
Why Dont Shared Hosting Accounts Provide Stored Procedures And Triggers?
i am searching for 3 days now for a reliable, fast hosting company, which supports stored procedures and triggers on mysql5. most of them dont support this, because mysql5 has a design-flaw in which it stores procedures and triggers on a root level-area (tables mysql information_schema). due this logic, most of the hosting companies wont allow you to create/run procedures and triggers. funny, that hosting companies forbid you to use new technologies and methods to build faster.
View Replies !
Save Changes
I'm working on a membership database (MySQL 4.1) with about 350 members. The client wants every change made to be recorded so that there is a record of what was changed. So they want what row was changed, what was changed within that row, when it was changed, and who made the changes. Is there a way to so this automatically in MySQL or do I need to set up a new table and alter all existing queries?
View Replies !
Insert_id Save
The problem: I fill one table with something, then grab the insert_id from it. Then i add that insert_id to another table to link the two together. This is for making an account. The problem: what if multiple users make an account at the same time and the queries get mixed up? E.g. these are run before insert_id has a change to kick in insert into table1 by user1 insert into table1 by user2 insert_id then gives me the insert_id from user2 while i was expecting the one from user1 Will this be a problem and if so how is it best solved?
View Replies !
How To Save Commands?
I want to know how to save previous commands. I am using mysql 5.0 in a Windows operating system. i want to know is there a method of saving commands (statements) when I use the command prompt (shell) to execute command to mysql server.
View Replies !
Storage Save
I had two table very large data, i just now did "truncate table cdr", all data erased but still my space is not free. because following file is still same size, how can i reduce this size? I also cant ftp this file the server goes down with blue screen. Mysql Server 5.0: ===================== C: Free 1.5gb C:Program FilesMySQLMySQL Server 5.0dataibdata1 10.8 GB (11,670,650,880 bytes)
View Replies !
Save Without Exit
What command shall I type to save the entry but without exit, e.g. on mysql> After finishing typing to create a table I expect to save it first before creating another table. However I don't expect to exit and retype; # mysql -p mailserver
View Replies !
Save Query Results
In other words, how do I build a new table from the results of a query, so I can access pieces of this data later without performing the same query (a very heavy one) over and over again?
View Replies !
Cannot Save Zero To BOOLEAN Field
A PHP script generates the following statement: update cms_content set content_name = 'Blackmask', sub_cat_ID = 63, UDF1_1 = 'Blackmask', UDF1_2 = '', UDF1_3 = '', UDF1_4 = '', UDF1_5 = '', UDF2_1 = 'http://www.blackmask.com', UDF2_2 = '', UDF2_3 = '', UDF2_4 = '', UDF2_5 = '', Comment = ' ', Author = 'Phil White', Edit_date = '20080106', reject_reason = 5, reject_text = 'The content of your submission does not fit the category for which it was submitted.', Released = 0, Sticky = 0, rejected = 0, UDC1 ='Around 20,000 books for reading online.', UDC1_bitfield ='', UDC1_uid ='', UDC2 ='', UDC2_bitfield ='', UDC2_uid ='', UDC3 ='', UDC3_bitfield ='', UDC3_uid ='', UDC4 ='', UDC4_bitfield ='', UDC4_uid ='', UDC5 ='', UDC5_bitfield ='', UDC5_uid ='' where content_id = 2974 In the application, it is rejected with You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' reject_text = '', Released = 0, Sticky = 0, rejected = 0 , UDC1 ='Around 20,000' at line 1 The problem is with "rejected = 0". If I set "rejected = 1", the statement works fine. The CREATE is `rejected` tinyint(1) default NULL, Now here is the strange part. Using the MySQL query browser, the statement is accepted without problems with a value of 0 or 1. (I copied it through the clipboard from an echo.) The columns "Released" and "Sticky" were created in the same way and accept either value without problem. I am at my wits' end.
View Replies !
Save Current User In DB
I want to create a field that will save the current user of the DB, I tried with Field Name : Usuario Field Type : char(30) Default: CURRENT_USER or Default: USER etc but doesnt work How can I define the field?
View Replies !
Save Queries In Back End
Is it possible in MySQL to create and save queries in the back end DB. I am used to MS Access, in which you can put together a complex query and save it in the DB Backend. Then use the query in a ASP page instead of long SQL.
View Replies !
|