Re: [PHP-DB] MySQL REGEXP functionality... any way to make this easier?
Hi, unfortunately i can't help you much, but listen you can make your pattern more readable if you delete "[]" there's no need for classes in your pattern SELECT * FROM ospd WHERE word REGEXP '^a?p?e?$|^a?e?p?$|^p?e?a?$|^p?a?e?$|^e?a?p?$|^e?p?a?$'; ? = one or none but if you need each letter then omit "?" SELECT * FROM ospd WHERE word REGEXP '^ape$|^aep$|^pea$|^pae$|^eap$|^epa$'; this is the simplest way but it also matches aae, aaa, ppe, ppp ... and probably not what you need SELECT * FROM ospd WHERE word REGEXP '^[aep]{3}$'; I thnk you don't have another choice then to write each combination by yourself greet martin - Original Message - From: "Xepherys" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, October 10, 2002 8:26 AM Subject: [PHP-DB] MySQL REGEXP functionality... any way to make this easier? > Right now, a sample query I might have would be... > > SELECT * FROM ospd WHERE word REGEXP '^([a]?[p]?[e]?)$|^[p]?[a]?[e]?$|^[a > ]?[e]?[p]?$|^[p]?[e]?[a]?$|^[e]?[p]?[a]?$|^[e]?[a]?[p]?$'; > > > where basically I need to query every combination of a, p and e. This is a > pain, but for only three letter is not so bad. As you can see, this could > become unruly with larger numbers of letters. Each instance of a letter can > only occur once. However, a letter may be duplicated and used once for each > instance. Hence the statement steps through... it could also be something > like... > > SELECT * FROM ospd WHERE word REGEXP > '^[a]?[a]?[e]?$|^[a]?[e]?[a]?$||^[e]?[a]?[a]?$'; > > more easily written because one letter is used twice and can occure once for > each instance. Please let me know if you have any ideas. > > > Jesse > [EMAIL PROTECTED] > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] incrememnting an array
I hope the little script bellow helps you greet Martin '; print_r($arr2); echo ''; ?> - Original Message - From: "John Coder" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, September 20, 2002 8:19 AM Subject: [PHP-DB] incrememnting an array hi all this is what I would like to do. I have a dynamically generated array from a database and I wnat to do a piechart from it . for example the array would hold (a,b,c,d,e,f,g,h) sometimes more sometimes less . I need to get the values of a,b,b,a+b,a+b,a+b+c,a+b+c,a+b+c+d, and son on these are for the values of the angles for the pie chart on imagefilledarc(). And for the life of me I can't figure out how to do it. any help would be greatly appreciated John Coder -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] strange behavior
Hi, i start a session on a entrypage with a form, and i wonder about the output to the browser. There appeared a input-field of the type hidden with the session-name as name and the session-id as value. How can I switch this PHP-behavior off? CODE OUTPUT ... ... greet Martin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] header
That's wrong!!! the output starts erlier everything and i mean realy everything outside is output!!! remember that it's php native behavior to send stuff outside to the client with the standard header for plain text greet Martin - Original Message - From: "Devrim GUNDUZ" <[EMAIL PROTECTED]> To: "Meltem Demirkus" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Thursday, September 05, 2002 2:08 PM Subject: Re: [PHP-DB] header > > Hi, > > On Thu, 5 Sep 2002, Meltem Demirkus wrote: > > > > Warning: Cannot add header information - headers already sent by (output > > started at C:\FoxServ\www\debugger\project_module\start_html.php:5) in > > C:\FoxServ\www\debugger\project_module\project_add_.php on line 11 > > > > start_html.php file includes: > > > > > > > > > > > > > > > > > > > > Check the error: "Warning: Cannot add header information - headers already > sent by (output started at > C:\FoxServ\www\debugger\project_module\start_html.php:5) "; > > let's check line 5: > > > this is an output. > > Best regards. > -- > > Devrim GUNDUZ > > [EMAIL PROTECTED] Tel : (312) 295 9318 > [EMAIL PROTECTED] Faks : (312) 295 9494 > > Web : http://devrim.oper.metu.edu.tr > - > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] form validation question - regex not working
If you realy want to match vaild E-Mailadresses (rfc822 conformal) you have to do things like this --- short pattern start -- (?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\ ((?:[^\\\x80-\xff\n \015()]|\\[^\x80-\xff])*\))*\))*(?:(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\ xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|"(?:[^\\\x80-\xff\n\015" ]|\\[^\x80-\xff])*")(?:(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xf f]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*\.(?:[\040\t]|\((?:[ ^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\ xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,; :".\\\[\]\000-\037\x80-\xff])|"(?:[^\\\x80-\xff\n\015"]|\\[^\x80-\xff])*")) *(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\ n\015()]|\\[^\x80-\xff])*\))*\))*@(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\ \[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\04 0)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80- \xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])(?:(?:[\040\t]|\((? :[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80 -\xff])*\))*\))*\.(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\( (?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\] \000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\ \x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\]))*|(?:[^(\040)<>@,;:".\\\[\]\000-\0 37\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|"(?:[^\\\x80-\xf f\n\015"]|\\[^\x80-\xff])*")(?:[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\03 7]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\ \[^\x80-\xff])*\))*\)|"(?:[^\\\x80-\xff\n\015"]|\\[^\x80-\xff])*")*<(?:[\04 0\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()] |\\[^\x80-\xff])*\))*\))*(?:@(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x 80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@ ,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff] )|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])(?:(?:[\040\t]|\((?:[^\\ \x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff ])*\))*\))*\.(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^ \\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\000- \037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80- \xff\n\015\[\]]|\\[^\x80-\xff])*\]))*(?:(?:[\040\t]|\((?:[^\\\x80-\xff\n\01 5()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*,(? :[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\0 15()]|\\[^\x80-\xff])*\))*\))*@(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^ \x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)< >@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xf f])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])(?:(?:[\040\t]|\((?:[^ \\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\x ff])*\))*\))*\.(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?: [^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\00 0-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x8 0-\xff\n\015\[\]]|\\[^\x80-\xff])*\]))*)*:(?:[\040\t]|\((?:[^\\\x80-\xff\n\ 015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*) ?(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000 -\037\x80-\xff])|"(?:[^\\\x80-\xff\n\015"]|\\[^\x80-\xff])*")(?:(?:[\040\t] |\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[ ^\x80-\xff])*\))*\))*\.(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xf f]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\ \\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|"(?: [^\\\x80-\xff\n\015"]|\\[^\x80-\xff])*"))*(?:[\040\t]|\((?:[^\\\x80-\xff\n\ 015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*@ (?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n \015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff ]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\ ]]|\\[^\x80-\xff])*\])(?:(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\ xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*\.(?:[\040\t]|\((? :[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80 -\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@ ,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff ])*\]))*(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x8 0-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*>)(?:[\040\t]|\((?:[^\\\x80-\xff\n\ 015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))* --- short pattern end -- you find it on h
Re: [PHP-DB] MySQL and BLOB
maybe RTFM is not the answer!!! i think this will help a little more http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#Sto rage_requirements greet Martin - Original Message - From: "Jason Wong" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, August 22, 2002 8:17 AM Subject: Re: [PHP-DB] MySQL and BLOB > On Thursday 22 August 2002 13:57, Andy wrote: > > > Hi there, > > > > I am storing via PHP pictures into BLOB fields. Worked fine so far for over > > 200 images. > > Now an error has occured with a particular picture. No error msg. Just does > > not work. The wired thing is that the thumbnail does. So I guess the BLOB > > field is just to small for the image. > > > > How many kb can a blob field savin in MySQL > > Depends on what type of BLOB. Why don't you RFTM? > > > and what do you suggest to do. > > Probably the usual, not to store files in MySQL where possible. > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > > > /* > Never buy from a rich salesman. > -- Goldenstern > */ > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP IDE
Hi, i'm sorry to post this question to this forum, but other users of this mailinglist maybe profit of this question too. I'm looking for a PHP-IDE for "LINUX / UNIX". I'm currently using bluefish but it seems, that the development for this programm has stoped. I'm sorry again, it's realy hard to find a good IDE for LINUX greet Martin --------- Martin AdlerCGI, Perl, PHP, MySQL Continum AG Tel. +49 761 4794090 Bötzinger Straße 29a Fax. +49 761 4794099 79111 Freiburg i. Br. http://www.continum.net Besuchen Sie uns auf der Orbit/Comdex Europe Basel, 24.-27.09.2002 -Halle 1.0, Stand B70 - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] TEXTAREA ...
That's right but if the variable is initialised by the form and you want to write the variable in to your html-document it's better to write this $content = nl2br(htmlentities(stripslashes($content))); - Original Message - From: "Martin Clifford" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, July 17, 2002 3:15 PM Subject: Re: [PHP-DB] TEXTAREA ... $content = nl2br($content); That will convert all newline characters into tags. HTH Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ >>> José Moreira <[EMAIL PROTECTED]> 07/17/02 09:15AM >>> hello ... im sorry to bother with a non-db question but i searched for this and got 0 record :P its all about the wrappig in textareas: how can i convert the end of line/ line breaks ['enter' keys] that the user hits while filling a textarea so that when i display the record content the text does break where the user intended ??? ex.: bla blah blah bla blah blah if i echo() this textarea value i will apear in a single line even if the user pressed enter 2 break the line -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: prevent results
Hi, i found a solution by myself i think it's very complex but may help others for finding solutions Thats the query: SELECT entries.id, entries.head, entries.date, entries.author FROM entries LEFT JOIN category ON entries.cat_no REGEXP CONCAT("\\.",category.id,"(\\.|$)") LEFT JOIN entgroup ON entries.id = entgroup.eid LEFT JOIN catgroup ON category.id = catgroup.cid LEFT JOIN mzgroup AS mze ON mze.id = entgroup.gid LEFT JOIN mzgroup AS mzc ON mzc.id = catgroup.gid WHERE MATCH (head,text) AGAINST ("Who's not") && (entgroup.gid IS NULL || entgroup.gid = *user-group-id*) GROUP BY entries.id HAVING min(catgroup.gid IS NULL || catgroup.gid = *user-group-id*)<>0; This is the result if all conditions are true otherwise i get none ++---++--+ | id | head | date | author | ++---+----+--+ | 6 | Who's not ... | 2002-06-13 | Martin Adler | ++---++--+ the soluton for my former problem is in the HAVING clause the stuff in the min()-function returns only 1 when the category have the same group-id as the user or the category don't have a group-id otherwise it returns 0 this condition is executet for every row in the table. If there's no conflict with the user-rights in "every" row should be 1 the result of the condition The min()-function selects the smallest value, if everything is Ok the value is 1 and i get my result if not the value is 0 and 0 <> 0 isn't true and i don't get a result if anyone have a questions about this query just mail me i'll try to help i also thank everyone who tried to help me to find a soluton and if anyone have a better solution please let me know Martin - Original Message - From: "Martin Adler" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, June 26, 2002 9:19 AM Subject: prevent results > Hi, > > unfortunately I still stand before the same problem > is it possible to force mysql in a SELECT clause depend on a > condition to prevent results? > I would be happy and grateful for every help > > OK here is my Query > > SELECT entries.id, entries.head, entries.date, entries.author, (catgroup.gid > IS NULL || catgroup.gid = *user-group-id*) AS indi > FROM entries > LEFT JOIN category ON entries.cat_no REGEXP > CONCAT("\\.",category.id,"(\\.|$)") > LEFT JOIN entgroup ON entries.id = entgroup.eid > LEFT JOIN catgroup ON category.id = catgroup.cid > LEFT JOIN mzgroup AS mze ON mze.id = entgroup.gid > LEFT JOIN mzgroup AS mzc ON mzc.id = catgroup.gid > WHERE > MATCH (head,text) AGAINST ("Who's not") && > (entgroup.gid IS NULL || entgroup.gid = *user-group-id*); > > > With thies query, i try to get a entry with a fulltext search. > The entry should only be shown if the entry-group-id is NULL or > is the same as the user-group-id and > if all category-group-id's above the entry is NULL or > is the same as the user-group-id > > With "GROUP BY indi" i'll get maximally 2 results with which i can handle > easy in PHP > but i want to try it in MySQL. > Maybe someone knows a cleaner solution > > This is the result: > ++---++--+--+ > | id | head | date | author | indi | > ++---++--+--+ > | 6 | Who's not ... | 2002-06-13 | Martin Adler |1 | > | 6 | Who's not ... | 2002-06-13 | Martin Adler |0 | > | 6 | Who's not ... | 2002-06-13 | Martin Adler |1 | > ++---++--+--+ > > > Here are the used tables > > Table entries > ++-+-+---++--+-- > ---+-- -- > --+ > | id | uid | cat_no | head | date | author | text > | keywd | > ++-+-+---++--+-- > -------+-- -- > --+ > | 1 | 1 | 0.1.3.8 | Headline | 2002-03-12 | Martin Adler | Some Text > | keywords | > | 2 | 2 | 0.1.2 | Mittagessen | 2002-04-03 | Martin Adler | > Fruehjahrsputz | Spring > | > | 3 | 4 | 0.1.2 | Hausboot | 2002-04-03 | Martin Adler | > Quarktasche | Summer > | > | 4 |
[PHP-DB] prevent results
Hi, unfortunately I still stand before the same problem is it possible to force mysql in a SELECT clause depend on a condition to prevent results? I would be happy and grateful for every help OK here is my Query SELECT entries.id, entries.head, entries.date, entries.author, (catgroup.gid IS NULL || catgroup.gid = *user-group-id*) AS indi FROM entries LEFT JOIN category ON entries.cat_no REGEXP CONCAT("\\.",category.id,"(\\.|$)") LEFT JOIN entgroup ON entries.id = entgroup.eid LEFT JOIN catgroup ON category.id = catgroup.cid LEFT JOIN mzgroup AS mze ON mze.id = entgroup.gid LEFT JOIN mzgroup AS mzc ON mzc.id = catgroup.gid WHERE MATCH (head,text) AGAINST ("Who's not") && (entgroup.gid IS NULL || entgroup.gid = *user-group-id*); With thies query, i try to get a entry with a fulltext search. The entry should only be shown if the entry-group-id is NULL or is the same as the user-group-id and if all category-group-id's above the entry is NULL or is the same as the user-group-id With "GROUP BY indi" i'll get maximally 2 results with which i can handle easy in PHP but i want to try it in MySQL. Maybe someone knows a cleaner solution This is the result: ++---++--+--+ | id | head | date | author | indi | ++---+----+------+--+ | 6 | Who's not ... | 2002-06-13 | Martin Adler |1 | | 6 | Who's not ... | 2002-06-13 | Martin Adler |0 | | 6 | Who's not ... | 2002-06-13 | Martin Adler |1 | ++---++--+--+ Here are the used tables Table entries ++-+-+---++--+-- ---+ --+ | id | uid | cat_no | head | date | author | text | keywd| ++-+-+---++--+-- ---+-------- --+ | 1 | 1 | 0.1.3.8 | Headline | 2002-03-12 | Martin Adler | Some Text | keywords | | 2 | 2 | 0.1.2 | Mittagessen | 2002-04-03 | Martin Adler | Fruehjahrsputz | Spring | | 3 | 4 | 0.1.2 | Hausboot | 2002-04-03 | Martin Adler | Quarktasche | Summer | | 4 | 2 | 0.1.2.21.22 | Kongo | 2002-04-04 | Martin Adler | Kebup | Springer | | 5 | 2 | 0.1.3 | Hanfkissen| 2002-04-04 | Martin Adler | Bananen sind lecker!| Palmen Testwagen Radiergummi | | 6 | 2 | 0.1.2.24| Who's not ... | 2002-06-13 | Martin Adler | .in the group technik shouldn't be able to read this | | ++-+-+---++--+-- ---+ --+ * These are the entries, which are assigned to the categories Table category | id | cat_no | cat | +++---+ | 1 | 0 | ROOT | | 2 | 0.1| Hardware | | 3 | 0.1| Software | | 4 | 0.1.2 | HP| | 5 | 0.1.2.4| e-pc | | 6 | 0.1.2.4.5 | CD-Brenner| | 7 | 0.1.2 | PC| | 8 | 0.1.3 | php | | 9 | 0.1.3.8| rekursiv | | 10 | 0.1.3.8.9 | path | | 12 | 0.1.3.8.9.10.11| kategorie12 | | 15 | 0.1.3.8.9.10.11| kategorie15 | | 16 | 0.1.3.8.9.10.11| kategorie16 | | 17 | 0.1.3.8.9.10.11| kategorie17 | | 20 | 0.1.3.8.9.10.11.12 | kategorie20 | | 21 | 0.1.2 | Netzwerktechnik | | 22 | 0.1.2.21 | Router u. L3-Switches | | 24 | 0.1.2 | abba | +++---+ * cat_no is the Hierarchy --HP is a subdir of Hardware and Hardware is a subdir of ROOT and ROOT is the topleveldir Table mzgroup ++-+ | id | name| ++-+ | 1 | nobody | | 2 | technik | ++-+ Table catgroup +-+-+ | gid | cid | +-+-+ | 2 | 24 | | 2 | 23 | | 1 | 2 | +-+-+ * gid = group id, eid = category id Table entgroup +-+-+ | gid | eid | +-+-+ | 2 | 6 | +-+-+ * gid = group id, eid = entries id thank's sincerely Martin - Martin Adler CGI, Perl, PHP Continum AG Tel. +49 761 4
Re: [PHP-DB] force no results
Thans for awnsering! OK here is my Query SELECT entries.id, entries.head, entries.date, entries.author, (catgroup.gid IS NULL || catgroup.gid = *user-group-id*) AS indi FROM entries LEFT JOIN category ON entries.cat_no REGEXP CONCAT("\\.",category.id,"(\\.|$)") LEFT JOIN entgroup ON entries.id = entgroup.eid LEFT JOIN catgroup ON category.id = catgroup.cid LEFT JOIN mzgroup AS mze ON mze.id = entgroup.gid LEFT JOIN mzgroup AS mzc ON mzc.id = catgroup.gid WHERE MATCH (head,text) AGAINST ("Who's not") && (entgroup.gid IS NULL || entgroup.gid = *user-group-id*); With thies query, i try to get a entry with a fulltext search. The entry should only be shown if the entry-group-id is NULL or is the same as the user-group-id and if all category-group-id's above the entry is NULL or is the same as the user-group-id With "GROUP BY indi" i'll get maximally 2 results with which i can handle easy in PHP but i want to try it in MySQL. Maybe someone knows a cleaner solution This is the result: ++---++--+--+ | id | head | date | author | indi | ++---+----+------+--+ | 6 | Who's not ... | 2002-06-13 | Martin Adler |1 | | 6 | Who's not ... | 2002-06-13 | Martin Adler |0 | | 6 | Who's not ... | 2002-06-13 | Martin Adler |1 | ++---++--+--+ Here are the used tables Table entries ++-+-+---++--+-- ---+ --+ | id | uid | cat_no | head | date | author | text | keywd| ++-+-+---++--+-- ---+-------- --+ | 1 | 1 | 0.1.3.8 | Headline | 2002-03-12 | Martin Adler | Some Text | keywords | | 2 | 2 | 0.1.2 | Mittagessen | 2002-04-03 | Martin Adler | Fruehjahrsputz | Spring | | 3 | 4 | 0.1.2 | Hausboot | 2002-04-03 | Martin Adler | Quarktasche | Summer | | 4 | 2 | 0.1.2.21.22 | Kongo | 2002-04-04 | Martin Adler | Kebup | Springer | | 5 | 2 | 0.1.3 | Hanfkissen| 2002-04-04 | Martin Adler | Bananen sind lecker!| Palmen Testwagen Radiergummi | | 6 | 2 | 0.1.2.24| Who's not ... | 2002-06-13 | Martin Adler | .in the group technik shouldn't be able to read this | | ++-+-+---++--+-- ---+ --+ * These are the entries, which are assigned to the categories Table category | id | cat_no | cat | +++---+ | 1 | 0 | ROOT | | 2 | 0.1| Hardware | | 3 | 0.1| Software | | 4 | 0.1.2 | HP| | 5 | 0.1.2.4| e-pc | | 6 | 0.1.2.4.5 | CD-Brenner| | 7 | 0.1.2 | PC| | 8 | 0.1.3 | php | | 9 | 0.1.3.8| rekursiv | | 10 | 0.1.3.8.9 | path | | 12 | 0.1.3.8.9.10.11| kategorie12 | | 15 | 0.1.3.8.9.10.11| kategorie15 | | 16 | 0.1.3.8.9.10.11| kategorie16 | | 17 | 0.1.3.8.9.10.11| kategorie17 | | 20 | 0.1.3.8.9.10.11.12 | kategorie20 | | 21 | 0.1.2 | Netzwerktechnik | | 22 | 0.1.2.21 | Router u. L3-Switches | | 24 | 0.1.2 | abba | +++---+ * cat_no is the Hierarchy --> HP is a subdir of Hardware and Hardware is a subdir of ROOT and ROOT is the topleveldir Table mzgroup ++-+ | id | name| ++-+ | 1 | nobody | | 2 | technik | ++-+ Table catgroup +-+-+ | gid | cid | +-+-+ | 2 | 24 | | 2 | 23 | | 1 | 2 | +-+-+ * gid = group id, eid = category id Table entgroup +-+-+ | gid | eid | +-+-+ | 2 | 6 | +-----+-+ * gid = group id, eid = entries id - Original Message - From: "Martin Adler" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, June 24, 2002 4:47 PM Subject: [PHP-DB] force no results > Hi, > > is it possible to force mysql in a SELECT clause depend on a > condition to give no results? > > for example: > I do a SELECT and get 3 rows as result,
[PHP-DB] force no results
Hi, is it possible to force mysql in a SELECT clause depend on a condition to give no results? for example: I do a SELECT and get 3 rows as result, but one row contains a value, which make the other rows worthless. and I won't get this results thank's sincerely Martin ----- Martin Adler CGI, Perl, PHP Continum AG Tel. +49 761 4794090 Bötzinger Straße 29a Fax. +49 761 4794099 79111 Freiburg i. Br. http://www.continum.net - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: REGEXP problem
Ok I've found a solution ON entries.cat_no REGEXP CONCAT("\\.",category.id,"(\\.|$)") but nevertheless thanks too all Martin > Hi, > > I working with this query > SELECT * FROM entries LEFT JOIN category ON entries.cat_no REGEXP > "\\."+category.id+"(\\.|$)" LEFT JOIN entgroup ON entries.id = entgroup.eid > LEFT JOIN catgroup ON category.id = catgroup.cid LEFT JOIN mzgroup ON > mzgroup.id = entgroup.gid || catgroup.gid WHERE entries.cat_no REGEXP > "\\.24(\\.|$)"; > > interessting for me ist only this part > > ON entries.cat_no REGEXP "\\."+category.id+"(\\.|$)" > > i'll get this result from mysql > > ++-+--+---++--+- > +---+--++- -- > ---+--+--+--+--+--+-+ > | id | uid | cat_no | head | date | author | text > | keywd | id | cat_no | cat | gid | eid | gid | cid | id | name > | > ++-+--+---++--+- > ----+---+--++- -- > ---+--+--+--+--+--+-+ > | 6 | 2 | 0.1.2.24 | Wer nicht ... | 2002-06-13 | Martin Adler | .in der > Gruppe Technik ist soll dies nicht lesen können | |1 | 0 | > ROOT | NULL | NULL | NULL | NULL | NULL | NULL| > | 6 | 2 | 0.1.2.24 | Wer nicht ... | 2002-06-13 | Martin Adler | .in der > Gruppe Technik ist soll dies nicht lesen können | |2 | 0.1| > Hardware | NULL | NULL | NULL | NULL | NULL | NULL| > | 6 | 2 | 0.1.2.24 | Wer nicht ... | 2002-06-13 | Martin Adler | .in der > Gruppe Technik ist soll dies nicht lesen können | |4 | 0.1.2 | HP > | NULL | NULL | NULL | NULL | NULL | NULL| > | 6 | 2 | 0.1.2.24 | Wer nicht ... | 2002-06-13 | Martin Adler | .in der > Gruppe Technik ist soll dies nicht lesen können | | 24 | 0.1.2 | > abba | NULL | NULL |2 | 24 |2 | technik | > ++-+--+---++--+- > +---+--++- -- > ---+--+--+--+--+--+-+ > > with the REGEXP i hope to get all categories where id is listed in the > cat_no from the entries table. cat_no should show a thread but the 3'rd > result isn't part of the cat_no so REGEXP don't work how i expected > How can i fix this? > > thans for help > > Martin > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] REGEXP problem
sorry, a bug of my e-mailclient quotes some charaters now without slashes ;-) # Hi, I working with this query SELECT * FROM entries LEFT JOIN category ON entries.cat_no REGEXP "\\."+category.id+"(\\.|$)" LEFT JOIN entgroup ON entries.id = entgroup.eid LEFT JOIN catgroup ON category.id = catgroup.cid LEFT JOIN mzgroup ON mzgroup.id = entgroup.gid || catgroup.gid WHERE entries.cat_no REGEXP "\\.24(\\.|$)"; interessting for me ist only this part ON entries.cat_no REGEXP "\\."+category.id+"(\\.|$)" i'll get this result from mysql ++-+--+---++--+- +---+--++--- ---+--+--+--+--+--+-+ | id | uid | cat_no | head | date | author | text | keywd | id | cat_no | cat | gid | eid | gid | cid | id | name | ++-+--+---++--+- +---+--++--- ---+--+--+--+--+--+-+ | 6 | 2 | 0.1.2.24 | Wer nicht ... | 2002-06-13 | Martin Adler | .in der Gruppe Technik ist soll dies nicht lesen können | |1 | 0 | ROOT | NULL | NULL | NULL | NULL | NULL | NULL| | 6 | 2 | 0.1.2.24 | Wer nicht ... | 2002-06-13 | Martin Adler | .in der Gruppe Technik ist soll dies nicht lesen können | |2 | 0.1| Hardware | NULL | NULL | NULL | NULL | NULL | NULL| | 6 | 2 | 0.1.2.24 | Wer nicht ... | 2002-06-13 | Martin Adler | .in der Gruppe Technik ist soll dies nicht lesen können | |4 | 0.1.2 | HP | NULL | NULL | NULL | NULL | NULL | NULL| | 6 | 2 | 0.1.2.24 | Wer nicht ... | 2002-06-13 | Martin Adler | .in der Gruppe Technik ist soll dies nicht lesen können | | 24 | 0.1.2 | abba | NULL | NULL |2 | 24 |2 | technik | ++-+--+---++--+- +---+--++--- ---+--+--+--+--+--+-+ with the REGEXP i hope to get all categories where id is listed in the cat_no from the entries table. cat_no should show a thread but the 3'rd result isn't part of the cat_no so REGEXP don't work how i expected How can i fix this? thans for help Martin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] REGEXP problem
Hi, I working with this query SELECT * FROM entries LEFT JOIN category ON entries.cat_no REGEXP \".\"+category.id+\"(.|$)\" LEFT JOIN entgroup ON entries.id = entgroup.eid LEFT JOIN catgroup ON category.id = catgroup.cid LEFT JOIN mzgroup ON mzgroup.id = entgroup.gid || catgroup.gid WHERE entries.cat_no REGEXP \".24(.|$)\"; interessting for me ist only this part ON entries.cat_no REGEXP \".\"+category.id+\"(.|$)\" i\'ll get this result from mysql ++-+--+---++--+-+---+--++--+--+--+--+--+--+-+ | id | uid | cat_no | head | date | author | text | keywd | id | cat_no | cat | gid | eid | gid | cid | id | name| ++-+--+---++--+-+---+--++--+--+--+--+--+--+-+ | 6 | 2 | 0.1.2.24 | Wer nicht ... | 2002-06-13 | Martin Adler | .in der Gruppe Technik ist soll dies nicht lesen können | |1 | 0 | ROOT | NULL | NULL | NULL | NULL | NULL | NULL| | 6 | 2 | 0.1.2.24 | Wer nicht ... | 2002-06-13 | Martin Adler | .in der Gruppe Technik ist soll dies nicht lesen können | |2 | 0.1| Hardware | NULL | NULL | NULL | NULL | NULL | NULL| | 6 | 2 | 0.1.2.24 | Wer nicht ... | 2002-06-13 | Martin Adler | .in der Gruppe Technik ist soll dies nicht lesen können | |4 | 0.1.2 | HP | NULL | NULL | NULL | NULL | NULL | NULL| | 6 | 2 | 0.1.2.24 | Wer nicht ... | 2002-06-13 | Martin Adler | .in der Gruppe Technik ist soll dies nicht lesen können | | 24 | 0.1.2 | abba | NULL | NULL |2 | 24 |2 | technik | ++-+--+---++--+-+---+--++--+--+--+--+--+--+-+ with the REGEXP i hope to get all categories where id is listed in the cat_no from the entries table. cat_no should show a thread but the 3\'rd result isn\'t part of the cat_no so REGEXP don\'t work how i expected How can i fix this? thans for help Martin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php