Jump to content

aQ

Members
  • Posts

    66
  • Joined

  • Last visited

    Never

Posts posted by aQ

  1. Hello!

     

    I'm developing a website where I use some RSS data from an external source. The data comes in UTF-8-format. I get data from my database to find the RSS-feed I want. The problem is that the data from the database comes out like this: http://www.yr.no/sted/Norge/S�r-Tr�ndelag/Trondheim/Trondheim/varsel.xml. The �'s are æ's ø's and å's, all nordic special letters. How do I change the character set in MySQL (PhpMyAdmin).

     

    I have tried to change it under "Operations", where I changed it to "utf8_swedish_ci". Does anyone know what to do?

  2. Hello there!

     

    I'm trying to get some regexp working, but I haven't done this before, so I need some help.

    I have a text-document with a lot of links I want to get rid of. The syntax of the links are "http://www.yr.no/stad/Noreg/*SOMETHING*/*SOMETHING*/*SOMETHING*/varsel.xml". "*SOMETHING*" is different from link to link. The links does also contain Scandinavian letters like Æ Ø and Å (æ ø and å).

     

    At the moment, I've got this, but it doesn't work:

    $file = file_get_contents("viktigestader.txt");
    
    $find = array("http:\/\/www.yr.no\/stad\/Noreg\/.+\/.+\/.+\/varsel.xml");
    $replace = array("");
    $done = preg_replace($find, $replace, $file);
    print $done;
    

     

    I hope you could help me out.

  3. Hello!

     

    I'm trying to use MagpieRSS to get the new mails from my gmail account. I don't want my mail to be cached on my server (which will be a security issue), so I want to disable caching for that feed. I use the same Magpie for other feeds, which I would like to still cache.

     

    Is there a way I could do something like this: "$cache = 0" with magpie?

    Magpie can be downloaded from http://magpierss.sourceforge.net/.

     

    Thank you very much if you could help!  ;)

  4. Hello!

     

    I have got an array. In this array, there are multiple arrays. I want to show some of the info in one of the arrays which are inside the main-array. It's like this:

    $array = Array(

    [test] => Test,

    [lala] => Array(with content in it)....

    );

     

    I thought I just could say "print $array[lala][0];", and it would give me the first value of "lala" in the $array. This does not work, so how can I do it then?

    Thank you.

  5. It won't work. Here is my code:

     

     

    			$file = file_get_contents("file.php");
    		$mods = explode("---", $var);
    		print "<textarea rows=50 cols=50>".$file."</textarea>";
    		$totalmods = count($mods)-3;
    		$find = $_POST[move2];
    		$replace = $_POST[move1];
    		$i = -1;
    		while($i++ <= $totalmods){
    			if($mods[$i] == $_POST[move1]){
    				print "<p>$_POST[move1]<p>";
    				$rmod = str_replace('$var .= "'.$mods[$i].'---";', '$var .= "'.$find.'---";', $file);
    			}
    			if($mods[$i] == $_POST[move2]){
    				print "<p>$_POST[move2]<p>";
    				$rmod = str_replace('$var .= "'.$mods[$i].'---";', '$var .= "'.$replace.'---";', $file);
    			}
    		}
    		print "<textarea rows=50 cols=50>".$rmod."</textarea>";

  6. Hello!

     

    I am trying to move change place of two values of a variable, but it won't work.

    $var = "";
    $var .= "value---";
    $var .= "anotherValue---";
    $var .= "thirdValue---";
    $var .= "andTheLastOne---";
    

     

    This is what I've got. I use the explode function to divide the variable into an array. Then I want to move "thirdValue---" to "andTheLastOne---", and "andTheLastOne---" to "thirdValue---". Basically to change the values' positions. I have tried using str_replace, but when I replace andTheLastOne--- with thirdValue---, I don't know where to put in andTheLastOne---, I get two thirdValue---, and no andTheLastOne---. You see?

     

    It would be great if someone could help me.

    Thanks.

×
×
  • 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.