WHy do I get this error?

This is a discussion on "WHy do I get this error?" within the PHP Forum section. This forum, and the thread "WHy do I get this error? are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Sep 6th, 2007, 07:27
Reputable Member
Join Date: Jan 2004
Location: California
Age: 19
Posts: 232
Thanks: 0
Thanked 2 Times in 2 Posts
WHy do I get this error?

What is wrong with this code?
PHP: Select all

if ($mainchoose == "towidth"){
$image->resizeToWidth($maintowidth);
}
elseif (
$mainchoose == "toheight"){
$image->resizeToHeight($maintoheight);
}
else {
$image->resize($mainwidth,$mainheight);
}
$image->save("imagescms/".$outgoing.".".$extend);
if (
$thumbchoose == "towidth"){
$image->resizeToWidth($thumbtowidth);
}
elseif (
$thumbchoose == "toheight"){
$image->resizeToHeight($thumbtoheight);
}
else {
$image->resize($thumbwidth,$thumbheight);
}
$image->save("imagescms/".$outgoing."thumb.".$extend);

I get a Parse error: syntax error, unexpected T_VARIABLE
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Sep 6th, 2007, 08:17
Highly Reputable Member
Join Date: Apr 2007
Location: Willich, Germany
Age: 20
Posts: 593
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: WHy do I get this error?

The '}' at the end is extra. Other than that i can't see any errors....
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Sep 6th, 2007, 08:33
Rakuli's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: WHy do I get this error?

You might be better off using switch statements for this type of thing -- a little quicker for the parser to compile.

Code: Select all
 
 
switch ($mainchoose)
{
    case "towidth" :
        $image->resizeToHeight($maintoheight);
  break;
 
   case "toheight" :
      $image->resizeToHeight($maintoheight);
  break;
 
   default :
       $image->resize($mainwidth,$mainheight);
}
 
$image->save("imagescms/".$outgoing.".".$extend);
 
switch ($thumbchoose)
{
    case "towidth" : 
        $image->resizeToWidth($thumbtowidth);
 
    break;
 
    case "toheight" :
        $image->resizeToHeight($thumbtoheight);
 
    break;
 
    default :
        $image->resize($thumbwidth,$thumbheight);
}
 
$image->save("imagescms/".$outgoing."thumb.".$extend);
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)

Last edited by Rakuli; Sep 6th, 2007 at 08:39.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Sep 6th, 2007, 17:48
Reputable Member
Join Date: Jan 2004
Location: California
Age: 19
Posts: 232
Thanks: 0
Thanked 2 Times in 2 Posts
Re: WHy do I get this error?

Ok got it fixed, thank you. I didn't even know about switch statements, I will give that a try.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
error, php, t_variable

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Getting the "Microsoft JET Database Engine error '80040e14'" error. VegaLA Classic ASP 3 Jan 26th, 2008 00:12
Keep getting error message Microsoft VBScript runtime error '800a01a8' cpando1974 Classic ASP 2 Aug 7th, 2007 12:00
Error 500 - Internal server error JasonStanley PHP Forum 3 Apr 23rd, 2007 17:56


All times are GMT. The time now is 10:56.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42