torvald_helmer
Members-
Posts
15 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
torvald_helmer's Achievements
Member (2/5)
0
Reputation
-
how to send selected value from drop down list to database
-
Thanks guys!!
-
how to create a drop down list with data from a database?
-
I want to select a row from a table where, e.g. name='george' instead of writing 'george', can I use a variable like this?: $xx = "george"; $result= mysql_query("SELECT * FROM Names WHERE name=$xx"); does this work? I know I could try this on my own, but I do not have access to a database to test with, and I am wondering if this is possible...
-
I have a html-file, which I want to extract the some content, and not any tag's. I thoguht I might start like this: $file = file("test.html"); foreach ($file as $line) { some code.... } A example is this line is the file: <tr><td class="felt">Car</td><td>Mercedes<br/></td></tr> How can I get just 'Car' and 'Mercedes' from this line? Has anyone got an idea? I really don't know where to go further... Need help!
-
Thanks! That worked like I wanted it. While I am at it, do you have some tips about how to extract text? In addition to html, head, body, meta-tags the html-file consist of a table, and each of there rows (<tr>) have some text I want to extract. E.g <tr><td class="field">Lecturer</td><td>Professor Robert Langdon<br/></td></tr> All rows has the same field class. When I see the first <td>, here with 'lecturer', I want to to get the content of the second <td>. The first td is the name of a coloum in my database, which will have the content of the second td.
-
Is there a way to print the html source code? $file = file_get_contents("text.html"); print_r($file); When I do this, it just shows the page as I would have seen it if I loaded the text.html in my browser. What I want is to print the source code, as this: <html> <body> texts and tags... </body> </html> Is there a way to do this?? I want this because I am making a script that reads text in xhtml-format and sending the text to a database. Instead of having pages with unstructured xhtml, I want to have it all in a database, structured form. So I need to now the tags, so I can get the text-content out of the tags and send it to databases.
-
I have two arrays, $arr1 and $arr2. Values in the first corresponds to the same index-values in the second. How do I sort these array's ascending according to $arr1?
-
I have a mulitarray. Each entry in the array consist of another array. Each of these consist of words, one word per index. array [ 0 = [arr1 = yellow, white, red] 1 = [arr2 = blue, red, green] 2 = [arr3 = violet, black, orange] ] Can I use in_array to see if a special word exists in all of these array? I mean does in_array work for multiarrays, will the function check all of the subarrays? And is there a way I can get the count of of how many array's the special word exist? E.g. take the word 'red' would have the count 2, because is exists in arr1 and arr2.
-
$files is the list of files, I use this to make sure I go through all files. $terms contain the all the words from one file
-
It didn't work quite as I want to. I have tried this, but it doesn't seem to work either: foreach($terms as $term) { /*array of terms from one file */ foreach($files as $file) { /*array of all files */ if(in_array($term, $file)) { $DF = 'increase variable by one for each time'; } } }
-
I want to count the number of documents that contains a specified term (word)? This is known as document frequency (DF). I have an array that contains a list of txt-files. Foreach of these files I read one, and foreach of the files I read each term (word). Inside these two loops I count how many times a term exist in one file, and I also remove multiple occurances of a term, so my result is an array of terms from a file (one occurance of each term), and an array with the number of times the word occur in the file. I also want to know in how many of the total number of files each of these terms exist? Can I do this inside the loop somehow? Or is there another smart way to solve this?
-
I uses the function in_array to find out if a specified word appears in a specified array, if it is there I want to get the index of this word in the array. So I can use this index to set a value in array2, at the same index. Jeg bruker in_array for å sjekke om et bestemt ord finnes i en bestemt array, hvis det finnes vil jeg få hentet ut indeksen dette ordet har i array'en. Så vil jeg legge inn et tall i en annen array på samme index som ordet. any good tips for this? if (in_array($word, $array1)) { $i = index_of_word($array); $array2[$i] = $number_to_put_in_same_index_as_the_word_in_array1; }
-
I have a script that reads all files from a folder and store it in an array(1), then it read the file content of all the txt-files, removes small words that have no relevanse for the content, and then save all remaining word into an array(2). What can I do to find out how many times a spesific word appears in a txt-file, and in how many of the files this spesific word appear. E.g. the word 'report' appears 7 times in txt-file 1, and also it appear in txt-file number 2 3 14 and 56. I want to for each of my files take the first word in the array(2) and find out how many times it appears in the first txt-file, and then in how many of the other files it also appear (here the number of occurance in each file is not important), then I want to start over with word number to in array(2) and do the whole procedure all over again. Any good tips for me?
-
I have created many linka i a table cell. They look like this: [code]<a href="?id=page2">page 2</a>[/code] When i press the links I want the php-page to load in another table cell, instead of going to a new page. I have used this php-code earlier on a different server, and it works just fine. But on my new server there is php5, don't know if that is the problem why it will not work. Therefore I need you pro help: [code] <?php if (!$id) {include("firstpage.php");} /*default page, will load first, and it does, but rest don't work */ elseif (!is_file("$id.php")) {echo 'Page is under construction.';} else {include("$id.php");} ?> [/code] When I press the links, the query line will look like this; http://www.blablabla.com/?id=page2 Does anyone have a clue?