Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (isset($_GET["noma"]) and isset($_GET["prenoma"]))
- {
- $n = $_GET["noma"] ;
- $p = $_GET["prenoma"];
- $res = array();
- $n = iconv('UTF-8', 'UTF-16LE', $n); //convert into native encoding
- $n = bin2hex($n);
- $p = iconv('UTF-8', 'UTF-16LE', $p); //convert into native encoding
- $p = bin2hex($p);
- $serverName = "41.231.120.155";
- $uid = "SQLCW";
- $pwd = "AWaWDa9L**";
- $dbname = "Reference_Traduction";
- $connectionInfo = array( "Database"=>"$dbname", "UID"=>"$uid", "PWD"=>"$pwd");
- $conn = sqlsrv_connect( $serverName, $connectionInfo);
- $sqln = "select NOMF from NOM
- where NOMA=CONVERT(nvarchar(MAX), 0x$n)";
- $sqlp = "select PRENOMF from Feuil1Prenom
- where PRENOMA=CONVERT(nvarchar(MAX), 0x$p)";
- $stmtn = sqlsrv_query( $conn, $sqln);
- $stmtp = sqlsrv_query( $conn, $sqlp);
- $res["nom"] = array();
- $res["prenom"] = array();
- while( $row = sqlsrv_fetch_array( $stmtn, SQLSRV_FETCH_ASSOC) ) {
- $res["nom"][] = $row['NOMF'] ;
- }
- while( $row = sqlsrv_fetch_array( $stmtp, SQLSRV_FETCH_ASSOC) ) {
- $res["prenom"][] = $row['PRENOMF'] ;
- }
- header('Content-type: application/json');
- echo json_encode($res,JSON_PRETTY_PRINT);
- /*
- if( $stmt === false ) {
- die( print_r( sqlsrv_errors(), true));}
- */
- sqlsrv_close( $conn);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement