Jump to content

Search the Community

Showing results for tags 'mssql'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (Dreamweaver, Zend, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

Found 5 results

  1. I have 5 dropdowns on a tab of a website. I have a database table in MS SQL Server. The table has all the data of 5 dropdowns with one of the fieldNames called Region_Name, say the Region_Names are A, B, C, D, and E. I have written codes to display a table and enabled row editing for one of the RegionNames. Now, I am wondering if I could modify the same codes to display associated table with row editing enabled using different queries when a dropdown is clicked. That could reduce the code repetition and improve the performance. But I do not know how to achieve this. Could anyone please give me some hints? I am using PHP PDO to connect to the database.
  2. Hello All, I'm trying to use PHP to post to MSSQL server, I can get a connection however when I attempt my MSSQL Statement the query just won't work. This is most troubling, anyone have any suggestions Here's my code $conn = mssql_connect( 'myServer', "username", 'password', 'database' ) or die('Error Connecting'); $sql = "INSERT INTO Employees (Area, isTicketRep) VALUES ('789456', '1')"; mssql_query($conn, $sql) or die('Error Querying MSSQL Database'); mssql_close($conn); I have tried an if statement to ensure a connection, I have a connection....however the query just wont execute. There are numerous column on my database table but I'm only submitted selected field. In addition the actual table is called "Employees" but on the server reads "dbo.Employees". My Database is called "cs_all" Just won't seem to query, thanks in advance for any suggestions
  3. Hi, I have a Procedures ready to auto send email to employee when the reminder date equal today. Let me show you what is inside my employee database. As you can see, there is two records for employee 1001. This is because this employee short notice for 2 months. [sdate] There is also a shortNotice which is in December is 4 day, in January is 18 days. So, the consist days is 18+4=22 Days This is my procedure code, it's working, this procedure will trigger out email if meet the criteria. ***REMEMBER TO CHANGE THE SERVER NAME & PORT NUMBER*** USE [RSA] GO /****** Object: StoredProcedure [dbo].[sp_send_cdosysmail] Script Date: 12/10/2015 3:55:00 PM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[sp_send_cdosysmail] @From varchar(100)="notification@mail.com", @Subject varchar(100)="A Reminder for you", @body varchar(4000)=" ", @attachments varchar(4000)=NULL AS DECLARE @out_desc VARCHAR(1000), @out_mesg VARCHAR(10) DECLARE @empid nvarchar(255), @Name nvarchar(255), @Email nvarchar(255), @reminderDate datetime, @lastDay datetime, @shortNotice int, @consistsDays int, @sdate datetime Declare C1 CURSOR READ_ONLY FOR SELECT DISTINCT [empid],[Name],[Email],[reminderDate],[lastDay],[shortNotice],[consistsDays],[sdate] FROM [resigntblView] Declare @iMsg int Declare @hr int Declare @source varchar(255) Declare @description varchar(500) Declare @output varchar(1000) Declare @files table(fileid int identity(1,1),[file] varchar(255)) OPEN C1 FETCH NEXT FROM C1 INTO @empid,@Name, @Email, @reminderDate, @lastDay,@shortNotice,@consistsDays,@sdate WHILE @@FETCH_STATUS = 0 BEGIN IF DATEPART(DAY,@reminderDate) = DATEPART(DAY,GETDATE()) AND DATEPART(MONTH,@reminderDate) = DATEPART(MONTH,GETDATE()) AND DATEPART(YEAR,@reminderDate) = DATEPART(YEAR,GETDATE()) BEGIN SET @body = '<b>Hi ' + @Name + '</b><br />This is a reminder' + '<br /><br />Thank You' --************* Create the CDO.Message Object ************************ EXEC @hr = sp_OACreate 'CDO.Message', @iMsg OUT --***************Configuring the Message Object ****************** -- This is to configure a remote SMTP server. -- http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_schema_configuration_sendusing.asp EXEC @hr = sp_OASetProperty @iMsg, 'Configuration.fields ("http://schemas.microsoft.com/cdo/configuration/sendusing"). Value','2' -- This is to configure the Server Name or IP address. -- Replace MailServerName by the name or IP of your SMTP Server. EXEC @hr = sp_OASetProperty @iMsg, 'Configuration.fields ("http://schemas.microsoft.com/cdo/configuration/smtpserver"). Value', '#######' --PUT YOUR SERVER HERE -- Save the configurations to the message object. EXEC @hr = sp_OAMethod @iMsg, 'Configuration.Fields.Update', null -- Set the e-mail parameters. EXEC @hr = sp_OASetProperty @iMsg, 'To', @Email EXEC @hr = sp_OASetProperty @iMsg, 'From', @From EXEC @hr = sp_OASetProperty @iMsg, 'Subject', @Subject -- If you are using HTML e-mail, use 'HTMLBody' instead of 'TextBody'. EXEC @hr = sp_OASetProperty @iMsg, 'HTMLBody', @body EXEC @hr = sp_OAMethod @iMsg, 'Send' -- Do some error handling after each step if you need to. -- Clean up the objects created. EXEC @hr = sp_OADestroy @iMsg END FETCH NEXT FROM C1 INTO @empid,@Name, @Email, @reminderDate,@lastDay,@shortNotice,@consistsDays,@sdate END CLOSE C1 DEALLOCATE C1 Once the Procedures is execute, this is the OUTPUT that i received in my inbox: Hi Foo, Kelvin This is a reminder Thank You This Email will Trigger two times since there is a two column of data. My question is, how to merge some of the data in one, and send the email only once. Expected Output: Hi Foo, Kelvin, You are required to compensate USD 100 to the Company in view of your 22 days of short notice. The 1 month of your notice period consist of 22 working days, (01-12-2015 - 31-12-2015), 4 Days The 2 month of your notice period consist of 22 working days, (01-01-2016 - 31-01-2016), 18 Days Thank You. Thanks for your big help.
  4. Hello, I have a question regarding SQL. Please refer my attachment below: Query 1: SELECT dbo.[evaluation[Submit]]].FormID, dbo.empDB.Name, dbo.FormTbl.FormName, dbo.[evaluation[Submit]]].groupName, dbo.[evaluation[Submit]]].subGroup, dbo.subgrouptbl.subgroupName FROM dbo.[evaluation[Submit]]] INNER JOIN dbo.empDB ON dbo.[evaluation[Submit]]].EmpID = dbo.empDB.EmployeeID INNER JOIN dbo.FormTbl ON dbo.[evaluation[Submit]]].FormID = dbo.FormTbl.FormID INNER JOIN dbo.subgrouptbl ON dbo.[evaluation[Submit]]].subGroup = dbo.subgrouptbl.subgroupID WHERE (dbo.[evaluation[Submit]]].EmpID = '00001') This view of table give me correct of the output. Which give me 36 of results. Please refer attachment below: But, when i try to put additional table which i need to indicated whether the form is completed or draft, it's because i do not want to show "draft" form in the table. Have a look on the table below: After i added this table into my view, the output is repeated 2 times and give me 72 of results. Query 2: SELECT dbo.[evaluation[Submit]]].FormID, dbo.empDB.Name, dbo.FormTbl.FormName, dbo.[evaluation[Submit]]].groupName, dbo.[evaluation[Submit]]].subGroup, dbo.subgrouptbl.subgroupName, dbo.EmployeeDetails.submissionStatus FROM dbo.[evaluation[Submit]]] INNER JOIN dbo.empDB ON dbo.[evaluation[Submit]]].EmpID = dbo.empDB.EmployeeID INNER JOIN dbo.FormTbl ON dbo.[evaluation[Submit]]].FormID = dbo.FormTbl.FormID INNER JOIN dbo.subgrouptbl ON dbo.[evaluation[Submit]]].subGroup = dbo.subgrouptbl.subgroupID INNER JOIN dbo.EmployeeDetails ON dbo.empDB.EmployeeID = dbo.EmployeeDetails.EmpID WHERE (dbo.[evaluation[Submit]]].EmpID = '00001')
  5. I have a stored procedure that simply returns 1 result and only 1 row. The output when run through studio looks like the attached image. I have written local VB applications that execute the stored procedure and output the data on screen without issue. But when I use the below PHP app it acts as if though the stored procedure did not return any rows. All I get on the screen is the "Statement Executed" echo. Now other stored procedures work fine when I use this same code, but I know this SP is returning a row with a value (see attached screenshot) in it, so I can't understand why PHP would see only this SP as not returning a value. $connectionInfo = array( "UID"=>$uid, "PWD"=>$pwd, "Database"=>$databaseName); /* Connect using SQL Server Authentication. */ $conn = sqlsrv_connect( $serverName, $connectionInfo); $tsql = "Exec GetBalanceForBalanceSite '1008'"; /* Execute the query. */ $stmt = sqlsrv_query( $conn, $tsql); if ( $stmt ) { echo "Statement executed.<br>\n"; } else { echo "Error in statement execution.\n"; die( print_r( sqlsrv_errors(), true)); } /* Iterate through the result set printing a row of data upon each iteration.*/ while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC)) { echo $row[0]; }
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.