php - Getting Data from 2 different MySQL tables -
i'm working on project involved getting information 2 different servers. plan on doing having user enter or username password , have php script fill in rest of fields below first name last name etc. did searching , found of data have on 2 different tables within server. below coding have far.
<?php $connect = mysql_connect("localhost","**************","**********") or die ("couldn't connect"); //host,username,password mysql_select_db("*******") or die ("could not find database"); $query = mysql_query("select * jos_users username='$username'"); ?> <html> <form action="populate.php" method='post'> <table> <tr> <td>vae username:</td> <td><input type='text' name='username' value=''></td> </tr> <tr> <td>vae password:</td> <td><input type='password' name='password' value=''></td> </tr> </table> <p><input type='submit' name='submit' value='search & populate!'></p> </form> //below information want filled in mysql tables <hr> $query = mysql_query("select * jos_users username='$username'"); <form action="dafreg.php" method='post'> <table> <tr> <td>fristname:</td> <td><input type='text' name='firstname' value='<?php echo $firstname; ?>'></td> </tr> <tr><td>lastname:</td> <td><input type='text' name='lastname' value='<?php echo $lastname; ?>'></td> </tr> <tr> <td>login:</td> <td><input type='text' name='login' value='<?php echo $username; ?>'></td> </tr> <tr><td>password:</td> <td><input type='text' name='pass' value=''></td> </tr> <tr><td>country:</td> <td><input type='text' name='country' value=''></td> </tr> <tr><td>pilot:</td> <td><input type='checkbox' name='pilot' value=''></td> </tr> <tr><td>atc:</td> <td><input type='checkbox' name='atc' value=''></td> </tr> <tr><td>email:</td> <td><input type='text' name='email' value=''></td> </tr> </table> <p><input type='submit' name='submit' value='register'></p> </form> </form> </html>
using 'join' best option extracting data multiple table...
select tab1.*,tab2.* table1 tab1 join table2 tab2 on tab1.id=tab2.id tab1.username=$username
Comments
Post a Comment