Tag: php

Character Set issue using SQL Server and ODBC in php

I connected to to sqlsever2008 with odbc(with dsn) and php but problem is that when I retrieve information from that it has character like ���������. My datatype in sqlserver is nvarchar. Any idea why it is happening? NOTE: The page is utf8. Edit: I use echo utf8_encode(odbc_result($this->result,’name’) ); and characters are like: ÂãæÒÔ ÒÈÇäÂãæÒ i […]

Subtract fetched datetime from current date time

I need to calculate the time difference between the localDatetime and a Datetime fetched from a specific row in my database-table(csv) called ReportedDateAndTime. I searched a lots of solutions but it doesn’t working for me. Displaying localtime & the fetched time from Database are working. But the time difference doesn’t. Here is my code so […]

Calculating the difference between two times using php, and then adding it to a total of time type

Hi I have a problem where I am trying to get a total time that a job has taken (using database fields job_start and job_end time(7)) then adding this to another model’s field, the code i have is if (isset($_POST[‘Jobs’])) { $model->attributes = $_POST[‘Jobs’]; $model->setScenario(‘closejob’); $model->status = 2; //set status to closed //date time difference […]

Storing MS SQL Server credentials in a MySQL Database

I am developing a website that connects to a users MSSQL database to collect information. Users are assigned to different MSSQL database accounts and connect to them using the IP, username and password stored inside the MySQL DB. Currently, what I’ve got is PHP the AES encrypts/decrypts the passwords as needed. That just doesn’t seem […]

How to connect PHP with SQLServer

I’m trying to connect the SQLServer 2008 with the PHP 5.4.6. But the server returns the following error: Fatal error: Call to undefined function mssql_connect () I have looked in many places and they all say to go in PHP.ini and uncomment the line: extension = php_mysql.dll But my php.ini file doesn’t have this line. […]

Php with MSSQL display raw data from varbinary field

I am trying to display the raw data from a varbinary field in SQL server in php. I want to return exactly what I have in SQL Server (0x00000etc.) but it seems to be doing some sort of conversion and returning to me something like )T¡òaýCž«V°Ø‘©O Hopefully this makes sense to someone. Thank you

MySQL query problem

Possible Duplicate: Warning: mysql_fetch_* expects parameter 1 to be resource, boolean given error $result3=mysql_query(“select * from $mail ORDER BY `data_id` DESC”); in this case if data_id is NULL query is showing Warning – Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in F:\xampp\htdocs…

“PHP Fatal error: Call to undefined function mssql_select_db() in c:\…appscript.php on line 16”

Folks, Im trying to run a basic php script in cmd prompt which connects to sql server 2012 on my local machine, its gives me the following error…”PHP Fatal error: Call to undefined function mssql_select_db() in c:…appscript.php on line 16″ Here is my script, im not very familiar with php but have been playing around […]

sqlsrv_connect: Data source name not found and no default driver specified

I am trying to connect to SQL Server 2008 on machine-1 from PHP code on another machine-2. I am using PHP 5.4.7, XAMPP 1.8.1 and I have copied the sql server dlls into PHP/ext folder and modified the php.ini file. Now, when I try to connect to SQL server I am getting following error. Array […]

PHP MsSQL PDO or API

I usually work with PHP MySQL and resultantly, my knowledge with MsSQL is somewhat limited. I am about to write a class that makes executing MsSQL queries much easier for myself and my associates. However, in my research, I have found that I have two options of how to connect to an MsSQL database; I […]

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