Tag: php

Echo JSON in a d3.js chart

I have a chart created using d3.js where if you hover over the months,the weekly scores are found. Fiddle link to the chart I am talking about here : https://jsfiddle.net/qp7L1hob/1/ I also have a table in my DB where I maintain the record of the scores of the Employees every week.What you see here is […]

Make eloquent give only sql clause

I was trying to rip off every connection function of Laravel’s eloquent to give me SQL clause without querying it with PDO ( I also cleaning off every PDO instances from the code) and make eloquent a standalone package. I just want it to give me sql clause without connect to any db when I […]

sql select and group by CURRENT_TIMESTAMP

I’m trying to select and group by date from MySQL. table looks like this: `id` int(11) NOT NULL, `run_data` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `date_day` varchar(20) NOT NULL, `number_of_links` int(20) NOT NULL, for selecting, I’m using: SELECT date_day, SUM(number_of_links) FROM my_table GROUP BY date_day DESC LIMIT 30 I’m getting total number of links per day […]

Taking a String and Inserting Only Numbers from that String

I have a dialog box that pops up after hitting an Add button. There are two inputs, one being a dropdown. The information in the dropdown for example looks like this, 1 – Company A, 2 – Company B, etc. It is a value made up of 2 concatenated values. I need MR_ID, not MR_Name. […]

I have got an error On SQL query – PHP-SQLWarning: mssql_query(): message: Incorrect syntax near '='. (severity 15)

I am running this php code with sql query but it keeps showing this error and i couldn’t find where the mistake is? Can you help please.THANKS IN ADVANCE Warning: mssql_query(): message: Incorrect syntax near ‘=’. (severity 15) Warning: mssql_query(): General SQL Server error: Check messages from the SQL Server (severity 15) Warning: mssql_query(): Query […]

Looping for each column name of a MSSQL table using php

If I have [x] [y] [z] columns inside a [mytable] table in MSSQL, I would like to know how can I loop through each of them using php in order to have all of the columns’ name? The reason is because I could potentially delete or add a column so that php code would make […]

Call to undefined function sqlsrv_connect() – Troubleshooting

System Information CMS: WordPress Web Server: XAMPP PHP Version: 5.5.30 MS Management Studio 17 Goal Establish MSSQL Database connection using PHP What has been done Downloaded SQLSRV Drivers Copied files php_pdo_sqlsrv_55_nts.dll and php_pdo_sqlsrv_55_ts.dll to the directory C:\xampp\php\ext Added the following lines to the dynamic extensions part in the php.ini file: extension=php_pdo_sqlsrv_55_ts.dll and extension=php_pdo_sqlsrv_55_nts.dll Restarted Web […]

Prepared Statement with TS

I’m having trouble with this syntax for sqlsrv driver. This works just fine: $sql = “SELECT * from Table1 WHERE (Table1.Time >= {ts ‘2017-05-08 00:00:00’ } AND Table1.Time < {ts ‘2017-05-10 00:00:00’ })”; $stmt = sqlsrv_query( $conn, $sql ); $tbl = “<table>” while ($row = sqlsrv_fetch_array($stmt)){ $tbl .= “<tr><td>”.$row[0].”</td><td>”.$row[1]->format(‘Y-m-d H:i:s’).”</td><td align=\”center\”>”.$row[2].”</td></tr>”; } $tbl .= “</table>”; […]

How to browse results with php mssql?

I’m working with php and I want to do a next button that’s step to the next 10 records (like when you browse question with stackoverflow) I don’t know how to do that but I’m thinking to do it with Top n record ? Do you think that’s a good idea ? Any suggestion?

Drupal, SQL Server and IIS7

Is there a SQL Server Provider for Drupal? I know that there is a SQL Server Client for PHP in beta and I wonder whether it would be hard to change the database provider to point to SQL Server instead of MySQL.

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