I got an error
http://php.flashwebhost.com/sherly/medicine.php
Code:Parse error: syntax error, unexpected 'if' (T_IF) in /home/fwhphp/public_html/sherly/medicine.php on line 3Code:<?php $overtime=40 if ($overtime<=60) { $pay_amount=1500; $medicine=1000; echo 'Pay Amount : $pay_amount : Medicine : $medicine'; } else { $$pay_amount=2000; $medicine=1700; echo 'pay Amount : $pay_amount : Medicine : $medicine'; }
Missing ending semicolon (;)$overtime=40
Become PHP Expert in 30 days
FreeMarriage.com - Free Online Matrimonial
FlashWebHost.com - Professional Web Hosting, Designing.
http://php.flashwebhost.com/annie/if...reater_bug.php
Code:<?php $passScore = 210; $studentName = 'Mike'; $studentScore = 190; if ($studentScore > $passScore) { echo 'Congratulations' . $studentName . 'You passed the exam with' . $studentMark . 'mark.'; } else { echo 'Passing Score is' . $passScore . '.Your Score is' . $studentScore ; echo '<br>'; echo 'Sorry You did not pass the exam. Good luck and Cheers next time. '; }
On this line, you have $studentMark, this variable is not defined (created/used) in that program.. It should be replaced with $studentScore.echo 'Congratulations' . $studentName . 'You passed the exam with' . $studentMark . 'mark.';
Use tab for indent code inside { and }, refer my code. Code inside { and } is called code block, must be indented (press TAB key).
Become PHP Expert in 30 days
FreeMarriage.com - Free Online Matrimonial
FlashWebHost.com - Professional Web Hosting, Designing.
http://php.flashwebhost.com/melbin/days.php
In this code when i use == on line no:3PHP Code:
<?php
$day='Sunday';
if ($day="Sunday") {
echo 'Have a nice Sunday';
}
else {
echo 'Have a nice day';
}i am getting the result as FALSE. Why ?if ($day=="Sunday") {
Doubt 2
Is it possible to get the day by using PHP date and time function ?
VIDEO WORLD : LATEST HOLLYWOOD || BOLLYWOOD || SOUTH INDIAN VIDEOS || TRAILERS
http://php.flashwebhost.com/melbin/result.php
PHP Code:
<?php
$mark=85; // Enter Mark between 1 and 100
if ($mark > 100){
echo "$mark/100 ???... INVALID MARK";
}
else if ($mark >= 80 and $mark <= 100){
echo 'Congratulations You have got ' . $mark . ' Marks - Grade : Distinction';
}
else if ($mark >=60 and $mark <80) {
echo 'Congratulations You have got ' . $mark . ' Marks - Grade : First Class';
}
else if ($mark >=50 and $mark <60) {
echo 'Congratulations You have got ' . $mark . ' Marks - Grade : Second Class';
}
else if ($mark >=0 and $mark <50) {
echo 'Sorry You did not pass the exam. Your Mark is ' . $mark . ' - Status : FAILED';
}
else {
echo 'INVALID MARK';
}
Last edited by melbin; 05-13-2014 at 03:39 AM. Reason: script url missed
VIDEO WORLD : LATEST HOLLYWOOD || BOLLYWOOD || SOUTH INDIAN VIDEOS || TRAILERS
Become PHP Expert in 30 days
FreeMarriage.com - Free Online Matrimonial
FlashWebHost.com - Professional Web Hosting, Designing.
Become PHP Expert in 30 days
FreeMarriage.com - Free Online Matrimonial
FlashWebHost.com - Professional Web Hosting, Designing.
Bookmarks