Web Hosting Talk







View Full Version : More help needed


DjPaj
04-25-2002, 04:09 PM
Okay, this script that I am configuring is killing me, it would have been easier to write it myself.

I need another favor from you guys out there. Now I'm not new to PHP but why won't this ereg_replace() work?

while(($priceRow=mysql_fetch_array($priceRes)))
{
$key=$priceRow[0];
$price=$priceRow[1];
$pat="\$";
$newPrice1=ereg_replace($pat,"",$price);
print("Prices (old = $price) (new = $newPrice1) <br>");
}

What I have is a varchar column that needs to be changed to an int column, and I am too lazy :D to go in a change each value itself, so I figured this little script would do it for me, but noooooooooooo. I have a value in the column that has a dollar sign next to it (ex: $15,000) and I need to strip it off, but I can't why? This is what I get when I print to the screen:

Prices (old =$14,000) (new=$14000)

Why won't the dollar sign strip and how can I get it too?