Hi everybody
I need help from you on my assingnment
I have two tables created in database by http://localhost/phpmyadmin/
then I put some information in these tables and they have two feilds the same in each
I want to join these two tables by (PHP coder software)
but I tried many ways of methods and no result
this is my code I put .... can anyone tell what's wrong with it .. help me *_^
Hint: i want all the information of each student from the two tables appear in the localhost
--------------------------------------------------------------------------------------------------------------------------------
<?php
$host = "localhost";
$user = "";
$password = "";
$db = "test";
$sql= "SELECT student.STD_NAME, hostel.HST_LOCATION
FROM student
LEFT JOIN hostel
ON student.STD_ROOM=hostel.HST_ROOM ";
mysql_connect ($host,$user,$password) or die("Failed to connect");
mysql_select_db($db) or die("Failed to select $db");
$result = mysql_query($sql) or die("Could Not excute query $sql");
$row = @mysql_fetch_array($result);
echo " ".$row["STD_NAME"]." ".$row["HST_LOCATION"]." ";
?>
-----------------------------------------------------------------------------------------------------------------------------
No one has replied yet! Why not be the first?
Sign in or Join us (it's free).