Hi,
I'm trying to replace a line of text with an image from a database. The number within the line to be replaced is used to retrieve the correct graphic url from a database. Unfortunately this is a close as I can get. The \1 contains the number in the array I need to get but I get the following error : Parse error: parse error, expecting T_STRING' orT_VARIABLE' or `T_NUM_STRING'. If I manually put the number in as a test I get the right URL. E.I.: "<IMG SRC=\"../$imageurl[1]\">", $pgtext);
This is the section causing the problem:
//IMAGE
$imagelistfull= mysql_query("SELECT ID, URL FROM Graphics");
while ($imagelist = mysql_fetch_array($imagelistfull)) {
$imageid = $imagelist["ID"];
$url = $imagelist["URL"];
$imageurl[$imageid] = $url;
}
$pgtext = ereg_replace(
"[IMAGE=([-_./a-zA-Z0-9!&%#?,'=:~]+)]",
"<IMG SRC=\"../$imageurl[\1]\">", $pgtext);
Any help on this or even another way to go about this would be greatly appreciated. Thanks.
Alcamar