/* */

PDA

View Full Version : PhP anyone? - help!



Name
12-02-2006, 12:57 AM
:sl:

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

:confused:
Reply

Login/Register to hide ads. Scroll down for more posts
Helena
12-02-2006, 01:02 AM
woah......such a confusion matter.....

am utterly confused...which subject is it for?..php...odd.....heard tis somewhere...science rite?
Reply

Name
12-02-2006, 01:04 AM
no silly!
its for programming

PhP programming ;D
Reply

Helena
12-02-2006, 01:05 AM
thats like the third ive been called silly.....:embarrass ........:rant: ......

i still dnt get it?.......
Reply

Welcome, Guest!
Hey there! Looks like you're enjoying the discussion, but you're not signed up for an account.

When you create an account, you can participate in the discussions and share your thoughts. You also get notifications, here and via email, whenever new posts are made. And you can like posts and make new friends.
Sign Up
zanjabeela
12-02-2006, 05:20 AM
:sl: sis,
He is apparently trying to create a program that will interpret exam scores, and he needs to use the PHP programming language. Its just one of about a gazillion computer languages...but he chose the one I have not used for a while...So I can't help, unless I go to look it up...give me a couple hours brother (hopefully someone else will come to the rescue in the mean-time).

And sis, you are not silly...computer nerds are the silly ones :hiding:

:w:
Reply

zanjabeela
12-02-2006, 07:35 AM
:sl:
Brother, here is a pretty good site that I used to utilize all the time, when learning web development: http://www.w3schools.com/php/default.asp InshaAllah, you will find to be of benefit.

But first you need to store the name and score into variables, then perform your calculation to convert the score to a percentage, and then echo back the calculation. I would guess it would go something like this:

<?php
$name = "studentName"
$score = 23;
$calculation = ( 23 / 25 ) * 100;
if ($calculation >= 70)
echo $name + ", you are a first class student!";
elseif ($calculation < 70)
echo $name + ", better luck next time. Your score was " + $calculation;
?>

How are you reading the scores in? Are you reading it from a file? Or typing it in at the command prompt? Or asking the user to input it into a form on a web page? The last option would make the most sense. So you will find everything you need on that website I linked.

Dunno if that helped, if it was too much or too little...but it was fun for me so I will go bye-bye now :)

:w:
Reply

Name
12-02-2006, 02:19 PM
format_quote Originally Posted by zanjabeela
:sl:

How are you reading the scores in?

Dunno if that helped, if it was too much or too little...but it was fun for me so I will go bye-bye now :)

:w:
thanks for your attemp but that what i got: ERROR - to say the least


im just adding the scores by my self (typing them in)
Reply

Name
12-02-2006, 02:19 PM
format_quote Originally Posted by zanjabeela
:sl: sis,


And sis, you are not silly...computer nerds are the silly ones :hiding:

:w:
:rant:
Reply

zanjabeela
12-02-2006, 08:47 PM
format_quote Originally Posted by YaRusulallah
thanks for your attemp but that what i got: ERROR - to say the least
im just adding the scores by my self (typing them in)
:sl:
I believe I need PHP installed in order to test it, and I am not even going to go there.

One source of the error probably is here:
Code:
echo $name + ", better luck next time. Your score was " + $calculation;
Try changing it to: (where the + signs is replaced with a . )
Code:
echo $name . ", better luck next time. Your score was " . $calculation;
Would also help if it tells what the error is, rather than just ERROR. And yeah, that is not perfect code I threw out here...its just a push in the right direction (hopefully). Sorry its not enough :)
Reply

chacha_jalebi
12-02-2006, 08:58 PM
isnt this stuff done on microsoft excel?

because i remem we had a whole module on this :p and no one understood anytin :D:D:D
Reply

Name
12-02-2006, 09:50 PM
format_quote Originally Posted by zanjabeela
:sl:
I believe I need PHP installed in order to test it, and I am not even going to go there.

One source of the error probably is here:
Code:
echo $name + ", better luck next time. Your score was " + $calculation;
Try changing it to: (where the + signs is replaced with a . )
Code:
echo $name . ", better luck next time. Your score was " . $calculation;
Would also help if it tells what the error is, rather than just ERROR. And yeah, that is not perfect code I threw out here...its just a push in the right direction (hopefully). Sorry its not enough :)
still incorrect
Reply

Name
12-02-2006, 10:17 PM
I DID A FEW TWICKS AND GUESS WHAT IT [BANANA]WORKED!!!!!!!!!!!!!!!!!!!!!!!!![/BANANA]

jazzakAllah to all those brothers and sisters
Reply

zanjabeela
12-02-2006, 11:09 PM
format_quote Originally Posted by Alpha Dude
:sl:
Shouldn't the bit in red be:
$calculation = ( $score/ 25 ) * 100;

:p
Yep, but I wanted him to see it for himself! :p
And, tell me what your twicks were, brother YaRusulallah, so I can learn a lil somethin somethin! :)
Reply

Hey there! Looks like you're enjoying the discussion, but you're not signed up for an account.

When you create an account, you can participate in the discussions and share your thoughts. You also get notifications, here and via email, whenever new posts are made. And you can like posts and make new friends.
Sign Up
British Wholesales - Certified Wholesale Linen & Towels | Holiday in the Maldives

IslamicBoard

Experience a richer experience on our mobile app!