Announcement

Collapse
No announcement yet.

php entities and sql

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    php entities and sql

    I've just spent a frustrating couple of hours trying to get a bit of ODBC - PHP code to search on of the actinic tables, specifically looking for the brochure page that had sPageName="abc-123.html" or something like that.
    it took a while to realise that ms-access/odbc doesn't like the hyphen or the full-stop ( and probably other characters I have'nt yet discovered )
    so I ended up replacing any occurrance of "-" with chr(45) and any "." with chr(46)

    What I'd like to be able to do is call something (regexp?) or something and replace "-" and "." and anyother entity I later find with chr(?) strings but do everything in a single call.
    ms-sql will then happily find products once I have "abc&chr(45)&123&chr(46)&html" format

    can anyone share a bit of code that would make the replacements easier

    current code (that works)
    Code:
    $hyphen = "-";
    $partsOfField = explode($hyphen, $field);
    $newCode = $partsOfField[0];
    for($j = 1; $j < count($partsOfField); $j++){
    	$newProdCode = $newCode."'&Chr(45)&'".$partsOfField[$j];
    		}
    and then I call a similar loop for the "."


    kevin
Working...
X