بسم الله الرحمن الرحيم
انا عندي كود PHP فيه مشكلتين
الاولى :
طريقة عمل الكود عندي جدولين في الداتا بيس يقرى من الجدول الاول ازا كان Dr_status = 1 . يروح لي التيبل التاني ياخد ال location حق ال Dr في الوقت الحالي (مو شغال يطلعلي Error )
الثانيه : كيف ارسل ال location لي كود ال HTML
الجدولين
table 1 name = Dr
Dr_ID | Dr_status
table 2 name = course
course_name | section_ID | Dr_ID | time_start | time_end | location
اما بلنسبه لي كود ال HTML مافيه شي لاني مني غارف كيف اسوي MAP بال HTML
و هذا كود PHP حقي الي مو شغال و شكرا
$dbhost='localhost';
$dbusername='root';
$dbpassword='';
$dbname='Dr';
$dbcnx = mysql_connect ($dbhost, $dbusername, $dbpassword);
if (!$dbcnx) {
die('Can\'t Connect To DB Server') ;
}
mysql_select_db("Dr") or die("Can't select database");
//this could be dynamic , let's say that we get it from a $_GET Form , but let's assume that we have a static ID
$dr_Id = 1 ;
$query = 'SELECT Dr_status FROM dr WHERE Dr_ID ='.intval($dr_Id);
$result = mysql_query($query);
$data = mysql_fetch_assoc($result);
if ($data['Dr_status'] == 1) {
$query2="SELECT location FROM sections where Time_start <= ".time()." < Time_end";
$result = mysql_query($query2);
$data = mysql_fetch_assoc($result);
if (isset($data['location']) && !empty($data['location']) ) {
echo 'barrrraaam , the location of Dr is : '.$data['location'] ;
}
} else {
echo 'Damn !! i can\'t predicate the Dr. Status !! , we should hire new one :P'
}
mysql_close($dbcnx);
?>
<?php