Monday, December 11, 2017

Blogger For you

Blogger For you:
IP Address : 83.110.137.104
Ads Title : Sample PDO Connection sql server on php
Country : Tutorial PHP Program
Description : Sample Trick Sample PDO Connection sql server on php

#########################
Stat Copy From Here sample the php sql server pdo connection field by month date
years amount



<?php
$myServer = "";
$myUser = "";
$myPass = "";
$myDB = "Analysis";








//create an instance of the ADO connection object
$conn = new COM ("ADODB.Connection")
or die("Cannot start ADO");

//define connection string, specify database driver
$connStr = "PROVIDER=SQLOLEDB;Server=;Uid=Countuser;Pwd=;Database=";
$conn->open($connStr); //Open the connection to the database

//declare the SQL statement that will query the database
$query = "SELECT
YEAR(date) AS [Year],
MONTH(date) AS [Month],
DATENAME(MONTH, date) AS [Month Name],
sum(amount) AS [Sales Amount]
FROM dbo.DailySales
GROUP BY YEAR(date), MONTH(date), DATENAME(MONTH, date)
ORDER BY YEAR(date), MONTH(date)




















";

//execute the SQL statement and return records
$rs = $conn->execute($query);

$num_columns = $rs->Fields->Count();
echo $num_columns . "<br>";

for ($i=0; $i < $num_columns; $i++) {
$fld[$i] = $rs->Fields($i);
}

echo "<table>";
while (!$rs->EOF) //carry on looping through while there are records
{
echo "<tr>";
for ($i=0; $i < $num_columns; $i++) {
echo "<td>" . $fld[$i]->value . "</td>";
}
echo "</tr>";
$rs->MoveNext(); //move on to the next record
}


echo "</table>";

//close the connection and recordset objects freeing up resources
$rs->Close();
$conn->Close();

$rs = null;
$conn = null;
?>
Name : Asrocool
Email : asrocool@gmail.com

0 comments:

Post a Comment