corsasport.co.uk
 

Corsa Sport » Message Board » Off Day » Geek Day » Anybody who knows PHP


New Topic

New Poll
  Subscribe | Add to Favourites

You are not logged in and may not post or reply to messages. Please log in or create a new account or mail us about fixing an existing one - register@corsasport.co.uk

There are also many more features available when you are logged in such as private messages, buddy list, location services, post search and more.


Author Anybody who knows PHP
groom
Member

Registered: 19th Apr 03
Location: In front of my pc
User status: Offline
16th Aug 03 at 21:01   View User's Profile U2U Member Reply With Quote

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
16th Aug 03 at 21:07   View User's Profile U2U Member Reply With Quote

ah i think i got it, ill update soon
groom
Member

Registered: 19th Apr 03
Location: In front of my pc
User status: Offline
16th Aug 03 at 21:10   View User's Profile U2U Member Reply With Quote

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
16th Aug 03 at 21:11   View User's Profile U2U Member Reply With Quote

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
16th Aug 03 at 21:12   View User's Profile U2U Member Reply With Quote

Echoooooooooooooooooooooo
groom
Member

Registered: 19th Apr 03
Location: In front of my pc
User status: Offline
16th Aug 03 at 21:22   View User's Profile U2U Member Reply With Quote

stfu
Sooty
Banned

Registered: 9th Mar 03
Location: FLAP CENTRAL
User status: Offline
16th Aug 03 at 21:26   View User's Profile U2U Member Reply With Quote

I know php... but fk it... too late
CORSA NUT
Member

Registered: 3rd Aug 01
Location: Wirral
User status: Offline
16th Aug 03 at 21:27   View User's Profile U2U Member Reply With Quote

Sorry groom
groom
Member

Registered: 19th Apr 03
Location: In front of my pc
User status: Offline
16th Aug 03 at 22:17   View User's Profile U2U Member Reply With Quote

plz, i need it done asap
groom
Member

Registered: 19th Apr 03
Location: In front of my pc
User status: Offline
16th Aug 03 at 22:53   View User's Profile U2U Member Reply With Quote

PLEASE!!!!!
Steven Brough
Member

Registered: 26th Sep 00
Location: Chesterfield
User status: Offline
16th Aug 03 at 22:54   View User's Profile U2U Member Reply With Quote

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
16th Aug 03 at 23:02   View User's Profile U2U Member Reply With Quote

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
16th Aug 03 at 23:04   View User's Profile U2U Member Reply With Quote

thx so much m8 ill get bk 2 u
Steven Brough
Member

Registered: 26th Sep 00
Location: Chesterfield
User status: Offline
16th Aug 03 at 23:07   View User's Profile U2U Member Reply With Quote

OK let me know if I was right!
groom
Member

Registered: 19th Apr 03
Location: In front of my pc
User status: Offline
16th Aug 03 at 23:12   View User's Profile U2U Member Reply With Quote

it worked but i got more probs

Parse error: parse error, expecting `','' or `';'' in /users/ionichost.com/photochops/chopperszine/index.php on line 4
code:

<? 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
16th Aug 03 at 23:52   View User's Profile U2U Member Reply With Quote

any1 for this 1???
groom
Member

Registered: 19th Apr 03
Location: In front of my pc
User status: Offline
17th Aug 03 at 10:44   View User's Profile U2U Member Reply With Quote

pls pls dudes
Steven Brough
Member

Registered: 26th Sep 00
Location: Chesterfield
User status: Offline
17th Aug 03 at 21:35   View User's Profile U2U Member Reply With Quote

Shouldn't
echo "<img src="$page.jpg">;
be
echo "<img src=\"$page.jpg\">;

?
Tim
Site Administrator

Avatar

Registered: 21st Apr 00
User status: Offline
17th Aug 03 at 23:02   View Garage View User's Profile U2U Member Reply With Quote

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

Avatar

Registered: 28th Aug 99
Location: Liverpool
User status: Offline
17th Aug 03 at 23:30   View Garage View User's Profile U2U Member Reply With Quote

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.

 
New Topic

New Poll

  Related Threads Author Forum Replies Views Last Post
bike vids for ppl who r bored Chris@Speedfreex General Chat 5 1489
9th Aug 03 at 21:43
by S.Nelson
 
good deal ? antonOO2 General Chat 4 795
7th Sep 03 at 12:44
by antonOO2
 
Interet techies! Macca_G Geek Day 3 971
9th Mar 04 at 14:48
by Macca_G
 
opinions on this Adam-D General Chat 12 1088
30th May 04 at 08:02
by Adam-D
 
Few Pics from the Pod (56K Warning) PaulW General Chat 12 1066
21st Feb 05 at 16:40
by Jambo
 

Corsa Sport » Message Board » Off Day » Geek Day » Anybody who knows PHP 29 database queries in 0.0155220 seconds