Jump to content

scamquist

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Everything posted by scamquist

  1. I found a solution by calling a bat file with the following statement in the bat file osql -E -d Iris -S Gamay-srv1 -Q "Exec RunRefresh ;
  2. I changed $serverName = "127.0.0.1" Did not work. the Local is working on about 20 other pages, so the connection is working. The operating system is Server 2003 Service Pack 2 and SQL 2005
  3. I am trying to call a stored procedure named RunRefresh. There are no paramaters. When I run exec RunRefresh, a table is refreshed. Nothing is displayed or changed on the php page. I have tried: <?php include('php/SessionSetup.php'); if(isset($_POST['submit'])) { sqlsrv_execute( $conn, runrefresh); echo "Done!"; } else { // display the form ?> <form action="" method="post"> <input type="submit" name="submit" value="DO IT!"> </form> <?php } ?> ------------------------------------------------------------------------------------------------------------------- The procedure does not appear to run. the include('php/SessionSetup.php'); contains the statement include('queries/ConnIris.php'); ------------------------------------------------------------------------------------------------------------------- ConnIris is $serverName = "(local)"; $connectionInfo = array("UID" => "username", "PWD" => "xxx", "Database"=>"MyDb"); $conn = sqlsrv_connect( $serverName, $connectionInfo); ------------------------------------------------------------------------------------------------------------------- I am using IIS (if that makes a difference)
  4. Thanks for the pointer. I will see if this works and can send the text to my sql database
  5. My PHP page is connected to a MS SQL database. I have a recipe table that includes has a text field for recipe notes. I want to create a text box, pretty much like what I am using to enter this message and add the text to the database. Can this be done in PHP with the formatting bells and whistles (but no faces)?
  6. I found the solution using SQL Server Authenticatoin. Here is the code: <?php $serverName = "(local)"; $connectionInfo = array("UID" => "MyUserName", "PWD" => "MyPassword", "Database"=>"MyDatabase"); $conn = sqlsrv_connect( $serverName, $connectionInfo); if( $conn ) { echo "Connection established.<br>"; } else { echo "Connection could not be established.<br>"; die( print_r( sqlsrv_errors(), true)); } ?> Replace MyUserName, MyPassword and MyDatabase with your actual values
  7. The error message merged into the code. Sorry Connection could not be established. Array([0] => Array ([0] => 28000 [sqlSTATE] => 28000 [1] => 18456 => 18456 [2] => [Microsoft][sql Server Native Client 10.0] [sql Server]Login failed for user 'GAMAY\IUSR_GAMAY-SRV1'. [message] => [Microsoft][sql Server Native Client 10.0][sql Server]Login failed for user 'GAMAY\IUSR_GAMAY-SRV1'. ) [1] => Array ( [0] => 28000 [sqlSTATE] => 28000 [1] => 18456 [code] => 18456 [2] => [Microsoft][sql Server Native Client 10.0][sql Server]Login failed for user 'GAMAY\IUSR_GAMAY-SRV1'. [message] => [Microsoft][sql Server Native Client 10.0][sql Server]Login failed for user 'GAMAY\IUSR_GAMAY-SRV1'. ) )
  8. I am trying to connect to my SQL 2005 DB using Windows Authentication with PHP 5.3.7. I am using IIS on Server 2003. I am getting this error: Connection could not be established. Array ( [0] => Array ( [0] => 28000 [sqlSTATE] => 28000 [1] => 18456 => 18456 [2] => [Microsoft][sql Server Native Client 10.0][sql Server]Login failed for user 'GAMAY\IUSR_GAMAY-SRV1'. [message] => [Microsoft][sql Server Native Client 10.0][sql Server]Login failed for user 'GAMAY\IUSR_GAMAY-SRV1'. ) [1] => Array ( [0] => 28000 [sqlSTATE] => 28000 [1] => 18456 [code] => 18456 [2] => [Microsoft][sql Server Native Client 10.0][sql Server]Login failed for user 'GAMAY\IUSR_GAMAY-SRV1'. [message] => [Microsoft][sql Server Native Client 10.0][sql Server]Login failed for user 'GAMAY\IUSR_GAMAY-SRV1'. ) ) Here is my code: <?php /* Specify the server and connection string attributes. */ $serverName = "(local)"; $connectionInfo = array( "Database"=>"Iris"); /* Connect using Windows Authentication. */ $conn = sqlsrv_connect( $serverName, $connectionInfo); if( $conn === false ) { echo "Unable to connect.</br>"; die( print_r( sqlsrv_errors(), true)); } /* Query SQL Server for the login of the user accessing the database. */ $tsql = "SELECT CONVERT(varchar(32), SUSER_SNAME())"; $stmt = sqlsrv_query( $conn, $tsql); if( $stmt === false ) { echo "Error in executing query.</br>"; die( print_r( sqlsrv_errors(), true)); } /* Retrieve and display the results of the query. */ $row = sqlsrv_fetch_array($stmt); echo "User login: ".$row[0]."</br>"; /* Free statement and connection resources. */ sqlsrv_free_stmt( $stmt); sqlsrv_close( $conn); ?> Any help will be appreciated
×
×
  • Create New...

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.