Reputation: 1910
I'm running this query, on two tables, and in first table, table tblhosting two condition must be met, WHERE tblhosting.server = tblservers.id AND tblhosting.domain = 'provided domain'. "provided domain is unique and here is complete query:
$result = mysql_query("SELECT hostname FROM tblhosting, tblservers WHERE tblhosting.server = tblservers.id AND tblhosting.domain = 'developer.infonet.hr'");
Query return correct result set, but two times, here is also var_dump output:
array(2) {
[0]=>
string(18) "lin-b15.infonet.hr"
["hostname"]=>
string(18) "lin-b15.infonet.hr"
}
Why is returning two same results, correct output is one, because domain is unique, is this because result is generate with mysq_fetch_array, so it is returning both associative array, and normal indexed array?
Upvotes: 0
Views: 216
Reputation: 96
use
mysql_fetch_row()
to Get a result row as an enumerated array
or
mysql_fetch_assoc()
to Fetch a result row as an associative array
For Multiple record use it in while condition..
Upvotes: 1