• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mysql user defined variable

#1
[eluser]dannythebestguy[/eluser]
I want to use a user defined Mysql variable in a Select statement and run it through query function.

$sql = 'Select @var := col1 - col2 FROM table1 WHERE col3 = @var';
$query = $this->db->query($sql);
$data = $query->result_array();

But CI is not returning the records.

Please let me know how to go about and to set the variable too.

Thnx

Dinesh


Messages In This Thread
Mysql user defined variable - by El Forum - 04-25-2011, 10:01 PM
Mysql user defined variable - by El Forum - 04-25-2011, 10:33 PM
Mysql user defined variable - by El Forum - 04-25-2011, 10:36 PM
Mysql user defined variable - by El Forum - 04-26-2011, 01:11 PM
Mysql user defined variable - by El Forum - 04-26-2011, 01:54 PM
Mysql user defined variable - by El Forum - 04-26-2011, 02:03 PM
Mysql user defined variable - by El Forum - 04-26-2011, 03:17 PM
Mysql user defined variable - by El Forum - 04-26-2011, 03:21 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.