-
Posts
11 -
Joined
-
Last visited
Never
Posts posted by rivan
-
-
It looks to me there is some error with heredoc strings you are using (in fact you have one closing brace too much but something with heredocs make php parser go wild)
-
Did you try regexp like variant?
select * from mapcontent where lower(content) rlike '[[:<:]]tea[[:>:]]'
(I am not expert in mysql so I am not sure how its regexp support works, this is just a hint )
-
You can redirect user after inserting data into db (that way refreshes of that page won't insert any new data)
-
You can do something like this (I usually solved similar problems that way) - SQL first
select t1.MainID, t1.Company, t2.SubID, t2.SubCompany from table1 t1 join table2 t2 on t1.MainID = t2.MainID order by t1.MainID
then in php something like
$last_company_id = -1; while (some_data_read()) { if ($last_company_id != $current_company_id) { if ($last_company_id != -1) echo "</item">; // to close that tag of previous main category $last_company_id = $current_company_id; echo "<item id='parent' value='$current_company'>"; // openning tag for new category } echo "<item id='child' value='$current_subcompany'/>"; } // now just finish last open main company if any if ($last_company_id != -1) echo "</item">;
I think you got the idea - remember main company you are working with currently, when it changes then create the new tag and do whatever necessary
-
First you can't nest form elements (it sounds to me like you are nesting them) - use only one form tag with both enctype and action - after posting that form _FILES array normaly would be filled with names of temporary files created (it is superglobal variable, so PHP would take care of setting it right), after working with those temporary files you should erase them
(I believe the only problem you have is with this form tag in html)
-
I agree wth you if persistance is needed (why original poster doesn't clear that :-) )
-
Well, I didn't understand that he needs unique IDs across runs - if that is the case then it is better to have unique column with sequence in every table and then to concatenate only that columns (I think that wouldn't look so ugly)
Anyway it sounds pretty meaningless to have persistent non-existent-in-database id of the row - what for you can use it if you are not storing it somewhere?
-
preg_match ("/^[a-z0-9][a-z0-9\-]+[a-z0-9](\.[a-z0-9][a-z0-9\-]+[a-z0-9])*(\.[a-z]{2,4})+$/i", $domain)
(added first part repeated 0 or more times with dot in front of it)
Regards
-
What you should do, is to create some script to
1. read data from db to memory (since it is not that huge number of records)
2. calculate similarity between entries (that is called minimal edit distance, you can find algorithms at http://en.wikipedia.org/wiki/Edit_distance) - better to use some heuristics when calculating this (for example only for strings that begin with same later, if starting with different letters you can say that edit distance is some big number like 99) - this can take considerable time
3. dump results in some text file with edit distance as first column
4. sort that file using sort command if you are using some unix
5. look from beginning of the file since edit distance will be sorted in increasing order
Hope that will help
-
You should use sequence to solve this (like somebody mentioned) - here is example
create sequence blahahaha; -- sequence creation - do this only once
then always append this nextval part to your query (to generate column with unique values)
select nextval('blahahaha') as unique_column, * from some_table
Regards
[SOLVED] Parse error on a function?
in PHP Coding Help
Posted
also mentioned above NO SPACES AFTER ; in heredoc end (you have spaces there too, very difficult to spot )