Jump to content

Cyto

Members
  • Posts

    69
  • Joined

  • Last visited

Posts posted by Cyto

  1.     /*** a new dom object ***/
        $dom = new domDocument;
    
        /*** load the html into the object ***/
        @$dom->loadHTML($file);
    
        /*** discard white space ***/
        $dom->preserveWhiteSpace = false;
    
        /*** the table by its tag name ***/
        $tables = $dom->getElementsByTagName('table');
    
        /*** get all rows from the table ***/
        $rows = $tables->item(0)->getElementsByTagName('tr');
    
        /*** loop over the table rows ***/
        foreach ($rows as $row)
        {
            /*** get each column by tag name ***/
            $cols = $row->getElementsByTagName('a');
            /*** echo the values ***/
            echo $cols->item(0)->nodeValue.'<br />';
        } 

     

    Hi, Is there a way to start to echo from 43?

    thx.

  2. Hi,

     

    Can someone check wye this gives a empty array:

    $url = "http://www.someurl.com";
    $file = file_get_contents($url);
    $preg = '<a href='."'(.*)'".'><span class=window2 style="text-transform: capitalize">(.*)<\/span><br \/> [(.*)]<\/a>';
    preg_match_all('/'.$preg.'/i', $file, $m); //name
    
    print_r($m);

     

    Output:

    Array ( [0] => Array ( ) [1] => Array ( ) [2] => Array ( ) ) 

     

    I am trying to find a name link in a,span from another site, but gives me a empty array. Can someone help?

     

    thanks, Cyto

  3. Maybe:

     

    UPDATE `table` SET `string` = REPLACE(`string`, "'", '')

     

    If you need some kind of filtering add a WHERE clause.

    Thx, but nvm. I figured it out myself. I added mysql_real_escape_string() in the where clause. It added a slash to the quoted strings. Worked.

    Thank you too, teynon.

  4. Please post the rest of the code. I don't know what you are trying to do right now. Please post code, don't just try to restate what you just said.

     

    I'm trying to delete a row with a quote in a string and add a row with a quote in a string. The adding works with stripslashes, but the deleting part... I'm stuck there.

  5. Your trying to delete a row from your database based on the name value? We would need to see how it is stored in the database. Is it stored as Cyto's or Cyto/'s?

    It's stored as Cyto and I add 's, it becomes Cyto's. Ok it works, but when I want to delete a row with 's in a string(Cyto's), it returns as Cyto's back instead of Cyto.

     

    P.S Cyto as string is a example, there are other words.

  6. Hi,

     

    I'm trying to delete a string that's single quoted. From: Cyto's to Cyto, but doesn't work. It works when I add 's to the string with stripslashes, but I can't seem to delete a quote from a string.

    Does someone know how?

     

    My $_post code:

    $name=mysql_real_escape_string(stripslashes($_POST["ename"]));

     

    Cheers

     

  7. then you'll want..

     

    $getname = $_GET["name"];
    $name = str_replace(" "."'",$getname);

     

    will replace the space in the string with an apostrophe

     

    I know, but doesnt it replace the space too, it will output Papa's'Home instead of Papa's Home?

  8. okay so you'll use something like

     

    	$getname = $_GET["name"];
    $cleanname = array("-","/");
    $name = str_replace($cleanname,"'",$getname);

     

    $name should output papa's

     

    This works if the result were all with quotes, but it isn't. Then the names without a quote wouldn't work. I'm already adding the names with stripslashes. The name is already Papa's Home in the database. But I when i go to this link http://www.link.com/papa-s-home/, it querys papa s home. I need to add a quote somehow to strings like papa s, mama s etc. To get a result from the database.

  9. escape the quotes.

    $string = "Papa\'s Home";

     

    in this situation, you actually wouldn't have to, because I used double quotes on the outside, and a single quote inside, but if you're planning on putting this into a database you'll definitely need to escape your strings properly. look up mysql_real_escape_string, addslashes and stuff like that.

     

    good luck

     

    Another problem that I'm having:

    I want to get ($_GET) the name like this: Papa's, so i can get the result from the database..

    The url: http://www.link.com/papa-s-home/

    but i need to have papa's home with a quote to get a match from the database. So i need to add a quote at the empty spot Papa s, but how can i do this. My part of the code:

     

    $getname = $_GET["name"];
    $cleanname = array("-","/");
    $name=mysql_real_escape_string(str_replace($cleanname," ",$getname));
    

     

    I hope you'll understand it, sorry for my english :D

  10. Hey,

     

    I have this code:

    <script type="text/javascript">
    $(document).ready(function(){
    $('.rij2_content_fav').hide();
    $('.mijngames').click(function() {
    $('.rij2_content_fav').slideToggle('slow', function() {
    $('.rij2_content_fav').animate({left: "-=232px", top: "+=50px"});
    });
    });
    });
    </script>
    

     

    The code works, does his job, but it toggles only one time. I need to refresh page to toggle again. How can i fix this, so that it toggles when i click several times?

     

    Cheers.

  11. Hey,

     

    I have a while that shows the rows(duh). What i want to do is: show 3 rows then echo float left or clear both. So basically 3 at a time, but it shows all the rows in a nice order. Can someone do this?

     

    Cheers.

  12. Hey,

     

    Well when they view my website from home. We get the same (public)ip. Is there a way to tell that these people are not the same person, not using the same ip, because i am saving data from the ip(visitors). The others will get the same date too, because of the same ip. Or is there any other way to get a unique id(number) from visitors?

     

    Hope you understand.

    Cheers.

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