Jump to content

VexedDeveloper

New Members
  • Content count

    5
  • Joined

  • Last visited

Community Reputation

0 Neutral

About VexedDeveloper

  • Rank
    Newbie
  1. VexedDeveloper

    Using Post variables in SQL Query for Azure SQL db

    Hi all, Thanks alot for input and teachings. I will work at it and post what I have after all suggestions and see if I could improve it more. Thanks again
  2. VexedDeveloper

    Using Post variables in SQL Query for Azure SQL db

    Oh sorry I haven’t tried that will do when I get back I am away for the weekend. I do have a database admin panel and it queries fine and as expected.
  3. VexedDeveloper

    Using Post variables in SQL Query for Azure SQL db

    Those that I posted above in my first post. This is my first time coding in PHP.
  4. VexedDeveloper

    Using Post variables in SQL Query for Azure SQL db

    Hi all thanks for replying. I did try and echo what you suggested but nothing comes out. Just those errors. I am wanting to specify which column and table to query data from Unity. Send it to my php web app and then it queries th database and bring the result back down to unity.
  5. Hi all, I am trying to use POST variables in my SQL query string: I am running the PHP script on IIS and I am getting these errors: var dumb of the $getresults: bool(false) Notice: Array to string conversion in C:\inetpub\wwwroot\phpinfo.php on line 27 Array Warning: sqlsrv_fetch_array() expects parameter 1 to be resource, boolean given in C:\inetpub\wwwroot\phpinfo.php on line 28 Warning: sqlsrv_free_stmt() expects parameter 1 to be resource, boolean given in C:\inetpub\wwwroot\phpinfo.php on line 35 What am I doing wrong? Thanks in advance. <?php $serverName = "something.database.windows.net"; $connectionOptions = array( "Database" => "something", "Uid" => "something", "PWD" => "something" ); //Establishes the connection $conn = sqlsrv_connect($serverName, $connectionOptions); $tableName = 0; $columnName = 0; $tsql = null; if(isset($_POST['dbName'])) { $tableName = $_POST['dbName']; $columnName = $_POST['columnName']; } $tsql = "SELECT $columnName FROM $tableName"; //"SELECT ProductName, ProductId FROM ProductData";// . $columnName . "FROM " . $tableName; $getResults= sqlsrv_query($conn, $tsql); var_dump($getResults); if ($getResults == FALSE) echo (sqlsrv_errors()); while ($row = sqlsrv_fetch_array($getResults, SQLSRV_FETCH_ASSOC)) { echo($row['ProductName'] . "\r\n" . PHP_EOL); //echo($row['ProductId'] . "<br>" . PHP_EOL); //$row = sqlsrv_fetch_array($getResults, SQLSRV_FETCH_ASSOC); //echo ($row['ProductName'] . "\n" . PHP_EOL); } sqlsrv_free_stmt($getResults); ?>
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.