802 Posted Topics
Re: I have no clear idea of what you are trying, but this here is definitively wrong: [CODE]$z=mysql_query("UPDATE levels SET bal=bal-'$new[$i]' WHERE itemsize= '$item[$i]'"); $result=mysql_query($z);[/CODE] The result of the mysql_query function is a ressource identifier which you cannot use as input for the same function. | |
Re: Show the output of [ICODE]SHOW CREATE TABLE account[/ICODE]. This table has a unique index on three fields which seems to be semantically wrong. | |
Re: Looks like inconsistent data due to bad table design. Show a data sample. | |
Re: Grant access to the UDF to all involved parties and call it with the database name as a dot-terminated prefix, like in [CODE] call testDB.myUDF(); [/CODE] | |
Re: First of all, this looks like bad table design. A table with similar columns most probably should be split in at least two tables. Second, you don't tell where your problem is. To count non-zero column values in a stored procedure or function this function will have to contain an … | |
Re: It is a matter of interpretation of your application if an exercise is cardio or strength, but not an explicit datum. Therefore I'd rather have only one table for all attributes of the cardio and strength tables and compute from the actual data if a row is a cardio or … | |
Re: Hire a programmer. Or come back if you have some code which doesn't work. | |
Re: mysql_insert_id is an integer. You cannot have database, table or field names beginning with numerals. Prefix the table name with some literal constant. | |
Re: You can prefix the table name with the (dot-terminated) database name in queries, thus allowing for joins across database limits. To the beste of my knowledge, you cannot create foreign keys, though, which are maintained by InnoDB. | |
Re: Do not convert NOW() and terminationDate into strings for date arithmetics and comparisons. | |
Re: [CODE]select greatest(t1.chan1,t1.chan2,t1.chan3), captureTime from myTable t1 where greatest(t1.chan1,t1.chan2,t1.chan3) = ( select max(greatest(t2.chan1, t2.chan2, t2.chan3)) from myTable t2 group by substr(t2.captureTime, 1, 15) ) and substr(t1.captureTime, 1, 15 ) = substr( t2.captureTime, 1, 15) [/CODE] Lots of query optimization needed, I presume. | |
Re: Use the commandline client. That way you know exactly what you're doing, and you can easily script and replicate your whole database setup. Pay attention to the various character encoding settings. | |
Re: Show the query and the table structure. And learn some CSS and how to avoid redundant coding. | |
| |
Re: All needed information is in the inventory table. There is no need for monthly tables as you can filter data by their timestamps. To avoid checking of double entries you could define a month's inventory as all entries with a timestamp from the this or following month (depending on the … | |
Re: Your 4 (count them: four) user inputs can be tested for duplicate combinations just by one query: [CODE]select * from mytable where name = <name> or surname = <surname> or DoB = <dob> or Nationality = <nationality>[/CODE] If you want to test for combinations with at least two factors, use … | |
Re: 1) Define order_no as an auto_increment field. 2) Enter [ICODE] ALTER TABLE mytable AUTO_INCREMENT = 70000; [/ICODE] at the mysql command prompt. | |
Re: Make sure that all your databases, tables and connections use utf-8 as a character set. Enter [ICODE]show variables like "character_set%"[/ICODE] at the mysql command prompt to make sure that you did it right. Make sure that also the HTML output contains UTF-8 and that the Content-type header looks like [ICODE]Content-type: … | |
Re: It depends on your data definition. If you defined the zip codes as integers you cannot have leading zeros. You will have to add them in processing the data. If you defined the zip codes as character fields you can use the implicit conversion or the convert function: [CODE]update mytable … | |
Re: As long as you do not post a concrete question pertaining to mysql you probably won't get an answer. If you rather do your processing in PHP or in the database is a matter of taste, speed and efficiency. I recommend that all processing which can be moved to the … | |
Re: Your problem is not clear. What is the value of the Weblink field and what would you like to display in the browser? | |
Re: That is what transactions are for. Bracket your check and insert procedure in a transaction which you can roll back in case of duplicate values. | |
Re: Show the procedure head and how you call the procedure. | |
Re: What exactly is your problem? Go ahead and code a procedure. Come back if it does not work and show us what you did. | |
Re: I don't know what you're missing, but I am missing the table structure and some test data. Are there NULL values in the Kills and Deaths columns? | |
Re: If you use 32-bit integers for the contact ID field you may store up to 2^32-1 different contacts. That should be sufficient for all practical purposes. | |
Re: It's a bad idea because you will be duplicating data structures. In development you will have to replicate any database design change in all databases. It's much easier to develop in only one language and to add translations either by means of additional content fields or by means of one … | |
Re: Design your database first, then the interface. If the asset type depends on the conveyor number and there is a limited number of asset types, you have a 1:n relation from asset types to conveyors, which in proper database design is expressed as a table Assets (id, asset_type) and a … | |
Re: When I test your code, the line [CODE]insert into hh values(27.22); [/CODE]results in the mysql error[ICODE] 1264: Out of range error for column id[/ICODE] You have to define the double field with as much decimal places as needed. Change the table definition to [CODE]create table hh (id double(5,2)); [/CODE]and it … | |
Re: Which queries do you need to adjust? In which queries do you refer explicitly to the primary key? | |
Re: This looks like nonsense. When you want to delete a record from the post table you have to know it's post_id. You do not need an arbitrary generated value in the user table for that purpose. | |
Re: Your PHP is compiled without mysql support. Create a php file with this content: [CODE]<?php phpinfo(); [/CODE]and navigate your browser to that file. It will tell you which PHP modules are installed and active. | |
Re: Looks like a 1:n relation from Broker to Agent, which means that the Agent table needs a foreign key (broker_id) into the Broker table. Further you need a 1:n relation from Agents to Leads. And maybe one from Brokers to Leads (depends on the semantics of your app). | |
Re: Seems quite o.k. You should not store unencrypted plain text passwords for security reasons. And instead of "SELECT *" better "SELECT username,password" for performance reasons. | |
Re: You could use a unique index on the unique field combination an then use "INSERT IGNORE" without a prior check for doublettes. | |
Re: You seem to be using mysql as a database, not mysqlbuddy. mysqlbuddy is just an interface to the database, as is phpmyadmin, too. It does not matter to the website application which of those you use. I recommend HeidiSQL. Are you sure that you want to store plaintext passwords? That … | |
Re: What is the output of [CODE]SHOW CREATE TABLE `table 1`; SHOW CREATE TABLE `table 2`; SHOW CREATE TABLE `table 3`; [/CODE]? | |
Re: This structure of games depending on the outcome of previous games is effectively a recursive hierarchy or tree structure. This cannot be properly displayed in plain queries or views. You will need a function which computes for a given match recursively the outcomes of all previous matches to determine the … | |
Re: It seems that any stage belongs to a place, but not any place has more than one stages. Therefore I would set up a database in which - each concert takes place at a time and a place; - each place may have several stages; - each stage belongs to … | |
Re: Show the output of SHOW CREATE TABLE for all involved tables (preferably as text, not as a screenshot). | |
Re: Your table and/or index file(s) are corrupt. Restore them from a backup or try to repair them. Have a look at [url]http://dev.mysql.com/doc/refman/5.0/en/myisam-repair.html[/url] | |
Re: I tried your code (with the table and some field names changed) and it does not generate an error in my test. [CODE]DELIMITER // CREATE TRIGGER confirmation_triggers AFTER INSERT ON `bielefeld` FOR EACH ROW IF new.institution='True' THEN INSERT INTO `notifications` VALUES(NULL, new.institution, "Notification here", CURDATE()); END IF; END; DELIMITER //[/CODE] | |
Re: Along those lines: [CODE]SELECT productID,totalAmountAfter,transactionDate FROM tbltransaction WHERE transactionDate BETWEEN '2010-01-01' AND '2010-12-31' and (productID, transactionDate) in (SELECT productID, max(transactionDate) from tbltransaction group by productID) ORDER BY productID,transactionDate DESC [/CODE] | |
Re: You are trying to insert a child record for which no entry exists in the parent table. | |
Re: What have you tried so far? Have a look at the to_days() and the round() function which may help to solve your problem. | |
Re: You say that the level cannot expressed by a mathematical function, but it can be expressed by a function using the TRUNCATE() and CEILING() functions. So you can define level as a user defined function of score and use it in views and queries. | |
Re: EXPLAIN doesn't tell you anything about execution time but only about query optimization. [QUOTE]Then there should be no difference.[/QUOTE] Why not? A binary comparison does not need any conversion before the comparison, while a non-binary string comparison requires some operations for case matching. Therefore a non-binary comparison should need more … |
The End.