Bypassing an Array

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Chrisjc
    Contributor
    • Nov 2006
    • 375

    #1

    Bypassing an Array

    The question at hand is I bypass an array in column 4... but I also have something else that should be going in there from the database but because I am bypassing it and forcing it to show the ony think I want to show it will not show what is being generated from the database... and if I take the bypass out it works with no issues....

    any ideas?

    [PHP]
    // -------------------------------------------------------------------------------
    // Determine the highest number of $outArray entries for each colno, so we know
    // how many table rows we have to generate
    // -------------------------------------------------------------------------------
    // 1. store the number of entries for each colno
    $ent = array(count($ou tArray[$colArray[0]]),count($outArr ay[$colArray[1]]),count($outArr ay[$colArray[2]]),count($outArr ay[$colArray[3]]));
    // 2. sort the entry counts in ascending order
    sort($ent);
    // 3. last entry must be highest, i.e. the number of table rows to build
    $nr = $ent[3];
    // --------------------------------------------------------------------------
    // Start the output table and generate the header columns
    // --------------------------------------------------------------------------
    echo "<table border='0' style='border-collapse:collap se;'>";
    echo "<tr>".
    "</tr>";
    // --------------------------------------------------------------------------
    // loop through the $outArray array and construct the output HTML table
    // --------------------------------------------------------------------------
    for ($j=0; $j<$nr; $j++) {
    // start a new row
    echo '<tr>';
    // there are four colno's, so we fill them from 0 to 3
    for ($i=0; $i<4; $i++) {
    // get the colno name (= key)
    $col = $colArray[$i];
    // here we have a new $outArray entry
    // determine which vertical cell borders this one, depending on the colno ($i)
    /* switch ($i) {
    // left cell (column 1): right vertical borderline generation
    case 0 : echo '<td style="padding: 0;margin:0;widt h:15px;backgrou nd: url(images/template_15.gif ) repeat-y;"></td>';
    $cls='tdleft';
    break;
    // middle cells (columns 2,3): left and right vertical borderlines generation
    case 1 :
    case 2 : $cls='tdmid';
    break;
    // right cell (column 4): left vertical borderline generation
    default: $cls='tdright';
    break;
    } */
    // ---------------------------------------------------------------
    // if this $outArray entry contains data: construct the <td> cell
    // ---------------------------------------------------------------
    if (is_array($outA rray[$col][$j])) {
    // first save all $outArray entries in simple variables
    $ais = $outArray[$col][$j]['aistpic']; // image name
    $exp = $outArray[$col][$j]['exppartno']; // part number
    $des = $outArray[$col][$j]['desc']; // explanation
    $msr = $outArray[$col][$j]['msrp']; // price
    $bun = $outArray[$col][$j]['buynow']; // this is the url or text

    // *************** *************** *************** *************** **************
    // START OF ACCESSORIES BYPASS
    // fill the $outArray array with the accessories image and links
    // *************** *************** *************** *************** **************
    $outArray[4][0]['aistpic'] = 'images/aist/chemicals.jpg'; // image name
    $outArray[4][0]['exppartno'] = ''; // part number
    $outArray[4][0]['desc'] = '<a href="#" target="_blank" >Chemicals</a>'; // this is the url
    $outArray[4][0]['msrp'] = ''; // price
    $outArray[4][0]['buynow'] = '';
    [/PHP]
  • karlectomy
    New Member
    • Sep 2007
    • 64

    #2
    Hey,

    Ok, I'm trying to break this down a bit.

    You have product data in your db. Is it in one table?

    Are you storing you mysql_fetch_arr ay() in $outarray? is the value in
    $colarray[0] = 'aistpic' ?

    I'm a little confused as to what you need to do with your bypass.

    Comment

    • Chrisjc
      Contributor
      • Nov 2006
      • 375

      #3
      Originally posted by karlectomy
      Hey,

      Ok, I'm trying to break this down a bit.

      You have product data in your db. Is it in one table?

      Are you storing you mysql_fetch_arr ay() in $outarray? is the value in
      $colarray[0] = 'aistpic' ?

      I'm a little confused as to what you need to do with your bypass.

      okay see let me try to break this down alittle better.

      The bypassing arrary is working just fine... HOWEVER its working to good lol the issue is I am using arrays so everything called on gets pulled from the database then displayed via the arrary well I have 4 columns that display differnt things... I have a product that is possiable for ALL APLICATIONS there for I made the bypassing arrary so it will display a product in the 4th column no matter what is selected in the search.

      The issue is ever sense I have done the bypass it will not show any products that are searched out in the 4th column only the bypassed one.

      I know this link might be incorrect for the page but it is not for advertisment!

      go to http://triplesource.net/cchilders/ph...Sytemstest.php This is the application.

      Search out anything... notice only all 4 columns will have something... the 4th column that is displaying the Chemicals is what is being bypassed... however if you search out

      DIESEL > GMC > Serria 2500 > 2007

      There should be Chemicals AND Another part being displayed in the 4th column but because the bypass is there.. it will not display what is being pulled from the database... Does this make sense?

      Comment

      • Chrisjc
        Contributor
        • Nov 2006
        • 375

        #4
        No one?


        +++++++++++++++ MESSAGE GODS+++++++++++ +++++

        Comment

        • Chrisjc
          Contributor
          • Nov 2006
          • 375

          #5
          Does anyone know anything on arrays????

          Anything at all or am I not maken sense???

          Comment

          Working...