PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Okay I'm a bit new to PHP.
Let's say the variable 'calories' is currently 450.
<?php
if($diet == "yes")
{
mysql_query("UPDATE mcdonalds set calories=calories-50 where id='1'");
$currentcal=mysql_fetch_array(mysql_query("SELECT calories from mcdonalds where id='1'"));
echo "Now it's only <b>$currentcal[calories]</b> calories!";
exit;
}
print "<a href=?diet=yes>Diet!</a>";
?>
How would you get it so that the calories is updated on that page? So that it says "Now it's only 400 calories!" WITHOUT RELOADING THE PAGE? Is that not possible?
Yea, i recently heard of AJAX, however it's still in a very early state, so i think in about 2 years it has been perfected and integrated in the whole web scene...
dreamline wrote:Yea, i recently heard of AJAX, however it's still in a very early state, so i think in about 2 years it has been perfected and integrated in the whole web scene...
Newer webbrowsers have been supporting it for years. It's just that few websites actually use AJAX. It's pretty damn powerful at any rate.
dreamline wrote:Yea, i recently heard of AJAX, however it's still in a very early state, so i think in about 2 years it has been perfected and integrated in the whole web scene...
Just the term AJAX used to describe the technology is new...and maybe the XMLHttp technology...
I've used techniques such as hidden IFRAMES for a long time now...
Prior to AJAX this was more commonly refered to as Javascript RPC (remote procedure calls)
This is cool stuff...but there are inherent problems...for instance...if your entire app is powered by Ajax, you loose you browsers back button functionality...a page update using AJAX doesn't register anything with the browser cache...
Most users (myself included) are very comfortable using back/forward buttons while using web apps