Jump to content

Recommended Posts

<?php

/* Define the Transact-SQL query. Use question marks (?) in place of  the parameters to be passed to the stored procedure */
$tsqlNavDiv_callSP = "{call sp_services_content_navigation_module( ?, ?, ?, ?, ?, ?, ?, ?, ?)}";

/* Define the parameter array. By default, the first parameter is an INPUT parameter. The second parameter is specified as an OUTPUT parameter. To ensure data type integrity, output parameters should be initialized before calling the stored procedure, or the desired PHPTYPE should be specified in the $params array.*/

$opt_out_eap = $_SESSION['id_eap'];
$opt_out_company = $_SESSION['id_company'];
$content_languages_list = $_SESSION['id_language'];
$publish = 'public';
$id_eap = $_SESSION['id_eap'];
$today=(date("Y-m-d"));
$total='';
$id_module='';

$paramsNavDiv = array(
	array($opt_out_eap, SQLSRV_PARAM_IN),
	array($opt_out_company, SQLSRV_PARAM_IN),
	array($content_languages_list, SQLSRV_PARAM_IN),
	array($publish, SQLSRV_PARAM_IN),
	array($id_eap, SQLSRV_PARAM_IN),
	array($today, SQLSRV_PARAM_IN),
	array($id_division, SQLSRV_PARAM_INOUT),
	array($total, SQLSRV_PARAM_OUT),
	array($id_module, SQLSRV_PARAM_OUT)
);

/* Execute the query. */
$stmtNavDiv = sqlsrv_query( $conn, $tsqlNavDiv_callSP, $paramsNavDiv);

if( $stmtNavDiv === false )
{echo "Error in executing statement 3.\n";
	die( print_r( sqlsrv_errors(), true));}


	$i='120'; 
	$i <= '141';
	while ($obj=sqlsrv_fetch_object($stmtNavDiv)) {
	// SET PARAMETERS
	$total= $obj->total;
	$id_division= $obj->id_division;
	$id_module= $obj->id_module;
	$i++;

if ($total > 0) { 
			echo "<li><a href=\"".$_SESSION['pwfurl']."/p_module.php?id_division=".$id_division_menu."&id_module=m".$id_module."\">".$_SESSION['m'.$id_module]."</a></li>";

}
	}


/*Free the statement and connection resources. */
sqlsrv_free_stmt( $stmtNavDiv);
?>

I pull a menu back in my website that has an id number (300, 305, 302, 303, 304, 301, 306) -This number is stored in SQL.  Each of the menu numbers is associated with a slot number (121, 122, 123, 124, 125, 126, 127) These are not in SQL.  Right now, my stored procedure is ordering by the id number instead of the slot number.  So my question is, once I pull back my records, can I re-order the array by my PHP slot numbers? 

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.