-1

I am trying to get data from two tables:

$con = getDbConnect();
$edit = $_GET['edit'];

if (mysqli_connect_errno($con)) {
    "Failed to connect to MySQL: " . mysqli_connect_error();
} else {
    $result = mysqli_query($con, "SELECT * FROM admininfo where email='" . $edit . "'");
    $results = mysqli_query($con, "SELECT * FROM adminaccount where email='" . $edit . "'");

while ($admininfo = mysqli_fetch_array($result, $results)) {
alex
  • 6,818
  • 9
  • 52
  • 103
Yee Meng
  • 21
  • 2
  • 3
    Start by reading the manual:http://php.net/manual/en/mysqli-result.fetch-array.php to see how wrong your code is – Marc B Feb 02 '15 at 20:06

1 Answers1

1

You use a single query no matter how many tables you're selecting from, e.g.

SELECT a.*, b.* FROM table1 a, table2 b where a.id = ? AND b.id = ?

Then you fetch what you need from the result, take a look at the docs for that.

-- and, of-course, don't use select *.

Community
  • 1
  • 1
Jonast92
  • 4,964
  • 1
  • 18
  • 32