Jump to content

Oxymen

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Oxymen's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi. I am trying to store/read information from a xml file using simplexml_load_file(). This works just fine until I want to store special characters like "æ,ø,å". This returned an error saying that the input was not proper UTF-8. So I used utf8_encode() and utf8_decode() when writing and reading the data. this seemed to work just fine untill I tried to use it in IE.. Firefox returns the characters as they should be, but IE returns either questionmarks or some other spesiel character. Is it any way to work around the UTF-8 encoding which works without buggs? thanks a lot.
  2. Thanks a lot! That works beautifully. Just what I wanted. Now I learned something today too  :)
  3. Thanks, Ronald, that code was exactly what I was looking for. It was exactly like mine, just I have not used foreach before, so I didn't know about it. Now I only have one more request to ask on this subject. This is only for cosmetic reasons, but I want to make the top three names be bold and the top one to have a bit larger font, then the second would have a slightly smaller font. To do this I would need to isolate the top three results. Is this possible with the current code?
  4. Hi. I have a script where I get names and values which are related to each other. something like $name=bob $bobsvalue=3.32 I need to be able to sort all the names according to their value so that if I had another name $name=ted $tedsvalue=5.23 This will be echoed before the first because the value is higher. Untill now I only needed the highest number so I just ran the names and values through a for loop and checked the highest recorded value to the current value and updated if the current value was higher than the highest. But now I need to echo every name and value and sort them. So the above example would echo: Ted - 5.23 Bob - 3.32 I tried to do this with arrays, but I couldnt do it with the relation so all my attemts would sort the numbers and the names differently. How can I sort this information by the values and keep the names with the right value? Thanks! :D
  5. Thanks Barand, I didnt think of that sollution, that will work.
  6. Hi. I am making a mysql table where there is always a posibility that a cell is empty. i will try to illustrate: [table] [tr] [td]Firstname[/td][td]Lastname[/td] [/tr] [tr] [td]Bob[/td][td]Larsen[/td] [/tr] [tr] [td]Lyle[/td][td][/td] [/tr] [tr] [td]Brian[/td][td]Holmes[/td] [/tr][/table] I want my form to insert the next lastname that is submitted into row two as this is empty. The first and last names have no relationship as this is only a database of names, and I dont want to make one table for firstnames and one table for second names. but still I dont want to have holes in the table. I also need a way to get the last row of first and second name individualy, not just the last row in the table, to hinder that empty rows are outputted later. Thanks a lot!!!
  7. Hi. I want to be able to upload images to my webserver from a form on a page. I use the upload script from the tutorial here on phpfreaksm but that, (like many other I tried) does absolutely nothing. All that happens is that it seems to reload the page with a blank form. no upload, no error/succes messages and no uploaded files. the script is locatet here: [a href=\"http://nesvico.com/upload.php\" target=\"_blank\"]http://nesvico.com/upload.php[/a] Annyone know whats wrong? thanks a lot
  8. my table have these columns: id, title and ranking No two rows should have the same ranking number. The ranking number is for the ordering when I shal output the results. a low ranking means high placement in the output list. so if my table conains id | title | ranking 1 | Group1 | 2 2 | Group2 | 1 group2 with id 2 will come first. What I want to do is to be able to change these ranking numbers in my admin page. this means that if I want to move an entry up the list, the ranking is lowered by one for this item. This also means that I have to make the entry with the previuos ranking the moved entry got, obtain the old ranking of the moved entry to ensure that no rows contains the same ranking number. I hope that made sense..
  9. Hi. I am making a page where I can edit my links. I have created two buttons which when clicked moves the link up or down the list by changing a ranking number in the mysql database. At first, my code seemed to work just fine untill i added a few more links and just moved them up and down at random to check that everything works as it should. at some point some links started to get the same ranking number, which messed up the whole list. The code is: [code]if (isset($_POST['group_up'])) { if ($_POST['upvalue']==1) { header( 'location:menu.php' ); } else { $old = $_POST['upvalue']; $up = $_POST['upvalue']-1; $up_id = $_POST['group_id']; $conn = mysql_connect("$db_host","$db_user","$db_pass"); if (!$conn) die ("Could not connect MySQL"); mysql_select_db($db_database,$conn) or die ("Could not open database"); $query = "UPDATE menu_groups SET ranking = $old WHERE ranking = $up;"; mysql_query($query) or die('Error, query failed'); $query = "UPDATE menu_groups SET ranking = $up WHERE group_id = $up_id;"; mysql_query($query) or die('Error, query failed'); } }[/code] And similar for the down button just it adds to the upvalue istead of subtract. Annyone notice why this code bugs? Also if you have suggestions on how to do this another way please tell me. Thanks for your help
×
×
  • 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.