Creating A Queue Read-out.
I am trying to create *what should be* a simple result of where a person is in line, but I am having a lot of trouble. I have spent hours searching, and for one thing I don't even know what to search for. So here's what I am trying to do...
Let's say I have rows 1-10 in a database and rows 2,5,6,9, & 10 are all marked with '0' and the others with '1'.
If my $ID is '6', then my code would print out < 3 of 5 >.
Here is the code that I do have...
$num_in_line = (I don't know what query to put here.)
$of_total = mysql_result(mysql_query("SELECT COUNT(ID) FROM all_programs WHERE list = '0'"),0);
echo $num_in_line.' of '.$of_total;
View Complete Forum Thread with Replies
Related Forum Messages:
Creating A Queue
I am working on a queuing system in which I insert records into a database table that begin with a status='U' for Unprocessed, status='P' for Processing and status='C' for Completed. I am currently doing a SELECT * FROM queue WHERE status='U' LIMIT 1;. I immediately run an update on that record to UPDATE queue SET status='P' WHERE id=ཆ' This seems to work great if I only have one process pulling items from the queue. However, if I have multiple processes running at the same time, there is the possibility of pulling the same record twice before the UPDATE occurs. Is there a way to prevent this other than by locking the table?
View Replies !
Creating Read Only User
When looking over the instructions for phpMyAdmin they want a read-only user. What GRANT permissions do I need to assign so a user has just read-only rights?
View Replies !
MySQL Queue / Messaging
I would like to implementation an application that will connect to a MySQL DB and just monitor a table if a new row is being inserted. If a new row was inserted a sub_method will be triggered. Otherwise, the application will just be idle. Can this be done with MySQL?
View Replies !
Read In A .sql File
I have a large SQL file that contains a bunch of create table statements.How do I get mysql to read in this file and process the sql. =20.I am not thinking load data infile because it isn't text
View Replies !
Read Out An AUTO_INCREMENT-ed Value
The first column of my table is AUTO_INCREMENT. I fill my table with 5 records with a blanco value in their first field. The first column of my table will then hold the values 1,2,3,4,5 (top>down). Then I erase those 5. Then I add a new record with a blanco first value. It will get number 6. My problem in this scenario: I want to read out this number 6 before I will insert that record. Is that possible?
View Replies !
MySqlDataReader.Read()
Then you ask the Mysql .Net Connector Reader to Read forward is it moving a server side cursor forward? Or is it just moving forward in a cache of the query result that is already on the client? I assume(hope) it is the latter but just asking.
View Replies !
How To Read Log Files
I running on Win2K3 and need to know the basics of mySql system health logs (their location, their expected contents and format) and any other logs that might help track down problems when mySql crashes. I've seen that it will log EventViewer events and that within the C:Program FilesMySQLMySQL Server 5.0data directory there are some logs. I've been able to read the .err log since it's text but the other logs are binary. Do I have to use a cmdline app within the mySql distriubtion to read the binary files? Or, is this a well documented format and there are several 3rd party utilities out there that will parse/display these logs. In general, where does mySql maintain its log files, does it generate separate log files per database and what are some common applications that I need to get familiar with to view the contents of these files?
View Replies !
Read-only Tables
Is there a way to mark a table as read-only (after inserting some initial data, of course)? I'd like to do it for optimization reasons - hoping that mysql could take advantage of the knowledge it's read-only, for caching, etc.
View Replies !
Read The .err File
Working on installation in Mac OSX 10.4. Need to read the .err file, but don't know how to find it. If you can help, please show the path from from the 'top' i.e. /usr/local/mysql/ and the rest of the path.
View Replies !
Table Is Read Only
i transfer my mysql database in windows into linux by copy and paste it.when i want to update table record,it promt an error msg: Error Code : 1036 Table 'ardi02' is read only (2 ms taken).
View Replies !
How To Lock A Max ID From Being Read
Basically what I want to do is read the maximum id_B from some table with id_A = 5 and insert a new row with a new id_B. While I do this I don't want anyone else to be able to insert a new row with id_A = 5. If I do this: SET AUTOCOMMIT=0; SELECT MAX(id_B) FROM table WHERE id_A = '5' LOCK IN SHARE MODE; // do php code here to increment MAX(id_B) by 1 and save it to $new_id_B INSERT INTO table (id_A, id_B) VALUES ('5', '$new_id_B') COMMIT; Would this prevent other users from inserting a new record with id_A = 5, while I'm adding a new record with id_A = 5.
View Replies !
Can't Read Dir Of './mysql/'
I am currently using MySQL under Mandrake Linux 10.1 and have an error (see the title). I have an error message when I want to see All the databases into my Server. I am using PHPMyAdmin.
View Replies !
Table Is Read Only...
i just copied the .frm, .MYI and .MYD to mysql linux's server, but when i try to create index on a table it gives me "Table 'TEST1' is read only,
View Replies !
Read Only Tables
I log on as a user who has select, insert, update, delete privilegies but when i'm trying to for example insert row in my table myadmin reports me that the table is read only. where can I as a root change this and what are the options?
View Replies !
How To Read Phpbb
php file is loaded as codes on windows, but when u upload it on web u get the codes showed as image and stuff, so my question is, when using local host (windows xp) what prog or how i can see the php files not as codes/source when opening but as image or table or whatever.
View Replies !
Read From Database
I have set up a database with a table called "2009". I have 2 rows with about 16 fields. I have data stored in these two rows. I have some code that tells me this table exists. Below that code I have this code: Code: $sql = "SELECT * FROM 2009"; $result = mysql_query($sql, $conn) or die(mysql_error()); I get this error: "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 '2009'". The error is in the second line because when I comment it out, I don't get the error. I have a number of books on MySQL, and I have tried many different ways to retrieve data from the data base, but I am constantly getting errors. The above code is simple code that produces this error.
View Replies !
MySql Write Vs Read
Essentially I am faced with a design choice; have an oft run (modifiable) query run every time any user wants to run it, comparing criteria againt each and every user in the table and delviering list OR saving that list (user/user/) so the next time all that needs to be queried is the existence of a record in the table. The basic tradeoff; version 1 there are many simultaneous queries of the user db on complex search criteria; version 2 there are fewer but their are as many far more simple queries to a much larger table, not to mention many writes to same to keep the table current. I know this is pretty vague, but I was wondering if in general there is an area that mysql excels in vis a vis complex query smaller tables simple query larger tables. Question 2 is there anyway to guestiate the search/write times of a user log in to both query and update? #Records, fields, etc? I'd like to keep log in to < 10 seconds max.
View Replies !
Editing Read Only Tables
ive got a database in phpmyadmin..i need to change a value in a coumn in a table..but when i do so, the following error message would show up: Quote: MySQL said: Documentation #1036 - Table 'table' is read only how can i deal with it
View Replies !
Read Text From A File
I have a text file which contains the following data 1&david&0248814&software engg&1973 2&thomas&8475623&commerse&1965 I have created a table <info> with the attributes nr name reg_nr sub born_yr I need to somehow read the data from the file n insert them into the table attributes... does anyone over here know how could this be done ? to insert the data to the table could be done with insert into <table> values <value> but the problem is how can i read it from the file...leaving the '&' sign ?
View Replies !
Read & Write Locks
I need to lock some of my tables for a while with lock tables. However I find how the READ and WRITE locks is implemented in the MyISAM storage engine a little odd. When obtaining a READ lock all updates are prevented, including writes from the thread obtaining it. WRITE locks gives exclusive access to the issuing thread. However what I want is to give read and write priveleges to one thread and read priveleges to all other threads, and I can't figure out how to obtain this effect with lock tables... Is it even possibel?
View Replies !
READ A TEXT FILENAME
Since a text file can be loaded in the MySQL, I feel that there is a way MySQL will be able to read a text file name. Any idea how to do that? And after reading the text file name, how do i insert it in the column.
View Replies !
Read-only TIMESTAMP Field
I need a table with TIMESTAMP field which must be always set to a CREATE server time (so the == CURRENT_TIMESTAMP). How do I make it read only? I.e. make user unable to override the default value (CURRENT_TIMESTAMP) on CREATE and UPDATE. Is it the Q of user permissions? If yes, how to set 'em correctly to allow create/update but allow only to read timestamp?
View Replies !
Write Once Read Many Field
I am designing a database and one of the requirements my client has is that once data is entered into certain fields it cannot, under any circumstances, be changed. Is it possible to create a write once read many (WORM) field in MySQL directly?
View Replies !
Can SQL Read From A File Or List
I'd like to do a select statement that would substitute variables from a file containing a list of strings, or a list of strings right on the command line. Here's my pseudo code: SELECT {some value from my list, table or whatever} FROM {some list of tables in a file or other table etc}..
View Replies !
How To Read A File Into Mysql
i have created a output file from oracle which contains insert statements like insert into tms.tms_rem_exclusion_list values (3337) insert into tms.tms_rem_exclusion_list values (4175) insert into tms.tms_rem_exclusion_list values (4227) iam new to mysql and someone told me that if i create such a file i can import this data into the mysql table at the mysql prompt like mysql> tms_rem_exclusion_list < test.sql; (name of the above file) but iam getting this: ERROR 1064: You have an error in your SQL syntax. Check the manual that corresp onds to your MySQL server version for the right syntax to use near 'tms_rem_excl usion_list < test.sql' at line 1 first of all i am not sure where to keep the test.sql file ie in which directory so i kept it under the scripts folder.
View Replies !
Read Back Up File
I got this error. shell> mysql -e "source /var/lib/mysql/test.sql" backuptest ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'backuptest'
View Replies !
Read Ibdata1 Or Ib_logfile1
Is there a way to read the ibdata1 or ib_logfile1 files? I'm looking for some information. It doesn't have to be complete but wanted to take a look. It's all binary right now and wondered how to convert to .txt or something that i can read.
View Replies !
Read From Merge Results
is there a way in MySQL to read in the records of a table and to package duplicates into one value : |id |type |subType | Category | | 00000000001 |Accommodation | Guest House | 3Star | | 00000000002 |Accommodation | Bed and Breakfast| approved| can it be outputted like this: Accommodation -> Guest House -> 3Star -> Bed and Breakfast-> Approved I am still trying to merge the output from this query into a triple combo.
View Replies !
Not Allowing To Read Files
I have program with data accessed by MySQL. In my assume, I copy program and its data files to my friends, and they run program with pleased faces. And now, the first friend wants to delete all program related data files and copy program related data files from second friend(or he can also get any program formatted data files) and save them into data folder. My problem: the first friend can run program with only my data files; he can get any data files from anywhere and save them into data folder, but program won't be allowed to read these data. Does everyone have some good ideads?
View Replies !
Read, Calculate, Update
I have created a new field within a simple database and need to automatically update this field, rather than using phpMyAdimn. Say exisiting field is "Value1" and I need to read this value, multiply by an integer and update the new field "NewValue" with this new calculated value. I have done a SELECT FROM and a WHILE statement as: $query = "SELECT Value1 FROM TestDatabase"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)) { // calculate the new value from the existing data in "Value1" $new _value = $row['Value1'] * 114; // write new value back to database $query = "UPDATE TestDatabase SET NewValue='$new_value' "; $result = mysql_query($query) or die(mysql_error()); } I have executed the php but it simply takes the first data in the row, makes the calculation and writes the same value back into every new field without making individual row calculations ! Can someone please tell me what am I doing wrong here?
View Replies !
Not Able To Read Mysqldump File Thru CLI
I am trying to do something like below mysql -u root -p poll_only < poll.sql poll.sql is a reasult of mysqldump nad i am trying to run and populate the database poll_only . but nothing works out i am getting error Access denied for user: 'root@localhost' to database 'poll_only' i had given GRANT ALL poll_only.* username@localhost but still no effect
View Replies !
Write Vs. Read Performance
I'm guessing this is just as much a file system question as a MySQL question, but I haven't been able to find any information touching this particular subject. Not considering data sent through network, what would be faster, fetching a row from a database, updating those columns that have been changed, let's say one of five, or simply don't fetch and update all the columns in the row (not including the id of course)?
View Replies !
Can Not Read My Database File *.frm
I have wamp server in my computer, i had some problem runing some of my file so i copied the database file from C:wampinmysqlmysql5.0.51adataitsal WHERE "ITSAL" IS THE NAME OF MY DATABASE and reinstall the wamp server, the problem now phpmydmin does not reconize these files which in this format: *.frm or if any body know of any software i can use to read the structure of files with extension *.frm
View Replies !
How To Dump The Database And Read It Back In?
Our database just slowed down radically. Certain queries drive CPU utilization through the roof. This happened once before, and the technican simply dumped the data to disk and then played it back in. This seemed to correct database corruption. After than, the database went back to normal performance. Does anyone know how to do this?
View Replies !
No Read Or Write Between INSERT And UPDATE
I am using mysql with the InnoDB engine. I wrote a perl script that first selects something from a table, and then updates a second table based on the select from the first table. I need to make sure that there is no read or write to the tables while my script performs the insert and update. I looked at http://dev.mysql.com/doc/refman/4.1/en/lock-tables.html and it says this: --------------------------------------------------------- If you are using a storage engine in MySQL that does not support transactions, you must use LOCK TABLES if you want to ensure that no other thread comes between a SELECT and an UPDATE. The example shown here requires LOCK TABLES to execute safely: LOCK TABLES trans READ, customer WRITE; SELECT SUM(value) FROM trans WHERE customer_id=some_id; UPDATE customer SET total_value=sum_from_previous_statement WHERE customer_id=some_id; UNLOCK TABLES; Without LOCK TABLES, it is possible that another thread might insert a new row in the trans table between execution of the SELECT and UPDATE statements. --------------------------------------------------------- However, I am using InnoDB and it DOES support transaction. So, does that mean that even if I don't lock my tables, it will still work? If not, what do I need to do?
View Replies !
Mysqldump :; Read Only One Table Structure
I have backed (backup.sql) up one Mysql database which contains 10 tables using mysqldump. Now I want to read just one table structure and it's data from backup.sql to another database. How do i achieve it. I have tried "mysql databasename < backup.sql" but it will populate the databasename with all the 10 tables present in backup.sql which i don want.
View Replies !
Read Mysql Dump File?
I am trying to read a mysql dump file that I was given from a mysql dump file into my mysql server, I am using the following command at the mysql command line and get the following error:....
View Replies !
Store And Read Chinese Characters
I'm writing a vbscript application that reads UTF-8 XML containing Chinese characters. Any suggestions how to store these characters in MySql 4.0.x ? Do I need to set a special encoding such as Big5 on the database ? Does MySql support storing UTF-8 ? If so what data types / encoding do I need to use ? Are there any special considerations for using MySql/ODBC and ADO to get and put the data.
View Replies !
Read/write Table Efficiency
I've got a bit of an efficiency question, and just trying to figure out how best to manage this. For my site HearWhere.com, I have a table which holds artists shows. When i am refreshing the collection of shows and geocoding the locations, the database response for user queries slows significantly - which is understandable. One option I'm considering is to have one database which the users connect to for queries, and a second separate database for writing the updates, and then I can just move the updated database to become the live database on a daily basis. The other option I think is just to have a separate table which I write the updates to, and then just replace the table the users interact with from the table which was updated Either way I go, at the moment everything would be done on the same sql server - I don't currently have enough traffic to justify multiple servers.
View Replies !
Protection :: How To Make Tables Read Only
I have 3 seprated questions : 1-how to make a row of a table only readable, No update be allowable. 2-how to make a field of a table only readable, No update be allowable. 3-how can I use any password for phpmyadmin in my hosting.its cpanel
View Replies !
Installation :: ./bin/mysqld: Can't Read Dir Of '/root/tmp/'
I downloaded the tarball that has the source code of MySQL, decompressed it without any problems and configured it. But when I ran: [root@lae4 mysql]# scripts/mysql_install_db --user=mysql Installing all prepared tables ./bin/mysqld: Can't read dir of '/root/tmp/' (Errcode: 13) Fill help tables ./bin/mysqld: Can't read dir of '/root/tmp/' (Errcode: 13) I changed the permissions of that directory in order to make possible the mysql user to read, write and execute. But there is no difference
View Replies !
|