Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

how do i use join in php mysql i dont undertand the problem

Codes here !

Moderators: macek, egami, gesf

how do i use join in php mysql i dont undertand the problem

Postby kayman » Sun Jul 08, 2012 7:01 pm

<?php

require 'datacon.php';
$staffid ='asd';
$query="SELECT lecturers.staffid, tutors.staffid FROM lecturers , tutors WHERE lecturers.staffid = '".$staffid."', tutors.staffid = '".$staffid."' ";

if($result = mysql_query($query) ){

while($row = mysql_fetch_array($result)){
echo $row['staffid'];
echo "<br />";
}
}else if($result==''){

echo 'the query is empty';
}else{
echo die(mysql_error().'there was a failure');

}


?>

and this is the output

the query is empty
kayman
New php-forum User
New php-forum User
 
Posts: 3
Joined: Thu Apr 05, 2012 6:31 am

Return to mySQL & php coding

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron