groom
Member
Registered: 19th Apr 03
Location: In front of my pc
User status: Offline
|
why do i get a parse error in this line of code???
code: <?if ($page=="1") {echo "<a href=\"?page=$page + \"1\"\">Next </a>\" ) else
{ echo \"<a href=\"?page=$page - \"1\"\">Back </a>\" \"<a href=\"?page=$page + \"1\"\">Next </a>";}?>
[Edited on 16-08-2003 by groom]
[Edited on 17-08-2003 by Ian]
[Edited on 11-08-2006 by Ian]
|
groom
Member
Registered: 19th Apr 03
Location: In front of my pc
User status: Offline
|
ah i think i got it, ill update soon
|
groom
Member
Registered: 19th Apr 03
Location: In front of my pc
User status: Offline
|
i get this as output and its not wot i want now
Error 404 1.jpg not found. Please report to webmasterNext " ) else { echo "Back " "Next
|
groom
Member
Registered: 19th Apr 03
Location: In front of my pc
User status: Offline
|
and yes i no 1.jpg is not there i not care bout that its after webmaster that it went rong
|
CORSA NUT
Member
Registered: 3rd Aug 01
Location: Wirral
User status: Offline
|
Echoooooooooooooooooooooo
|
groom
Member
Registered: 19th Apr 03
Location: In front of my pc
User status: Offline
|
stfu
|
Sooty
Banned
Registered: 9th Mar 03
Location: FLAP CENTRAL
User status: Offline
|
I know php... but fk it... too late
|
CORSA NUT
Member
Registered: 3rd Aug 01
Location: Wirral
User status: Offline
|
Sorry groom
|
groom
Member
Registered: 19th Apr 03
Location: In front of my pc
User status: Offline
|
plz, i need it done asap
|
groom
Member
Registered: 19th Apr 03
Location: In front of my pc
User status: Offline
|
PLEASE!!!!!
|
Steven Brough
Member
Registered: 26th Sep 00
Location: Chesterfield
User status: Offline
|
Hi mate, I don't know alot of PHP but I do know a few web languages:
<?if ($page=="1") {echo "<a href=\"?page=$page + \"1\"\">Next </a>\" ) else { echo \"<a href=\"?page=$page - \"1\"\">Back </a>\" \"<a href=\"?page=$page + \"1\"\">Next </a>";}?>
I think the prob lies after your first </a>, get rid of the \ before the " as this tells it to print a special character, the character being the speech mark. Whereas you don't want to print the speech mark, just use it to denote the end of your string.
|
Steven Brough
Member
Registered: 26th Sep 00
Location: Chesterfield
User status: Offline
|
I think it should look like this mate:
<?if ($page=="1") {echo "<a href=\"?page=$page + \"1\"\">Next </a>" ) else { echo \"<a href=\"?page=$page - \"1\"\">Back </a>\" \"<a href=\"?page=$page + \"1\"\">Next </a>";}?>
|
groom
Member
Registered: 19th Apr 03
Location: In front of my pc
User status: Offline
|
thx so much m8 ill get bk 2 u
|
Steven Brough
Member
Registered: 26th Sep 00
Location: Chesterfield
User status: Offline
|
OK let me know if I was right!
|
groom
Member
Registered: 19th Apr 03
Location: In front of my pc
User status: Offline
|
it worked but i got more probs
Parse error: parse error, expecting `','' or `';'' in /users/ionichost.com/photochops/chopperszine/index.php on line 4code:
<? if(file_exists("images/$page.jpg")){ echo "<img src="$page.jpg">; } else {
echo "Error 404 <b>$page.jpg</b> not found. Please report to <A href=\"mailto:groombros@aol.com\"> webmaster</A>" ;} ?>
[Edited on 17-08-2003 by Ian]
|
groom
Member
Registered: 19th Apr 03
Location: In front of my pc
User status: Offline
|
any1 for this 1???
|
groom
Member
Registered: 19th Apr 03
Location: In front of my pc
User status: Offline
|
pls pls dudes
|
Steven Brough
Member
Registered: 26th Sep 00
Location: Chesterfield
User status: Offline
|
Shouldn't
echo "<img src="$page.jpg">;
be
echo "<img src=\"$page.jpg\">;
?
|
Tim
Site Administrator
Registered: 21st Apr 00
User status: Offline
|
or even
echo "<img src=\"$page.jpg\">";
To be honest would make it easier to read if you did:
echo "<img src='$page.jpg'>";
|
Ian
Site Administrator
Registered: 28th Aug 99
Location: Liverpool
User status: Offline
|
You're using a round bracket instead of a curly one to close the if.
You also shouldn't be escaping the final quote in the first echo statement, or indeed the first quote in th second echo.
And the concatonation is to pot, I assume you're trying to substitute variables in to whats printed by the echo?
You might want to consider something like:
code:
if ($page == 1) {
echo "<a href='?page=" . $page+1 . "'>Next</a>";
}
else {
echo "<a href='?page=" . $page-1 . "'>Previous</a>";
echo "<a href='?page=" . $page+1 . "'>Next</a>";
}
Possibly. Although this will just continue to give 'Next' links forever and doesn't sense for an end. Plus you're wasting the conditional for the Next button as you print one either way. Consider moving that outside of the if statement.
|