I’ve seen similar questions in here but not quite the one I have. Mind you, I understand a bit of MySQL but in no way am I a pro at it, hence this question.
I need to create variables from 2 different tables in the same DB. Neither table contains the same colname. Check out the below:
<?
include("admin/dbinfo.inc.php");
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM contacts";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
?>
<?
$first=mysql_result($result,$i,"first");
$last=mysql_result($result,$i,"last");
$mobile=mysql_result($result,$i,"mobile");
$phone=mysql_result($result,$i,"phone");
?>
<?
include("admin/dbinfo.inc.php");
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM users";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
?>
<?
$sname=mysql_result($result,$i,"sname");
$sphoto=mysql_result($result,$i,"sphoto");
$sinfo=mysql_result($result,$i,"sinfo");
$scontact=mysql_result($result,$i,"scontact");
$id=mysql_result($result,$i,"id");
?>
The above are my 2 tables with the SELECT info & the variables I need. How would I go about combining the two so I could then use all vars on the same page?