Jump to content

laural

Members
  • Posts

    12
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

laural's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. <?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?
  2. Thanks, but the query has to be run - this is a dynamic site and I have to check the session variables the user logs in with against what their service level allows them to see. But, I really only need to do this when they log in, and then I want the navigation to be static instead of regenerating the menu every time they click a link. I am trying to figure out how to run my queries on the homepage and from that have a static menu for the rest of their "travel" through my site.
  3. So, my menu is built like this, based on many different Sessions - can this whole include page be run once, and then used the entire time the user is logged in? From your response above, can I save the entire menu (below) to a session, even though it is made up of sessions? <a name="navigation"></a><!---------DIVISIONS_START----------> <div id="block_navigation"> <ul class="navigation"> <!------------ADD HOMEPAGE--------------> <?php echo '<li><a href="'.$_SESSION['pwfurl'].'/p_index.php?id_division=d00&id_module=m000">'.$_SESSION['home'].'</a></li>'; ?> <!------------LINK_START--------------> <?php $i = '00'; $num = '10'; for ($i = '00'; $i < $num; ++$i) { if (isset($_SESSION['id_d'.sprintf("%02d",$i).'_slot']) AND $_SESSION['id_d'.sprintf("%02d",$i).'_slot'] !== 'd'){ $id_division_menu = $_SESSION['id_d'.sprintf("%02d",$i).'_slot']; include $_SERVER['DOCUMENT_ROOT'].'/pwf/data/sp_services_content_navigation_division.inc'; if ($total > 0) { echo "<ul>"; include $_SERVER['DOCUMENT_ROOT'].'/pwf/data/sp_services_content_navigation_module.inc'; echo "</ul>"; } } echo "</li>";} ?> <!------------LINK_END--------------> <!------------CONTENT START--------------> <li class="right_item"> <a href="forms/contact.php?idDivision=00&id_module=m000&id_company="<?php echo $_SESSION['id_company']; ?>" onclick="window.open('forms/contact.php?id_company=<?php echo $_SESSION['id_company']; ?>', 'Feedback', 'toolbar=no, directories=no, location=no, status=yes, menubar=no, resizable=yes, scrollbars=yes, width=500, height=590'); return false"><?php echo $_SESSION['e140']; ?></a> </li> <!------------CONTENT_END----------------> </ul> </div> <!---------DIVISIONS_END---------->
  4. I am having speed issues with my site. I have determined that my navigation menu is the culprit. The navigation menu is comprised of a complicated query across a few tables, and then saved to sessions. The include file I created takes the sessions and loops through matching them to some user defined parameters. The problem is that I only need the file loaded once, by including it in the header, it re-does the query for every page causing the pages to load slowly. So, my question is, how can I include the navigation one time without having it reload every time the user clicks a link to a new page? I may be missing something really obvious Thanks!
  5. Just looking for some guidance. Thanks anyway.
  6. I hope this question has a simple answer. I have a table of names that pulls back records that are in a table. I want to add a link by the name that says "Remove" - when clicked, I would like the name deleted from the mssql table and the page left to reflect the list without that name. Is there an easy way to accomplish this? Even if I cannot remain on the same page, how would I do that using a link? Thanks!!!
  7. Here is part of my code, what I am wondering is, how do I streamline this (there are many more lines that I cropped for this example) - also, I was playing with using $i, but I keep getting errors when trying to insert it to my variables below... hopefully this is a pretty basic question... thanks // LOOP - SET SERVICE INFORMATION - START while( $row3 = sqlsrv_fetch_array( $stmt3, SQLSRV_FETCH_ASSOC) ) { // SET PARAMETERS - SET SERVICE INFORMATION $id_division_00='d'.trim($row3["id_division_00_translated_calc"]); $id_division_01='d'.trim($row3["id_division_01_translated_calc"]); $divisions_services_00_description=$row3["divisions_services_00_description"]; $divisions_services_01_description=$row3["divisions_services_01_description"]; $id_module_001='m'.trim($row3["id_module_001"]); $id_module_002='m'.trim($row3["id_module_002"]); $id_module_003='m'.trim($row3["id_module_003"]); $svc_module_001=trim($row3["svc_module_001"]); $svc_module_002=trim($row3["svc_module_002"]); $svc_module_003=trim($row3["svc_module_003"]); // SET SESSIONS - SET SERVICE INFORMATION $_SESSION['id_d00']=$id_division_00; $_SESSION['id_d01']=$id_division_01; $_SESSION['divisions_services_00_description']=$divisions_services_00_description; $_SESSION['divisions_services_01_description']=$divisions_services_01_description; $_SESSION['id_m001']=$id_module_001; $_SESSION['id_m002']=$id_module_002; $_SESSION['id_m003']=$id_module_003;
  8. Jessica, The function does return an array - I put it in print_r to "see" the array... anything I can do to format?
  9. I had a bad feeling that would be the answer Thanks, I appreciate the confirmation!
  10. I have a forum that is included on my site via SSI. There is a function provided that allows me to pull in the Member name (based on a member id) - and I can print the array of profile information. I need to format and display this information and I don't know how to do that... can anyone point me in the right direction? BTW, I cannot add anything to the function... Thank you! Array ( [13] => Array ( [username] => laural [name] => laural [id] => 13 [is_buddy] => [is_reverse_buddy] => [buddies] => Array ( ) [title] => [href] => http://www.powerflexweb.com/pwf/forum/index.php?action=profile;u=13 [link] => laural [email] => laura-long@nc.rr.com [show_email] => no [registered] => January 16, 2013, 02:14:18 pm [registered_timestamp] => 1358363658 [blurb] => [gender] => Array ( [name] => [image] => ) [website] => Array ( [title] => [url] => ) [birth_date] => 0000-00-00 [signature] => [location] => [icq] => Array ( [name] => [add] => [href] => [link] => [link_text] => ) [aim] => Array ( [name] => [href] => [link] => [link_text] => ) [yim] => Array ( [name] => [href] => [link] => [link_text] => ) [msn] => Array ( [name] => [href] => [link] => [link_text] => ) [real_posts] => 0 [posts] => 0 [avatar] => Array ( [name] => [image] => [href] => [url] => ) [last_login] => January 16, 2013, 02:39:08 pm [last_login_timestamp] => 1358365148 [karma] => Array ( [good] => 0 [bad] => 0 [allow] => ) [ip] => 173.95.174.124 [ip2] => 173.95.174.124 [online] => Array ( [is_online] => [text] => Offline [href] => http://www.powerflexweb.com/pwf/forum/index.php?action=pm;sa=send;u=13 [link] => Offline [image_href] => http://www.powerflexweb.com/pwf/forum/Themes/pwf/images/useroff.gif [label] => Offline ) [language] => [is_activated] => 1 [is_banned] => [options] => Array ( [display_quick_reply] => 1 ) [is_guest] => [group] => [group_color] => [group_id] => 0 [post_group] => Newbie [post_group_color] => [group_stars] => * [warning] => 0 [warning_status] => [local_time] => January 18, 2013, 07:11:39 am [has_messenger] => ) )
  11. I have a stored procedure on MSSQL that returns a list of results. This works fine. The results that are returned may or may not be allowed to be seen by the end user. So, if 10 results are returned, maybe 7 of them are allowed to be viewed by the end user. There is a PHP SESSION variable that contains a bunch of codes that is compared to a variable returned from the search result. When these match, the result can be seen by the user. So, I am using a php if statement that echos the result based on the result of the if statement. That works fine. What does not work is the found count for the array. For example, if 10 are found, it returns 10, but the if statement removes 3 making 7 of the results viewable. So, is there a way to iterate through an array result set in PHP and remove results based on an if statement creating a new array? Hope this is not too confusing!
×
×
  • 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.