corsasport.co.uk
 

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

Post Reply
Who Can Post? All users can post new topics and all users can reply.
Icon:
Formatting Mode:
Normal
Advanced
Help

Insert Bold text Insert Italicized text Insert Underlined text Insert Centered text Insert a Hyperlink Insert Email Hyperlink Insert an Image Insert Code Formatted text Insert Quoted text
Message:
HTML is Off
Smilies are On
BB Code is On
[img] Code is On
Post Options: Disable smileys?
Turn BBCode off?
Receive email notification of new replies?

Ian

posted on 17th Aug 03 at 23:30

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.


Tim

posted on 17th Aug 03 at 23:02

or even

echo "<img src=\"$page.jpg\">";

To be honest would make it easier to read if you did:

echo "<img src='$page.jpg'>";


Steven Brough

posted on 17th Aug 03 at 21:35

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

?


groom

posted on 17th Aug 03 at 10:44

pls pls dudes


groom

posted on 16th Aug 03 at 23:52

any1 for this 1???


groom

posted on 16th Aug 03 at 23:12

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]


Steven Brough

posted on 16th Aug 03 at 23:07

OK let me know if I was right! :)


groom

posted on 16th Aug 03 at 23:04

thx so much m8 ill get bk 2 u


Steven Brough

posted on 16th Aug 03 at 23:02

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>";}?>


Steven Brough

posted on 16th Aug 03 at 22:54

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.


groom

posted on 16th Aug 03 at 22:53

PLEASE!!!!!


groom

posted on 16th Aug 03 at 22:17

plz, i need it done asap


CORSA NUT

posted on 16th Aug 03 at 21:27

Sorry groom :lol: ;)


Sooty

posted on 16th Aug 03 at 21:26

I know php... but fk it... too late


groom

posted on 16th Aug 03 at 21:22

stfu:P


CORSA NUT

posted on 16th Aug 03 at 21:12

Echoooooooooooooooooooooo


groom

posted on 16th Aug 03 at 21:11

and yes i no 1.jpg is not there i not care bout that its after webmaster that it went rong


groom

posted on 16th Aug 03 at 21:10

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

posted on 16th Aug 03 at 21:07

ah i think i got it, ill update soon


groom

posted on 16th Aug 03 at 21:01

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]