|
![](/images/resource/spacer.gif) |
|
Please help use INNER join multiple tables in sqlsrv with php |
|
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
Let me give you an example of INNER JOIN Table in php connected to sqlsrv.
I did a post but reported an error.
Thank you very much!
Quote:<?php
$serverName = "SQLSERVER";
$userName = "sa";
$userPassword = "123456";
$dbName = "Product";
$connectionInfo = array("Database"=>$dbName,"characterSet"=>"UTF-8", "UID"=>$userName, "PWD"=>$userPassword, "MultipleActiveResultSets"=>true);
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true));
}
$sql = "SELECT * FROM NhanVien
INNER JOIN DM_PhongBan ON TenNhanVien.PhongBan_id = DM_PhongBan.PhongBan_id";
$stmt = sqlsrv_query($conn, $sql);
$params = array();
/* Retrieve each row as an associative array and display the results.*/
while( $row = sqlsrv_fetch_object( $stmt, SQLSRV_FETCH_ASSOC))
{
echo $row['MaNhanVien'].", ".$row['TenNhanVien']."\n";
}
/* Free statement and connection resources. */
//sqlsrv_free_stmt( $stmt);
sqlsrv_close( $conn);
?>
Warning: sqlsrv_fetch_object() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\MyPHP\search.php on line 22
Tag : PHP, FuelPHP
![](/images/adv.jpg?v=1001)
|
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2019-08-23 22:52:18 |
By :
rainkv |
View :
849 |
Reply :
2 |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
Thank You Very Much
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2019-08-24 15:16:50 |
By :
rainkv |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
|
|
|
![](/images/digitalocean-banner.jpg)
|
Load balance : Server 03
|