Tag: php

sqlsrv UPDATE statement runs but doesn't update DB

I have an issue where my PHP sqlsrv UPDATE statement runs and doesn’t return any errors but nothing in the DB ever changes and the row is not actually updated. Is there something I am missing that would allow this query to appear to run successfully but not update the row? I have checked that […]

How to connect to remote MSSQL database using php 5.5.19

I have had a problem trying to establish a connection to a MSSQL database I created in Microsoft SQL Server Manager 2008 R2 using php 5.5.19 in XAMPP. In the php.ino configuration file under extensions, there is commented out a ‘;extension=php_mssql.dll‘. I removed the comment and ran apache in the xampp control panel. Naturally an […]

PHP Byte Array to Base64 (Byte Array From Mssql)

I use Mssql and images on table like “0xFFD8FFE000104A46494….” . I think it is byte array. And I wanna change it to image with PHP. I try this; <?php $resim=”0xFFD8FFE000104A46494….”; ?> <img src=”data:image/jpeg;base64,<?php echo base64_encode($resim);?>” /> But image doesn’t show. Code demo: (http://sandbox.onlinephpfunctions.com/code/61b8f073a70100338681e8ab37b0a75c930eca6e)

PHP: How do I establish a connection to my SQL Server?

I usually use my SQL Server with SQL Server Management Studio. When logging in there I use Windows Authentication and do not specify a Username/Password. So the username/password I’m using at the moment is the same I use logging onto my computer. I’m attempting to establish a connection to the server through PHP; however, I […]

Custom sorting algorithm for a large amount of data

I have a large amount of data that I need to sort in a specific way based on a search query, but I’m not sure of the best approach to take. The data I’m trying to sort is a list of courses, grouped by schools. Each course is taught by one school. Each school may […]

Display an image stored as blob in SQL Server

I have a query to fetch info images : $q4 = “SELECT TOP 3 b.BadgeName, b.BadgeImage FROM BadgeImageTable AS b INNER JOIN employee_badge AS e ON e.badge_id = b.BadgeID WHERE e.employee_id = 2164 ORDER BY e.earned_on DESC “; $stmt3=sqlsrv_query($conn,$q4); if($stmt3==false){ echo ‘error to retrieve info !! <br/>’; die(print_r(sqlsrv_errors(),TRUE)); } HTML previous: <!– <span class=”fa-stack fa-5x […]

MSSQL Query returns unknown data type in a CONVERT date field

I have a query like this SELECT field1, field2, CONVERT(date, field3) as fieldDate FROM table Pretty simple indeed, It’s works on the server and another mac, but, in my mac, PHP returns the message: Severity: Warning Message: mssql_query(): column 3 has unknown data type (40) Te query object returned only have the field1 and field2 […]

String data, right truncation in SQLSRV PHP Driver (“donut hole”)

I’m writing large-ish amounts of text to a text column using Microsoft’s sqlsrv PHP driver (on a Windows 2003 server). There’s an odd “donut hole” error, where if the length of the text is fairly small, it is saved successfully, and if the text is sufficiently large, it is also save successfully. In between, we […]

PHP PDO with SqlServer Stored Procedure doesn't return all the data

I’ve been given an stored procedure that is called like this: SP_REPORT_HOME ‘param1′,’param2′,1 It executes a bunch of code i’m not aware of, although it return a bunch of data I need to use. It contains some fields with null values, while others are fully filled (note that the entire row is not null, only […]

Use MSSQL and MySQL with CodeIgniter

I am trying to connect my application to two databases. One is MySQL and one is MSSQL. I tried to find a place to start on Google, but I wasn’t successful. I didn’t found anything useful on previous questions similar to mine on StackOverflow. Did any of you connected CI app with MySQL and MSSQL […]

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