wata Posted December 1, 2006 Share Posted December 1, 2006 hi people im new to php programming and sorry if i have posted it in the wrong section. i need some help if anyone is willing to help please post back i would really appricate it. thank you Quote Link to comment Share on other sites More sharing options...
Caesar Posted December 1, 2006 Share Posted December 1, 2006 Please be a little more specific. If you have question or need help with existing code...please post it here and let us know where you are having trouble. Thanks. Quote Link to comment Share on other sites More sharing options...
wata Posted December 1, 2006 Author Share Posted December 1, 2006 oh yeh well the thing is i wanna assign to variables my name and a mark (between 1-25). And Convert this mark out of 25 to a percentage. If the percentage is 70% or more print out the statement, with my name on and sayin you are a first class student!”but i donno how to start it off so could some start it off for us please not askin to do all of it jus start it off. thank you Quote Link to comment Share on other sites More sharing options...
help_needed Posted December 2, 2006 Share Posted December 2, 2006 answer the question please someone...... :'( Quote Link to comment Share on other sites More sharing options...
corbin Posted December 2, 2006 Share Posted December 2, 2006 I just read what wata posted about 10 times, and I still have no idea what you want...Anyways for the percent thing you could doif($percent*4 >= 70) {echo "You are a first class student.";}else {echo "You are not a first class student.";} Quote Link to comment Share on other sites More sharing options...
help_needed Posted December 2, 2006 Share Posted December 2, 2006 here is the actual question:[quote]1. Assign to variables your name and a mark (between 1-25). Convert this mark out of 25 to a percentage. If the percentage is 70% or more print out the statement, “<your name>, you are a first class student!” (replacing <your name> with the value stored in the variable) [/quote] Quote Link to comment Share on other sites More sharing options...
help_needed Posted December 2, 2006 Share Posted December 2, 2006 [quote author=corbin link=topic=117040.msg477375#msg477375 date=1165024649]I just read what wata posted about 10 times, and I still have no idea what you want...Anyways for the percent thing you could doif($percent*4 >= 70) {echo "You are a first class student.";}else {echo "You are not a first class student.";}[/quote]where did you get the 4 from? Quote Link to comment Share on other sites More sharing options...
ataria Posted December 2, 2006 Share Posted December 2, 2006 where did you get the 4 from?I know I didn't post ittt. but, I know the reasoning behind it.100/25 = 4.If you want 100% to the highest possible, you need to times the percent by 4.Hence, a 17.5 would be 70%get it? Quote Link to comment Share on other sites More sharing options...
help_needed Posted December 2, 2006 Share Posted December 2, 2006 [quote author=ataria link=topic=117040.msg477539#msg477539 date=1165068702]where did you get the 4 from?I know I didn't post ittt. but, I know the reasoning behind it.100/25 = 4.If you want 100% to the highest possible, you need to times the percent by 4.Hence, a 17.5 would be 70%get it? thanks BUT can you answer this please?[quote]1. Assign to variables your name and a mark (between 1-25). Convert this mark out of 25 to a percentage. If the percentage is 70% or more print out the statement, “<your name>, you are a first class student!” (replacing <your name> with the value stored in the variable) [/quote][/quote] Quote Link to comment Share on other sites More sharing options...
ataria Posted December 2, 2006 Share Posted December 2, 2006 Corbin already did it.if($percent*4 >= 70) {echo " {$name}, You are a first class student.";}else {echo "You are not a first class student.";}to do the other thingg. (giving them the mark)<?php$random = rand(1,25);$insert = mysql_query("INSERT INTO `table_name`(`column name`) VALUES ('{$random}'));?> Quote Link to comment Share on other sites More sharing options...
help_needed Posted December 2, 2006 Share Posted December 2, 2006 thats what it came out with:$name='XYZ,10'; if($percent*4 >= 70) { print "$name,You are a first class student."; } else { echo "You are not a first class student."; } Quote Link to comment Share on other sites More sharing options...
wata Posted December 4, 2006 Author Share Posted December 4, 2006 ive got a problem on the forth line<?php$name = "Wata"$percent = 4if $percent*4 >= 70 {echo " {$name}, You are a first class student.";}else {echo "You are not a first class student.";?> Quote Link to comment Share on other sites More sharing options...
keeB Posted December 4, 2006 Share Posted December 4, 2006 [code]<?php$name = "Wata";$random = rand(1,25);if ($random*4 >= 70) { echo " {$name}, You are a first class student.";} else { echo "You are not a first class student.";}?>[/code]There you go Quote Link to comment Share on other sites More sharing options...
papaface Posted December 4, 2006 Share Posted December 4, 2006 should be:[code]<?php$name = "Wata"$percent = 4if ($percent*4 >= 70) {echo " {$name}, You are a first class student.";}else {echo "You are not a first class student.";}?>[/code]You forgot the ()'s and the } on the last else statement.EDIT: ^^ posted at the same time with a slightly different peice of code. 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.