I am tryin to use a stored procedure from MS SQL in PHP for my AGI that would return certain values. I am not sure how to use these return values as variables. I would like to use Column1, Column2 (all 3 rows), Column (all 3 rows) as variables.
<?php
require('/var/lib/asterisk/agi-bin/phpagi.php');
$agi=new AGI();
$agi->answer();
$cli=$agi_callerid;
$con = mssql_connect('host','user','pass') or die('ERROR : Could not
connect to the server!');
if (!$con)
mssql_select_db('DB') or die('ERROR : Could not select a DATABASE');
$proc = mssql_init('exec store_procedure '$cli'', $con);
$proc_result = mssql_execute($proc);
mssql_free_statement($proc);
?>
I am a complete newbie to PHP and any help would be highly appreciated. Please please please reply! Thanks!
For anyone searchin somethin similiar to this... I used followin code...
$sql_statement = mssql_init("stored_procedure '$cli'", $conn);
$result=mssql_execute($sql_statement);
$x=0;
while ($row = mssql_fetch_assoc($result))
{
$column1[$x]= $row['Column1'];
$column2[$x]= $row['Column2'];
$column3= $row['Column3'];
$x++; }
mssql_free_statement($sql_statement);
then I simply echoed the variables $column1[0], $column2[1] etc etc...