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 Link to comment https://forums.phpfreaks.com/topic/29159-new-to-php/ 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. Link to comment https://forums.phpfreaks.com/topic/29159-new-to-php/#findComment-133671 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 Link to comment https://forums.phpfreaks.com/topic/29159-new-to-php/#findComment-133674 Share on other sites More sharing options...
help_needed Posted December 2, 2006 Share Posted December 2, 2006 answer the question please someone...... :'( Link to comment https://forums.phpfreaks.com/topic/29159-new-to-php/#findComment-133769 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.";} Link to comment https://forums.phpfreaks.com/topic/29159-new-to-php/#findComment-133803 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] Link to comment https://forums.phpfreaks.com/topic/29159-new-to-php/#findComment-133955 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? Link to comment https://forums.phpfreaks.com/topic/29159-new-to-php/#findComment-133958 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? Link to comment https://forums.phpfreaks.com/topic/29159-new-to-php/#findComment-133960 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] Link to comment https://forums.phpfreaks.com/topic/29159-new-to-php/#findComment-133961 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}'));?> Link to comment https://forums.phpfreaks.com/topic/29159-new-to-php/#findComment-133966 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."; } Link to comment https://forums.phpfreaks.com/topic/29159-new-to-php/#findComment-133976 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.";?> Link to comment https://forums.phpfreaks.com/topic/29159-new-to-php/#findComment-134946 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 Link to comment https://forums.phpfreaks.com/topic/29159-new-to-php/#findComment-134948 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. Link to comment https://forums.phpfreaks.com/topic/29159-new-to-php/#findComment-134949 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.