Jump to content

Angelojoseph17

Members
  • Posts

    44
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Angelojoseph17's Achievements

Member

Member (2/5)

0

Reputation

  1. I have the folllowing loop which only displays the last part of the array: $i = 0; // create a varible that will tell us how many items we looped over foreach ($listprint as $key => $value) { $i++; $content2 = " <tr> <th>Qty</th> <th>Description</th> <th>ProductNumber</th> <th>Issue</th> </tr> <tr > <td>" . $value['Quantity'] . "</td></a> <td>" . $value['Description'] . "</td></a> <td>" . $value['ProductNumber'] . "</td></a> <td>" . $value['Issue'] . "</td></a> </tr> </table> "; } The array Array ( [0] => Array ( [ReferenceNumber] => 4543/2323/ [CustomerNumber] => CHU15 [CustomerName] => AngeloJoseph [Description] => Tewksbury [ProductNumber] => 2323/3232 [Quantity] => 5 [issue] => Holes in lining ) [1] => Array ( [ReferenceNumber] => 4543/2323/ [CustomerNumber] => CHU15 [CustomerName] => AngeloJoseph [Description] => Ryder Sahara Boots [ProductNumber] => 34343/232 [Quantity] => 2 [issue] => Ripped Lining ) [2] => Array ( [ReferenceNumber] => 4543/2323/ [CustomerNumber] => CHU15 [CustomerName] => AngeloJoseph [Description] => Oxford Brogues [ProductNumber] => 23232/323 [Quantity] => 1 [issue] => Broken Last ) )
  2. public function ListProduct($Order) { $sql = "SELECT `Order`.`OrderNumber` , `Despatch`.`OrderNumber` , `Stock`.`ProductCode` , `Stock`.`Description` , `Stock`.`ProductGroup` , `Stock`.`Size` , `Stock`.`IPICODE` FROM `Stock` , `Despatch` ,`Order` WHERE `Order`.`OrderNumber` = '" . $Order. "' AND`Order`.`OrderNumber` = `Despatch`.`OrderNumber` AND`Despatch`.`Product`= `Stock`.`ProductCode` "; // echo $sql; mysql_select_db(DB_DATABASE_NAME, $this->conn); $result = mysql_query($sql, $this->conn); //$num_rows = mysql_num_rows($result); //echo "Number of rows : $num_rows"; while($row = mysql_fetch_array($result)) { if($row[0] != "") { $result = mysql_query($sql, $this->conn); $num_rows = mysql_num_rows($result); //echo "Number of rows : $num_rows"; } else { $sql = "SELECT `Order`.`OrderNumber` , `Despatch`.`OrderNumber` , `Stock`.`ProductCode` , `Stock`.`Description` , `Stock`.`ProductGroup` , `Stock`.`Size` , `Stock`.`IPICODE` FROM `Stock` , `Despatch` ,`Order` WHERE `Order`.`OrderNumber` = '" . $Order. "' AND`Order`.`ProductCode`= `Stock`.`ProductCode` "; mysql_select_db(DB_DATABASE_NAME, $this->conn); $result = mysql_query($sql, $this->conn); $num_rows = mysql_num_rows($result); //echo "Number of rows : $num_rows"; while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $return[] = $row; } return $return; return $num_rows; } } I have the query above which check if any rows are returned from the first sql statement and if the rows are empty, the aim is to run the second query and returns results. However i am going wrong somewhere. Can someone have a look. Perhaps i am over complicating this?
  3. I have a drop down box with two options depending on the option chosen it will open up another text box or a drop down box. Below is my function in ajax and also the php code. It partially works. But when i choose the value byreturn it shows both. Also on load it shows both which is annoying. I would appreciate it if anyone has a look. Thank you: Ajax function showfield(name){ if(name=='byreturn')document.getElementById('div1').style.display="block"; else document.getElementById('div1').style.display="none"; if(name=='forwardorder')document.getElementById('div2').style.display="block"; else document.getElementById('div2').style.display="none"; } Php on the page $content .=" <tr><td> Choose Delivery Type </td> <td> <select name = 'elementtype1'id='elementtype1' onchange='showfield(this.options[this.selectedIndex].value)'> <option value='forwardorder'>Forward Order</option> <option value='byreturn'>By Return</option> </select></td> <td> <div id='div1'>Enter By Return Date<input type='text''name='whatever1' /> </div> <div id='div2'> <td> Forward Order Delivery </td> <td><select 'name'='whatever2'/>"; $listCapacityDates = $cid->ListCapacity(); //echo $listCapacityDates; foreach($listCapacityDates as $x) { $content .= "<option value='".$x."'>".$x."</option> </div>"; }
×
×
  • 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.