Tag: php

Why doctrine can't order by a virtual joined column and have setMaxResult and setFirstResult?

I have the following problem: I want to select some fields from an entity and to count for each selected row some rows from another table. I run the following code: $qb = $this->createQueryBuilder(‘ff’) ->select(‘ff as feedbackForm, COUNT(ffa.id) as completedForms’) ->leftJoin(‘AppBundle:FeedbackFormAction’, ‘ffa’, ‘WITH’,’ffa.feedbackForm = ff.id ‘) ->groupBy(‘ff’); if (!empty($pageSize)) { $qb->setMaxResults($pageSize); } if (!empty($offset)) { […]

PHP (on Vagrant) Connect to Microsoft SQL server 2014

I am working Locally on Windows 10. And I have a vagrant [Virtualbox Version 5.0.24 r108355] setup with the following Configurations: CentOS release 6.8 (Final) PHP 5.6.25 mssql Library version FreeTDS Apache/2.2.15 (Unix) Also, I have installed Microsoft SQL Server 2014 on it. [Queries] Is this possible to Connect to MS-SQL from a Vagrant Machine. […]

SQL Query – Get distinct count of two tables

Table 1(student_details) Is having 532 datas with different advisor each data is assigned to one advisor like id advisor — ——- 1 Bala 2 Shanmugam 3 Priya 4 Bala etc.. Similaly in table 2:training_details id advisor — ——- 1 Bala etc.. I tried this query this will return count of people assigned to each advisor […]

The specified DSN contains an architecture mismatch between the Driver and Application,

Here is the exception that I am getting: ErrorException in DocketController.php line 65: odbc_connect(): SQL error: [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application, And here is the Docketcontroller.php line number 65: // Localhost $dsn = “test2”; $conn=odbc_connect($dsn, “QA”, “QA”); if (!$conn) { exit(“Connection Failed: ” . $conn); […]

How to get information from SQL table with php

So i’ve created a database on SQL, i’m trying to get information (id,title and date)out of one of the tables i need and make an html element of it but when i run the function nothing happens. <?php function getTitles (){ $conn; $sql=’SELECT * FROM `thumbnails`’; $statement = $conn->prepare($sql); $statement->bindValue(“:title_id”,$title_id); $statement->execute(); $titles = $statement->fetchAll(); $output=”; […]

“Call to undefined function sqlsrv_connect()” in Wamp, drivers installed

This question already has an answer here: Call to undefined function sqlsrv_connect() with WAMP 3 answers

TextWrangler SQL Formatter PHP Script

I am trying to format sql using Text Wrangler. I have saved a php file in the location ~/Library/Application Support/TextWrangler/Text Filters. However my formatter is working, but its converting the table names to uppercase. I don’t want to change the case of tables. Following is my php script: #!/usr/bin/php <?php /** * BBEdit SQL format […]

I'm having issue with data insertion through mssql

I am trying to perform data insertion in php through mssql. But my problem is when I’m running my code using mysql it’s working perfectly fine, but when I’m using mssql it’s showing me error. Notice: Array to string conversion in C:\xampp\htdocs\loginphp\register.php on line 52 Error: Array Here is screenshot of my data insertion query. […]

using mssl in codeigniter, joined 2 tables and getting error with limit

I am joining 2 tables, and its working fine.. but when i have added limit then it gives error my model funciton is this $username = trim($this->session->userdata(‘userdata’)[‘user_username’]); $this->db->select(‘*’); $this->db->from(‘sinv’); $this->db->where(‘sinv.doc_type’,”SI”); $this->db->join(‘customer_agentREL’,’sinv.custcode = customer_agentREL.custcode’); $this->db->where(‘customer_agentREL.agent’,$username); $this->db->order_by(“sinv.createdate DESC”); $this->db->limit($limit, $start); $query = $this->db->get(); $result = $query->result_array(); return $result; eror i am getting is Error Number: 42000/8156 [Microsoft][ODBC […]

How to upload file into microsoft sql server 2012 using PHP form file upload?

I have never uploaded a file into a database before using a HTML upload form so not sure how to do it. I have started to modify how I would normally upload text data below though I am not sure what I am doing wrong or where to go from here. I suspect the issue […]

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