ASKER
ASKER
<?php
$servername = "xxx.xxx.xxx.xxx";
$database = "xxxxx";
$username = "xxxxxx";
$password = "xxxxxxx";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>
<?php
$servername = "xxx.xxx.xxx.xxx";
$database = "xxxxx";
$username = "xxxxxx";
$password = "xxxxxxx";
// Create connection
$conn = new mysqli($servername, $username, $password);
var_dump ($conn );
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>
<?php
// Turn off all error reporting
error_reporting(0);
// Report simple running errors
error_reporting(E_ERROR | E_WARNING | E_PARSE);
// Reporting E_NOTICE can be good too (to report uninitialized
// variables or catch variable name misspellings ...)
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
// Report all errors except E_NOTICE
error_reporting(E_ALL & ~E_NOTICE);
// Report all PHP errors (see changelog)
error_reporting(E_ALL);
// Report all PHP errors
error_reporting(-1);
// Same as error_reporting(E_ALL);
ini_set('error_reporting', E_ALL);
?>
ASKER
ASKER
ASKER
ASKER
IF($_SERVER["REQUEST_METHOD"] == "POST"){
$portal_key = (ISSET($_POST["portal_key"]) ? $_POST["portal_key"] : $_COOKIE["portal_key"]);
ECHO(JSON_ENCODE(ms_select_value("EXEC [Portal].[dbo].[SP_ui_modules_fetchAccess] @key='".$portal_key."', @mod='".$_POST["mod"]."';")));
ASKER
ASKER
<?PHP
$my_default_conn = ARRAY(
"xx.xx.xx.xx",
"xxxxx",
"xxxxx"
);
$ms_default_conn = ARRAY(
"xx.xx.xx.xx",
"xxxx",
"xxxx",
"xxxx"
);
FUNCTION my_select_value($query, $host = NULL, $user = NULL, $pass = NULL){
IF($host == NULL || $user == NULL || $pass == NULL){
GLOBAL $my_default_conn;
$host = $my_default_conn[0];
$user = $my_default_conn[1];
$pass = $my_default_conn[2];
}
$conn = MYSQLI_CONNECT($host, $user, $pass);
$resultrow = MYSQLI_FETCH_ARRAY(MYSQLI_QUERY($conn, $query), MYSQLI_NUM);
MYSQLI_CLOSE($conn);
RETURN $resultrow[0];
}
FUNCTION my_select_table($query, $host = NULL, $user = NULL, $pass = NULL){
IF($host == NULL || $user == NULL || $pass == NULL){
GLOBAL $my_default_conn;
$host = $my_default_conn[0];
$user = $my_default_conn[1];
$pass = $my_default_conn[2];
}
$conn = MYSQLI_CONNECT($host, $user, $pass);
$process = MYSQLI_QUERY($conn, $query);
$resultset = ARRAY();
WHILE($resultrow = MYSQLI_FETCH_ARRAY($process, MYSQLI_NUM)){
$resultset[] = $resultrow;
}
MYSQLI_CLOSE($conn);
RETURN $resultset;
}
FUNCTION my_run_query($query, $host = NULL, $user = NULL, $pass = NULL){
IF($host == NULL || $user == NULL || $pass == NULL){
GLOBAL $my_default_conn;
$host = $my_default_conn[0];
$user = $my_default_conn[1];
$pass = $my_default_conn[2];
}
$conn = MYSQLI_CONNECT($host, $user, $pass);
$resultrow = MYSQLI_QUERY($conn, $query);
MYSQLI_CLOSE($conn);
RETURN $resultrow;
}
FUNCTION my_escape_string($raw){
GLOBAL $my_default_conn;
$host = $my_default_conn[0];
$user = $my_default_conn[1];
$pass = $my_default_conn[2];
$conn = MYSQLI_CONNECT($host, $user, $pass);
RETURN MYSQLI_REAL_ESCAPE_STRING($conn, $raw);
}
FUNCTION ms_select_value($query, $connectionInfo = NULL){
IF($connectionInfo == NULL){
$connstring = $GLOBALS["ms_default_conn"];
$connection = MSSQL_CONNECT($connstring[0], $connstring[1], $connstring[2]);
} ELSE {
$connection = MSSQL_CONNECT($connectionInfo[0], $connectionInfo[1], $connectionInfo[2]);
}
$process = MSSQL_QUERY($query, $connection);
$resultset = MSSQL_FETCH_ARRAY($process);
MSSQL_FREE_RESULT($process);
MSSQL_CLOSE($connection);
RETURN $resultset[0];
}
FUNCTION ms_select_table($query, $server = NULL, $connectionInfo = NULL){
IF($connectionInfo == NULL){
$connstring = $GLOBALS["ms_default_conn"];
$connection = MSSQL_CONNECT($connstring[0], $connstring[1], $connstring[2]);
} ELSE {
$connection = MSSQL_CONNECT($connectionInfo[0], $connectionInfo[1], $connectionInfo[2]);
}
$process = MSSQL_QUERY($query, $connection);
$resultset = ARRAY();
WHILE($resultrow = MSSQL_FETCH_ARRAY($process)){
$resultset[] = $resultrow;
}
MSSQL_FREE_RESULT($process);
MSSQL_CLOSE($connection);
RETURN $resultset;
}
FUNCTION ms_run_query($query, $server = NULL, $connectionInfo = NULL){
IF($connectionInfo == NULL){
$connstring = $GLOBALS["ms_default_conn"];
$connection = MSSQL_CONNECT($connstring[0], $connstring[1], $connstring[2]);
} ELSE {
$connection = MSSQL_CONNECT($connectionInfo[0], $connectionInfo[1], $connectionInfo[2]);
}
$process = MSSQL_QUERY($query, $connection);
$resultset = MSSQL_FETCH_ARRAY($process);
MSSQL_FREE_RESULT($process);
MSSQL_CLOSE($connection);
RETURN $resultset;
}
FUNCTION ms_escape_string($raw){
$raw = STR_REPLACE("'", "''", $raw);
$raw = STR_REPLACE("\0","[NULL]", $raw);
RETURN $raw;
}
?>
ASKER
ASKER
IF($_SERVER["REQUEST_METHOD"] == "POST"){
$p_key = (ISSET($_POST["p_key"]) ? $_POST["p_key"] : $_COOKIE["p_key"]);
ASKER
I figured out the issue. Restarted Apache and that solved it.
PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.
TRUSTED BY
quick verifications:
1. try check the HTML generated, and see if there's any issues/ errors?
2. check the query and make sure got data being returned?