802 Posted Topics
| |
Re: There is a REPLACE statement in mysql with similar meaning as INSERT except that rows with duplicate keys will be deleted before the insertion. The alternative is the INSERT IGNORE statement which will skip any new rows with duplicate keys. | |
Re: In which format do you have the "huge data"? In general I'd recommend that you use the mysql command line client and the LOAD DATA statement. | |
Re: The mysql storage format is YYYYMMDD. If you want to enter the data in another format you have to convert it in your application to and from the target date format. | |
Re: [CODE]select * from users where to_days(exp_date) - to_days(now()) = 7[/CODE] | |
Re: Use the console mysql client. It will tell you where it fails. | |
Re: Yes, that would be the first step. The second step is to ensure relational integrity, which means that your system has to make sure that only valid student IDs and advisor names can be entered. Therefore you need also a student table and an advisor table and two foreign key … | |
Re: You cannot have variable names with blanks in HTML forms. Rename your form variables which you retrieve via the $_POST array. | |
Re: Set all character set parameters to utf8. Query for "show variables like '%char%'" for a list. Set those variables in your my.cnf and set the correct character set for the connection in your application. Set also the database, table and field default character set to utf8. | |
Re: First of all, you have a bad table design. Column X should not exists except in a view. If you still stick to the design, the question is if the values in column X refer to another table. For the sake of the argument let's assume they refer to column … | |
Re: Your solution lists only two of the the three possible status values. If you really don't care about the status you can just eliminate it from your query: [CODE]SELECT * FROM installs WHERE r1 = 'Standard' ORDER BY building, appointment_date ASC[/CODE] | |
Re: Either mysql is not running or your webserver is not configured properly to connect to it. | |
Re: [CODE]select * from test where name = 'Meals' or parent = (select id from test where name = 'Meals'); [/CODE] | |
Re: The table defintion and the semicolon is missing after table1 and table2. | |
I just stumbled over this: [ICODE]mysql> select "abc" = 0; +-----------+ | "abc" = 0 | +-----------+ | 1 | +-----------+ 1 row in set, 1 warning (0.06 sec) mysql> show warnings; +---------+------+-----------------------------------------+ | Level | Code | Message | +---------+------+-----------------------------------------+ | Warning | 1292 | Truncated incorrect DOUBLE value: … | |
Re: Your mysql server is not running. I don't know about fedora, but in Ubuntu you start it as root with /etc/init.d/mysql start | |
Re: You can delete all your mysql data by deleting the "data" directory in \xampp\mysql (at least that's the path in my installation). The access restrictions are stored in a database named mysql, so when you delete and re-install it you should be back on square 1. This has nothing to … | |
Re: The idea looks correct. Each class should have an ID and a name. The ID is the unique key. The class name should not be stored anywhere else than in the classes table, and refereoces to the class should contain the ID, not the name. | |
![]() | Re: MySQL does not have a URL field type which might handle the HTML formatting. You could write a MySQL function which replaces all URL-like text with HTML code. But it's easier done in PHP. ![]() |
Re: Probably you are using the wrong character set for the connection. Try it with command line mysql and have a look at the connection variables with [CODE] show variables like "%conn%" [/CODE]Set the connection character set to utf8. | |
Re: Obviously there is a character set error. The data seem to be in UTF-8, while the browser announces them as another character set (maybe latin-1?) Check all relevant character set parameters: - database character set - table character set - field character set - connection character set - character set … | |
Re: I never found a way to do that. You can use a case statement which lists all the allowed table names and chooses the right one depending on a procedure input parameter, but I don't think that you can have truly dynamic table names in stored procedures or queries. | |
Re: I deem it bad practice to do calculations in PHP which can be done on the database level. It is inefficient (because of the database in- and output) and it's error prone if the data are accessed through an other interface than PHP. Have a look at the time_diff function: … | |
Re: I never used this kind of constraint. For this purpose I'd rather use an enum field type for the class column. | |
Re: Get yourself a MySQL primer to read and study. If you have exactly one file per user, the administrative data for this file should go into the user_cv table, too. Otherwise - that is, if there may be more than one file per user - there has to be a … | |
Re: You can search for text fields containing non-printing characters with a regular expression: [CODE]select mytextfield from mytable where mytextfield rlike "[[:cntrl:]]" [/CODE] To search for non-ascii use the regexp "[^[:ascii:]]" For other character classes see here: [url]http://www.petefreitag.com/cheatsheets/regex/character-classes/[/url] | |
Re: Use an HTML table instead with one thumbnail image for each table cell. | |
Re: No, this code is not correct. While [ICODE]0or[/ICODE] seems to be a typo, the insert syntax is wrong. The [ICODE]id[/ICODE] parameter is lacking a value. | |
Re: Show your table structure, show some test data, show what should work and what doesn't. | |
Re: This is the model. Adapt to your tables. [CODE]delete from grp_performance where g.id in ( SELECT g.id FROM grp_performance INNER JOIN category c ON g.cat_id = c.cat_id )[/CODE] | |
Re: You can do it in a query which uses 3 left joins to connect from the highest to the lower levels of the hierarchy. But this is not a general solution as the hierarchy can - in principle - be arbitrarily deeply nested. Therefore you will need a prodedure to … | |
Re: It looks like the MySQL server and/or the TCP/IP connection on port 3306 do not work properly and have too long reponse times. How high is the average server load (as shown by "top")? If it is above 0.5 most of the time try to add ressources or to move … | |
Re: Your brackets are wrong. Your sub-select returns the number 32, and the outer select cannot find any row with user_id = 1 and unique_id = 32. Try: [CODE]select * from blocks order by unique_id desc where user_id=1 limit 1; [/CODE]or [CODE]select * from blocks where user_id=1 and unique_id=(SELECT max(unique_id) from … | |
| |
Re: For more complicated pattern match and replacement you could also dump the database to a file, run it through sed and import it again. | |
Re: You have to escape the apostrophe with a backslash. In PHP there is the function mysql_real_escape_string with adds all the necessary backslashes for feeding text into mysql. The query must read: [CODE]INSERT INTO tbl (Id, courseName) VALUES(123,'Apostroph'd name'); [/CODE]In PHP you have to make sure that the escape character itself … | |
Re: // Use the mysql week() or weekofyear() functions. No, you cannot retrieve all week numbers between dates in one query without a stored function or procedure. What you would need is a function which returns a result set of more than one row with two input parameters for the limiting … | |
Re: Where you compare a value or a column with the result of a subselect this subselect must have the same number of columns as those which you are comparing - one, as a rule. So you cannot use the * operator in your subselect. Apart from that your WHERE clause … | |
Re: This looks like rubbish. How do you join table9 with a link from table6 to table1? Why don't you post code which you have actually tried? Submit a test case, complete with table structures, test data and the actual code which you are trying to implement. | |
Re: You could use a flat file database like SQLite. But I doubt that you will be happy with it. | |
Re: Which parameter value have you set for season_id ? How and where do you set an initial value for rank (@rownum)? This query code works for me (i.e. it delivers results which seem to be structurally o.k.): [CODE]set @rownum = 0; SELECT *, t.team_name as Tm , @rownum := @rownum+1 … | |
Re: Hire a programmer. If you need a mysql forum to find an image management software you should definitely not try it yourself, except you got time to burn. ![]() | |
Re: [CODE]select distinct person_id from persons_records where person_id in (select person_id from persons_records where record_id=1) and person_id in (select person_id from persons_records where record_id=2); [/CODE] or, this being mySQL: [CODE]select person_id, group_concat(record_id) as r from persons_records having locate(1,r) and locate(2,r) [/CODE] But your code is fine, though. ![]() | |
Re: If you really want to achieve this kind of translation you need a higher level representation of the statements to be translated. On which level does the PHP "for" statement match the JAVA "if" statement and vice versa? If it does, it will be on the level of program flow … | |
Re: Reqular expressions with variable thread and forum ids are: [url]http://www\.daniweb\.com/web-development/databases/mysql/threads/[/url][0-9]+ [url]http://www\.daniweb\.com/web-development/databases/mysql/[/url][0-9]+ | |
Re: There is no such thing as a general database template. A database is a means to organize content, and its structure depends on the semantics of the content. |
The End.