PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, January 29, 2022

[FIXED] How to call a stored procedure in CodeIgniter USING SQL SERVER

 January 29, 2022     codeigniter, php, sql-server, sqlsrv, stored-procedures     No comments   

Issue

I'm bulding my application using Codeigniter and SQL server as my database (I am using the SQLSRV PHP extension to connect to SQL ). The problem happens when I try to call Stored Procedures:

$query = $this->db->query(
          "EXECUTE verificacion_fechas '".$codigo."',".$estado.",'".$llave_maestra."','".$fecha_actual."'"); 

Another way I have tried to create the query with less data is the following , however, it is generating an error:

Error Number: 01000 [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Ejecutando SQL directamente, sin cursor. EXECUTE provando15 34,2,'key05','2015-07-22'

I dont really know what im doing wrong. Can someone please help me?


Solution

remove the word Execute and it will work.

$query = $this->db->query(
      "verificacion_fechas '".$codigo."',".$estado.",'".$llave_maestra."','".$fecha_actual."'");


Answered By - steve
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing