Jump to content

the_oliver

Members
  • Posts

    364
  • Joined

  • Last visited

    Never

Posts posted by the_oliver

  1. This is probably due to the charictor type.  You can try setting:

     

    header("Content-Type: text/html; charset=utf-8");

     

    The best option would be to replace the symbole with its HTML Code.  Eg: £ becomes £

     

    http://www.ascii.cl/htmlcodes.htm is very usefull.  You can always do a search and replace as data comes out of the database onto a page if needs be.

     

    Hope that helps

  2. Hello,

     

    Im trying to search for a charictor in a string using the following.

     

    	$arr = array("\"","<",">");
    if (strpos($field, $arr) === false) {
          }

     

    if i specify a charictor instaead of using $arr it works fine, however if i use and array ($arr) it won't work. 

    I need to search for more then one charictor!

     

    Can anyone tell me a good way round this?

     

    Thanks!

  3. I think that must have been a typo.

     

    I ran:

    $htmlurl = "e011_Again_It's_!_$_&_'_(_)_|_\\\"_;_:_\_._<_>_`.htm";
    $en = urlencode($htmlurl);
    echo $en."<br>";        //ENCODED
    echo $htmlurl."<br>"; //PLAIN
    echo urldecode($htmlurl);

    //DECODED

     

    And got

    e011_Again_It%27s_%21_%26_%27_%28_%29_%7C_%5C%22_%3B_%3A_%5C_._%3C_%3E_%60.htm

    e011_Again_It's_!_&_'_(_)_|_\"_;_:_\_._<_>_`.htm

    e011_Again_It's_!_&_'_(_)_|_\"_;_:_\_._<_>_`.htm

     

     

     

    Thanks for your help so far!

  4. Actual file name:

    e011_Again_It's_!_$_&_'_(_)_|_\"_;_:_\_._<_>_`.htm

    Code:

    $htmlurl = "e011_Again_It's_!_$_&_'_(_)_|_\\\"_;_:_\_._<_>_`.htm";
    $text .= "<a href=\"".urlencode($htmlurl)."\" target=\"blank\">$htmlurl</a>";
    

    If i do View Source:

    <p>Your newsletter has been published as a web page.</p><p>It can be viewed online at: <a href="e011_Again_It%27s_%21_%26_%27_%28_%29_%7C_%22_%3B_%3A_%5C_._%3C_%3E_%60.htm" target="blank">e011_Again_It's_!_&_'_(_)_|_"_;_:_\_._<_>_`.htm</a>

     

  5. Hello,

     

    I tried all the options on that page and always got something like:

    e011_Again_It's_!_$_&_'_(_)_|_/%22_;_:_/_._%3C_%3E_`.htm in the link rather then the

    e011_Again_It's_!_$_&_'_(_)_|_\"_;_:_\_._<_>_`.htm  i was expecting.

     

    (sory its so long!  Just checking to see what causes problems!)

     

    They all replacesd the symbols with something else, rater then just telling it to do something like skip over them.

     

    Thanks.

  6. Hello.

     

    I have a files which could be something like:

     

    gunk>stuff"yes.htm

     

    But when i link to them this causes havouc with the HTML!  I tried relpacing them with \> and \"  but that didn't make any diffrence.  Whats the way round this?

     

    Thanks.

  7. Hello,

     

    Can someone tell me what im doing wrong with the code bellow please?  I get print_ticket called lots of times, with 1 as the hash,name,ticket_no responce.

     

    (i have chequed that the query is returning the right results).

     

    $return = pg_query($pg_connection, $query);
            $data   = pg_fetch_array($return);                   
    
    foreach ( $data as $temp ) {
        
    echo print_ticket ($temp['hash'],$temp['name'],$temp['ticket_no']);
            
    }

  8. Thanks.  Worked well other then with the < charictor.  ( the output i was expecting was \> )

     

    Im trying:

    $str            = "<";
    $invalied_chars = array("<");
    $writein        = array("\\<");
    $result         = str_replace($invalied_chars, $writein, $str);
    
    echo $result;

     

    I also tried:

    $writein        = array("\\<");

    and got the output \\

     

    And

    $str            = "<";

    and got the output \\\

     

    Can any one suggest where im wrong?

     

    Thanks!

     

     

    EDIT: i cant use < of char() as it will end up being output to create a unix file name, not for web output.

  9. Hello,

     

    Im using the following to search for charictors in a string that are causing problems, and placing a \ infrount of them.  Im trying to do it using:

     

    <?php
    $str = "string's";
    $invalied_chars = array(" ", "'");
    $result = str_replace($invalied_chars, "\\", $str);
    echo $result;
    ?>
    

     

    The bit im confused by was how to keep the old charictor, just proceeding it with a \ rather then replacing it?

     

    Thanks

     

     

  10. mail($EmailTo, $Subject, $Body, $mail_header, "From: <$from>");

     

    Hello im trying to set the from address in an email, but when i do it with the above it doesnt work!  Instead it stops the header being set to HTML and shows that code.  Can any one tell me where im going wrong?

     

    Also how can i send attatchments with an email?

     

    Thanks!

  11. Thanks. As stage further!  I tried the code below.  Strange thig was that both $t_holder and $t_holder2 came out as 6

     

    The data returned from the query was:

    tickets | pitch

    ---------+-------

    1      | 2

    1      | 0

    1      | 0

    1      | 1

    1      | 0

    1      | 0

    2      | 0

    1      | 0

    1      | 1

    1      | 1

    (10 rows)

     

    // Calculate the total number of tickets sold and pitches required
    $query1         = "SELECT tickets,pitch FROM t_order_numbers WHERE paypal_confirmed = 'true'";
    $t_totals       = pg_query($pg_connection, $query1);
    $t_data         = pg_fetch_array($t_totals);
    
    $t_holder       = 0; // Holder for the finnal ticket total (paid for)
    $t_holder2      = 0; // Holder for the finnal pitch total required
    
    foreach ( $t_data as $temp ) {
            $store = $t_holder;
            $t_holder = $store + $temp['tickets'] ;
            $store2 = $t_holder2;
            $t_holder2 = $store2 + $temp['pitches'];
    }

  12. Hello,

     

    Im trying to get some data from a database and then add all of the entries in each columb to get the total for each columb.  I tried it with the following code but got the error: Warning: Invalid argument supplied for foreach()

     

     

    Thanks for any help!

     

     

    // Calculate the total number of tickets sold and pitches required
    $query1         = "SELECT tickets,pitch FROM t_order_numbers WHERE paypal_confirmed = 'true'";
    $t_totals       = pg_query($pg_connection, $query1);
    $t_data         = pg_fetch_array($t_totals);
    
    $t_holder       = 0; // Holder for the finnal ticket total (paid for)
    $t_holder2      = 0; // Holder for the finnal pitch total required
    
    foreach ( $t_data['tickets'] as $temp ) {
            $store = $t_holder;
            $t_holder = $store + $temp;
    }
    
    foreach ( $t_data['pitches'] as $temp2 ) {
            $store2 = $t_holder2;
            $t_holder2 = $store2 + $temp2;
    
    }

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