Ben bunun yerine php kodu tarayıcıda görüntülenir, işe yaramaz olan, temel bir ajax uygulaması var. Javascript ve html ince görünüyor. Ben buradan birebir kopyaladığınız kodu adres:
ve bu php:
<?
session_start();
//start the session
$cmd=$_GET["cmd"];
$con = mysql_connect("localhost","root","indosat");
if (!con)
{
die('Connection to MySQL server failed: ' . mysql_error());
//show error message (mysql_error) if connection failed
}
mysql_select_db("ajax",$con);
//select the database, in this case our database name is "ajax"
if ($cmd=="GetEmployee")
//set command value (executed from javascript ajaxlib.js)
{
sleep(10);
//give delay about 10 seconds before execute the command
//we use this sleep function so we can see the loading animation
//you can edit/remove
echo "<table border='1' width='100%'>
<tr>
<th>EmpNo</th>
<th>fName</th>
<th>lName</th>
<th>Age</th>
</tr>";
//print a table to browser to show the values
$sql="select * from employee";
//this is query to show all records
$result = mysql_query($sql);
//execute the query & fill it to $result variable
while ($row = mysql_fetch_array($result))
{
echo "<tr>
<td>".$row['IdEmp']."</td>
<td>".$row['fName']."</td>
<td> ".$row['lName']."</td>
<td>".$row['Age']."</td>
</tr>";
//print the record to the table
}
echo "</table>";
//close the table
}
mysql_close($con);
//close the mysql connection
?>
Ben ne sorun olabilir görmüyorum
edit: bu shorttags değildir. onlar "uzun" etiketleri andusing, etkindir hiç fark etmez.