That didn't do it either. I should have been more specific. I can display
correct results in a HTML table. I have a Edit (A href) link to edit the
current record. ie...
<?php
include('../db/junction.php'); //DB Connection - MSSQL 2000
include('header.php');
...
$sql = "SELECT tblcustomer.id, tblseacust.ARC_NAME,cust, type\n";
$sql .= "FROM tblcustomer\n";
$sql .= "LEFT JOIN tblseacust ON tblcustomer.custclass=tblseacust.id\n";
$rst = mssql_query($sql);
...
while($row = mssql_fetch_array($rst)) {
echo "<tr>\n";
echo "<td align=center>\n";
echo "<font face=\"Arial\" size=2>";
echo "<a
href=\"custmaint.php?id=$row[0]&class=$row[1]&cust=$row[2]&type=$row[3]\"><i
mg alt=\"Edit\" src=\"images/edit.gif\" height=\"24\" width=\"24\"
border=\"0\" /></a>";
echo "</td>\n";
Rendered results of <a href...> =
http://company.com/custmaint.php?id=70&class=&cust=company T/T #29&type=OEM
id is the record id
class is Null so that's OK.
cust=company T/T #29
type=OEM
I present the info in a form...
echo "<td>\n";
echo "<input type=\"text\" name=\"cust\" value=\"$cust\">\n";
echo "</td>\n";
This gives me:
+------------------------+
|company T/T |
+------------------------+
*Note lack of #29 which I do see in the HTML table. If I save (UPDATE WHERE
id=$id) this record cust will now be company T/T
All the other fields fill in correctly. Is it seeing the # as a comment?
-----Original Message-----
From: Richard Baskett [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 11, 2002 3:57 PM
To: Mike Smith; PHP General
Subject: Re: [PHP] Escaping '#' Sign
Why don't you just try:
$cust2 = str_replace('#','#',$cust);
That should replace all instances of # with it's html entity equivalent. If
that doesn�t work then there is something else wrong with your script and
we'll need to see it all! :)
Rick
"People who drink to drown their sorrow should be told that sorrow knows how
to swim." - Ann Landers
> I have a string I'm returning from a database. Some entries have # signs
> in the names ie (COMPANY #42, COMPANY #43...). When I display results
> all I have is COMPANY. Everything after the # is dropped off. I tried:
>
> If ($cust) {
> $cust2=ereg_replace('#','no',$cust);
> //tried $cust2=ereg_replace("#","no",$cust); too
> }
>
> but that still returns the same thing (COMPANY).
>
> Also tried:
>
> $cust2 = preg_replace ("'&(pound|#163);'i", chr(163), $cust);
>
> Any help is appreciated.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php