Tag: php

Trying to delete Database (MsSQL) from PHP with PDO

As the title might have explained, i have a php project here. Inside i use PDO to connect to my database. At first PHP was connected to a MySQL-Database. But now things have changed and I use a MsSQL-Database. In MySQL you can easily do the following: DROP DATABASE IF EXISTS mydatabase; How can this […]

Identify date format from a string in PHP

I am trying to update all of the date fields in the database to add 5 days to each date in all tables. I managed to pull the dates and row id into an array then generate a SQL code statement to update them. However, each table has a different date format some with time […]

Ampersand and number sign (& and #)

Ampersands and number signs do not get stored in MS SQL whenever I insert data (and it will cut the next word after the ampersand and number sign). I’m using an NVARCHAR column on my MS SQL Server 2014. For example if I type “AJ & J,” after I search it the output will be […]

Updating an existing user does not work in php

when I try to update my database to change the location of an existing user, I receive the text in an echo which is desired but the details of a user are not changed. Here is my code – server details have been removed on purpose for privacy. { $server = ”; $connectionInfo = array(“Database”=>””); […]

connecting PHP to MSSQL error

I’m currently trying to connect to a MSSQL database, but from what i’ve read so far, there are actually extensions and files that i need to download from microsoft itself which i’ve went and download it here. https://www.microsoft.com/en-us/download/details.aspx?id=20098 The error that i’m receiving currently receiving is the following. Fatal error: Uncaught Error: Call to undefined […]

I'm getting “invalid sql display size” when trying to fetch rows from SQL Server via PHP

So I decided to hash the password field in my Users table and on my login page I’m needing to check to make sure they’ve entered the correct password. So here’s where I get the password from the table: $stmt = sqlsrv_query( $conn, “SELECT * FROM Users where Username='”.$user.”‘”); $passhash = “”; while( $row = […]


I am trying to query data from MS SQL 2008 server. I am querying data from a SQL View. Not a SQL table. Does anyone know if SQLSRV is able to query a View from SQL Server? Sample code below. Works when I use a Table but not when using a SQL View. I am […]

Creating PHP Search Page to search SQL Server database

**Edited for more info I’m having issues creating a search page to display results from a SQL Server database. My SQL is correct because it outputs what I want in SSMS. My connection info is also correct as I’ve tested that. My issue is coming from tying it into the search form – I can’t […]

What is a best way to implement a SQL Server Job Scheduler

I am getting some SQL Server database backups (.bak) daily and I need to restore the data from the backup daily to SQL Server, then remove that .bak file from the files. What is the best way to do this? Is using PHP will make it easier?

Connect To SQL Server On Joomla

I know am attempting to use this syntax to connect from Joomla to SQL Server. However, this throws an ERROR 500 – what is the proper synatx to connect from Joomla To SQL Server? if(!empty($_SERVER[‘HTTP_X_REQUESTED_WITH’]) && strtolower($_SERVER[‘HTTP_X_REQUESTED_WITH’]) == ‘xmlhttprequest’) { $uid = “user”; $pwd = “pwd”; $DB = “database”; $serverName = “IP”; $connectionInfo = array(“UID” […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.