gwydionwaters Posted December 31, 2008 Share Posted December 31, 2008 i am trying to write an esleif sequence and for some reason i get a parse error on a line that should be no different than the last if ($browse=('author')) { $var1 = "author = '$author'"; $query .= $var1; } elseif ($browse=('type')) { $var1 = "type = '$type'"; $query .= $var1; } esleif ($browse=('use')) { //** Line 24 is here ** $var1 = "func = '$func'"; $query .= $var1; } elseif ($browse=('cost <=')) { $var1 = "cost = '$cost'"; $query .= $var1; } elseif ($browse=('rating')){ $var1 = "rate = '$rate'"; $query .= $var1; } else echo 'Sorry an error occurred, please try again'; endif; i tried to use : instead of curly brackets but apparently i need them becuase i have multiple actions in my elseif? either way i try it won't work, the problem is before i had it as just if statements in sequence and for some reason it doesn't work, if i comment out everything but the first if and run it then it works. but obviously only for author Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted December 31, 2008 Share Posted December 31, 2008 you mispelled else change esleif ($browse=('use')) { to: elseif ($browse=('use')) { Quote Link to comment Share on other sites More sharing options...
Maq Posted December 31, 2008 Share Posted December 31, 2008 Don't double post! Open your eyes and look at your spelling... esleif ($browse=('use')) { Should be: elseif ($browse == 'use') { And like my other post said you need to use == not = or else the last elseif statement will always be true. Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted December 31, 2008 Share Posted December 31, 2008 where did he double post? Quote Link to comment Share on other sites More sharing options...
grim1208 Posted December 31, 2008 Share Posted December 31, 2008 elseif should be spaced else if Quote Link to comment Share on other sites More sharing options...
Maq Posted December 31, 2008 Share Posted December 31, 2008 elseif should be spaced else if No. It's not the same exact post but he asked the same question later... http://www.phpfreaks.com/forums/index.php/topic,231345.msg1076862.html#msg1076862 Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted December 31, 2008 Share Posted December 31, 2008 upp i stand corrected! Quote Link to comment Share on other sites More sharing options...
grim1208 Posted December 31, 2008 Share Posted December 31, 2008 Open your eyes and look at your spelling... Kind of harsh wouldn't you say? You sure like flaming people Quote Link to comment Share on other sites More sharing options...
revraz Posted December 31, 2008 Share Posted December 31, 2008 All kinds of stuff wrong. What are you trying to do here $var1 = "author = '$author'"; Quote Link to comment Share on other sites More sharing options...
Maq Posted December 31, 2008 Share Posted December 31, 2008 Open your eyes and look at your spelling... Kind of harsh wouldn't you say? You sure like flaming people Sorry to be like this but when people double post it irritates me. It wastes everyone elses time and is ignorant. So, as far as your question, "Kind of harsh wouldn't you say?", my answer is NO. Flaming? Far from it... Quote Link to comment Share on other sites More sharing options...
grim1208 Posted December 31, 2008 Share Posted December 31, 2008 Open your eyes and look at your spelling... Kind of harsh wouldn't you say? You sure like flaming people Sorry to be like this but when people double post it irritates me. It wastes everyone elses time and is ignorant. So, as far as your question, "Kind of harsh wouldn't you say?", my answer is NO. Flaming? Far from it... Guess I can see your point, I did read the other thread and you answered the exact same question there, quite politely at that. As coders we should ALL go through each line of code and check for spelling and typos before we post a thread here ... gwydionwaters as well as utilize all the tools you have at your hands, such as google ... Quote Link to comment Share on other sites More sharing options...
gwydionwaters Posted December 31, 2008 Author Share Posted December 31, 2008 Open your eyes and look at your spelling... Kind of harsh wouldn't you say? You sure like flaming people Sorry to be like this but when people double post it irritates me. It wastes everyone elses time and is ignorant. So, as far as your question, "Kind of harsh wouldn't you say?", my answer is NO. Flaming? Far from it... Guess I can see your point, I did read the other thread and you answered the exact same question there, quite politely at that. As coders we should ALL go through each line of code and check for spelling and typos before we post a thread here ... gwydionwaters as well as utilize all the tools you have at your hands, such as google ... quite harsh, yes. i posted in two places not knowing which forum was appropriate. if i make you angry i'd rather you didn't post at all than be a jerk. also i posted both within moments of one another so i did not know you had already answered me, people usually don't answer right away. thank you all for helping, i do appreciate you taking the time to read over my probably mindane issues and finding solutions for me. i really do. what am i trying to accomplish? i made a menu driven database browser, for lack of a better term. users can select options from drop downs that will return database entries matching the option used. in regards to my problem i found a solution using a different call, that being switch/case and it is working great the code i created now is such switch ($browse) { case author: $query .= "author = '$author1'"; $term = $author1; break; case type: $query .= "type = '$type1'"; $term = $type1; break; case func: $browse = "use"; $query .= "func = '$func1'"; $term = $func1; break; case cost: $browse = "price < ="; $query .= "cost <= '$cost1'"; $term = $cost1; break; case rating: $query .= "rate = '$rate1'"; $term = $rate1; break; default: echo 'Sorry an error occurred, please try again'; } sorry to have offended some, and again thank you muchly to those who have been patient with me Quote Link to comment Share on other sites More sharing options...
Maq Posted December 31, 2008 Share Posted December 31, 2008 sorry to have offended some, and again thank you muchly to those who have been patient with me You're welcome Quote Link to comment Share on other sites More sharing options...
revraz Posted December 31, 2008 Share Posted December 31, 2008 Well at least you spelled "case" right. But if you would have just fixed your typo, your ELSEIF would work as well. Quote Link to comment Share on other sites More sharing options...
gwydionwaters Posted December 31, 2008 Author Share Posted December 31, 2008 lol yeah, but now i also know how to do a case also. it's funny, i must be dyslexic: when i was reading the response about the typo, with a quote of my code, i had to read it five times before i saw the typo ... and i knew where to look Quote Link to comment Share on other sites More sharing options...
Maq Posted January 2, 2009 Share Posted January 2, 2009 lol yeah, but now i also know how to do a case also. it's funny, i must be dyslexic: when i was reading the response about the typo, with a quote of my code, i had to read it five times before i saw the typo ... and i knew where to look Don't worry, we all have those kinds of days... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.