PDA

View Full Version : Images and php


hden
08-10-2002, 09:59 PM
Hello there,
I am working on customizing this php script, and I want to add an image to the code. The code is this:
<?
if ($page > 0) {
echo "<a href=\"index.php3?page=" . ($page - 1) . "\"><img src="next.png" width="25" height="9"> </a>;
}
else {
echo "Next $aantal_per_page messages | ";
}
$bla = 10 + 10 * $page;
if ($num > $bla) {
echo "<a href=\"index.php3?page=" . ($page + 1) . "\">Past $aantal_per_page messages</a>";
}
else {
echo "Past $aantal_per_page messages";
}
?>
The code in bold is my problem, when I go and check to see if it works I get this error:

Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /mnt/host-users/m3e/Php-Bin/test/index.php3 on line 28

Can anyone help me out??

hden
08-10-2002, 10:45 PM
anyone? Please I really want to finish this today, someone help me plz!!!!

mordred
08-10-2002, 10:53 PM
Double quotes within double-qouted string variables must be escaped with a backslash. See also

http://se.php.net/manual/en/language.types.string.php

hden
08-10-2002, 10:56 PM
you mean something like this:

<?
if ($page > 0) {
echo "<a href=\"index.php3?page=" . ($page - 1) . "\"><img src=\"next.png" width="25" height="9"> </a>;
}
else {
echo "Next $aantal_per_page messages | ";
}
???

mordred
08-11-2002, 12:07 AM
No, that's not what I meant. Have you read the page I posted? Everything is explained there in great detail.
You need to escape the other backslashes that appear in the string as well.

hden
08-11-2002, 01:17 AM
ok I got it :) Thx