1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Pulling records from mySQL...

Discussion in 'PHP' started by SEbasic, Sep 23, 2005.

  1. SEbasic

    SEbasic Peon

    Messages:
    6,317
    Likes Received:
    318
    Best Answers:
    0
    Trophy Points:
    0
    #61
    phpinposts.php now reads:
            ob_start();
            echo "<pre>$phpcode</pre>";
            eval($phpcode);
            $data = $before.ob_get_clean().$after;
    PHP:
    See this to see the messages - there are a lot of them.... :|
     
    SEbasic, Oct 17, 2005 IP
  2. johnt

    johnt Peon

    Messages:
    178
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #62
    $mysql_access = mysql_connect("127.0.0.1″, "stretch", "6244happy") or die("Cannot connect to DB!"); 
    PHP:
    Is the problem line - after the 127.0.0.1 the next character is not a double quote, as it shoud be, but is the entity &#8243; which shows angled double quotes and is the html named entity &Prime;

    I have sometimes seen issues like this when code gets edited in MS Word, which can change characters from what was typed in to something else because it thinks it looks prettier.

    Where is the code coming from ?
     
    johnt, Oct 17, 2005 IP
  3. SEbasic

    SEbasic Peon

    Messages:
    6,317
    Likes Received:
    318
    Best Answers:
    0
    Trophy Points:
    0
    #63
    It's actually coming from TextPad... :|

    Weird - I've never seen it change characters like that before... I must have cocked up somewhere along the line...

    I've just checked, rechecked, and checked again that none of them were anything other than "...

    I'm still getting the same thing...

    I'm gonna have a play for a bit - Never know I could get lucky...

    You must spread some Reputation around before giving it to johnt again.
     
    SEbasic, Oct 17, 2005 IP
  4. johnt

    johnt Peon

    Messages:
    178
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #64
    In the function run_php, after the lines
    
        $data = str_replace("&Prime;", '"', $data);
        $data = str_replace("&prime;", "'", $data);
    
    PHP:
    add
    
        $data = str_replace("&8243;", '"', $data);
        $data = str_replace("&8242;", "'", $data);
    
    PHP:
    Those are the html entity numbers which represent &Prime; and &prime; - clearly this code was anticipating that the characters " and ' could replaced, but the author forgot to cater for the numeric way of addressing an entity.
     
    johnt, Oct 17, 2005 IP