Bu Blogda Ara

5 Temmuz 2010 Pazartesi

Php, mysql ve ajax' ı birlikte kullanmak

HTML SAYFASI












Person info will be listed here.






getuser.php sayfası

$q=$_GET["q"];

$con = mysql_connect('localhost', 'peter', 'abc123');
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("ajax_demo", $con);

$sql="SELECT * FROM user WHERE id = '".$q."'";

$result = mysql_query($sql);

echo "






";

while($row = mysql_fetch_array($result))
{
echo "";
echo "";
echo "";
echo "";
echo "";
echo "";
echo "";
}
echo "
Firstname Lastname Age Hometown Job
" . $row['FirstName'] . "" . $row['LastName'] . "" . $row['Age'] . "" . $row['Hometown'] . "" . $row['Job'] . "
";

mysql_close($con);
?>

Hiç yorum yok:

Yorum Gönder