Jump to content

friedemann_bach

Members
  • Posts

    95
  • Joined

  • Last visited

About friedemann_bach

  • Birthday 06/20/1976

Profile Information

  • Gender
    Male
  • Location
    Berlin

friedemann_bach's Achievements

Member

Member (2/5)

0

Reputation

  1. I've found out by chance that both SELECT * FROM vocabulary WHERE arabic_lexeme = 'سبب' and SELECT * FROM vocabulary WHERE arabic_lexeme = 'سَبَبٌ' return as well the results with vowels as without vowels. Thought that it would work similar to Greek accents (with LIKE) ... but obviously it does not. Thanks for your help!
  2. Dear phpfreaks, I am working on a database that contains Arabic translations of Greek words. Having to operate with diacritics and vowels, I set all MySQL collations to utf8_unicode_ci. This works very good for Greek, as users can enter any diacritics combination (sometimes up to three on a single letter). It does not work at all for Arabic vowels, though. A request that includes no vowels, like SELECT * FROM vocabulary WHERE arabic_lexeme LIKE 'سبب' should return at least the same results as as a request with vowels, like SELECT * FROM vocabulary WHERE arabic_lexeme LIKE 'سَبَبٌ' but it doesn't. I have two entries that match 'سَبَبٌ', and ... LIKE 'سبب' does not match them. I imagined that it would work like French accents or German umlauts. Maybe I am wrong here? To exclude any errors that are based on my php coding, I have tested the same queries in phpMyAdmin. I also tried with different collations, cp1256_general_ci and utf8_general_ci. I am still not able to search for Arabic words with "insensitive vowels". I would appreciate any help or comments on this problem. Thank you very much for your attention!
  3. Thank you very much for this hint!
  4. Hello all, I have designed a small MySQL database frontend with PHP and I want to provide a backup function that creates a dump of the whole database. Usually, I would have used mysqldump with the usual command line options. However, mysqldump does not work here, as the PHP server does not have mysql installed. The mysql server is running on another machine. How can I make a complete database backup in this case - using only PHP and MySQL commands? Thank you very much for your help.
  5. Many thanks for this! Initially, I hoped that there was a solution to solve this in MySQL, but this works fine as well. Best regards!
  6. It would be nice if I there was a method to convert the outline fields to another format that is sortable, like with leading zeros: 01.09 01.10 01.11 I would like to hide the leading zeros from the user, though.
  7. Hello all, I have a ORDER BY question. In a VARCHAR field, I have written some values like: 1 1.1 1.1.3.5 1.1.3.5.1 1.1.3.5.2 and so on. It is meant as a hierarchical structure. Now, on ordering entries like 1.9 1.10 1.11 MySQL will order this naturally as follows: 1.10 1.11 1.9 Which is, as you will guess, not my idea. Is it somehow possible to order it in the correct way without modifying the data?
  8. Thank you. That leads into an interesting direction. Although, as you said, this is completely unorthodox. And I don't like the idea of having to fetch the table names before. I now thought of another model. I don't know whether MySQL is suited for such an approach and I would like to hear your opinion on that. The idea is to define as well object as relation types, so I would not have to look up in another table. object_types ========== id name relation_types =========== id object_type_1_id name object_type_2_id objects ====== id object_type_id name relations ====== id relation_type_id object_1_id object_2_id object_types ========== id = 1 name = person id = 2 name = location relation_types =========== id = 1 object_type_1_id = 1 name = lives_in object_type_2_id = 2 objects ====== id = 1 object_type_id = 1 name = John id = 2 object_type_id = 2 name = Liverpool relations ====== id = 1 relation_type_id = 1 object1_id = 1 object2_id = 2 What I am now trying to figure out is how the query would look like if I wanted to know where John lives.
  9. Thanks for your response. I can see your argument on indexes. Regarding the design, I thought of something that looks more like this: person ======= personId name location ======= locationId name events ======= eventId name relations ======= id type table1 table2 id1 id2 So I would not need to define each relationship type in a separate n:m table, but I would have one relationship table for all. Would this work? A rough example for a relationship data entry would be: relations ======= id = 1 type = "lives in" table1 = persons table2 = locations id1 = 1 id2 = 1
  10. Hello! I am going to develop a large database that is meant to represent a number of relationships between data objects like persons, locations, events, names, keywords and so on. Possible relationships would exist between persons and locations (P was born in L; P lives in L; P works in L), between persons and events (P organized E, P was a guest at E, P spoke at E) and so on. So each relation can have a different quality. Now, instead of defining each relationship in a separate n:m table, I thought of defining a large n:m table for all types of relationships, including those between persons and events, persons and locations, locations and events, etcetera. Then I just would have to give the names of the two related tables and specify the related ids, and I would have just one table to maintain. Does anybody have experience with this method and could give me any hints? The relationship table would surely become very large and I don't know how efficient this would be. Can you recommend to realize this with MySQL or would you prefer another database system?
  11. Hello! I am writing a module that creates HTML forms and validates them for me. I want validation messages like "incorrect format" or "please enter a value" to appear automatically in specified language. Now, how do I save all the text snippets in an efficient way? Right now, I have defined all snippets as constants like "TS_INCORRECT_FORMAT" or "TS_NO_VALUE" in a file for each language, and each time the module is loaded, the translation file that corresponds to the user language is loaded. This works, but are there more efficient methods (like saving the snippets in an array)? I fear to get out of constant names ... I am looking forward to your ideas!
  12. A simple way would be to use a PHP script that can scan your photo directory for image files (e.g. by mimetype and extension) and produces an HTML output of clickable photo thumbnails. There should be a lot of solutions available, just google for "php photo album".
  13. There is a nice function to parse the components of an URL: http://www.php.net/manual/en/function.parse-url.php You need to extract the host component: parse_url($url,PHP_URL_HOST) So that echo parse_url ('http://www.php.net/manual/en/function.parse-url.php',PHP_URL_HOST); will output "www.php.net"
  14. Sorry, I think I didn't get the idea of that script - so a user submits some criteria, a search is performed and now the results have to be displayed page by page, right? And all results are of the same type? I think you could just pass all search criteria submitted by the user through the URL without problems. On all next/previous page links, add all criteria and the respective values, as well as the last row of the page (e.g. 10). On the page, just use the submitted search criteria to perform a search, limited to <max_per_page> rows and beginning after <skip_rows>. Set max_per_page to 10 and skip_rows to 0 by default. Lets assume your criteria are <age>, <gender> and <children> and are submitted to your script. Now, on the results page, <max_per_page> is always set to 10. <skip_rows> is set to 0 by default, but can be overridden if another value is submitted via the URL. Now perform the search with your criteria: "SELECT * FROM persons WHERE age=$age AND gender=$gender AND children=$children LIMIT $skip_rows,$max_per_page" and let the results be displayed. Then, add "skip_rows=$skip_rows+$max_per_page" to the next page links, so that on the next page the next 10 results would be displayed, and add "skip_rows=$skip_rows-$max_per_page" to your previous page links. Do not forget to check for negative values. Basically, this is it. Hope this helps?
  15. If I got it right you are trying to pass the whole search result through the URL. To be honest: This is nonsense. Just pass the search term and perform the query again on every page, limited to the results you need. Use "LIMIT <start>,<max_results>", like LIMIT 0,10 to get the first 10 results, then, on the second page, use LIMIT 10,10 to get to the next 10 results and so on (just pass the number of the last row). However, regarding your first question, try implode() instead of split(), this could suit better. You need split() only if you are using regular expressions. And regarding your second question: why would you want to encrypt your results when they are going to be displayed on the page after all?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.