Jump to content

diginamics

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Everything posted by diginamics

  1. Yes Just got solution from another user from another website and updated but could not mark the post as solved over here.
  2. If anyone wants to view, you can view a this working at qasqoos.nsegulf.com/daily_sales_temp.php It will be showing this month. Because there are invoices only for one day, it shows the month days only once. Just go back to previous month and you will understand what I mean
  3. Please check the img link and you will understand for ($index = 1; $index <= $numdays; $index++) { $users="SELECT invoice_date, DAY(invoice_date) as invoiceday, sum(total_amount) as fullamount from invoices WHERE MONTH(invoice_date)='".$month."' AND YEAR(invoice_date)='".$year."' GROUP BY invoiceday"; $res=mysql_query($users); $row=mysql_num_rows($res); while($fetch=mysql_fetch_array($res)){ echo "<tr id='". ( ( $j %2 == 0 ) ? 'row3' : 'row4' ) . "'>"; $explodedate=explode("-",$fetch['invoice_date']); $days=$explodedate[2]; $month1=$explodedate[1]; $year1=$explodedate[0]; $dates=date("jS", strtotime($fetch['invoice_date'])); echo "<td style='text-align:left;padding-left:12px'>".$index."</td>"; if($index==$dates){ echo "<td style='text-align:right;padding-right:12px'>".$fetch['fullamount']."</td>"; }else{ echo "<td style='text-align:right;padding-right:12px'>--</td>"; } echo "</tr>"; } } $total="SELECT SUM(total_amount) as fulltotal from invoices where MONTH(invoice_date)='".$month1."' AND YEAR(invoice_date)='".$year1."';"; $totres=mysql_query($total); $totfetch=mysql_fetch_assoc($totres); if($totfetch['fulltotal']==""){ echo "<tr><td>NOTHING FOUND</td></tr>"; }else{ ECHO "<TR>"; echo "<td style='color:#BD0000;padding-left:12px;border:1px solid #ccc;width:20%;height:40px;text-align:left'>TOTAL AMOUNT FOR ".$displaydate."</td>"; echo "<td style='color:#BD0000;border:1px solid #ccc;width:20%;height:40px;text-align:right;padding-right:12px'>".$totfetch['fulltotal']."</TD></TR>"; } echo "</table>";
  4. Have a look at this image Here is the part of the form code that makes them into arrays $sql="select * from products"; $res=mysql_query($sql); WHILE($fetch=mysql_fetch_assoc($res)){ echo "<td><input type=hidden name='desBox[]' id='desBox[]' value='".$fetch['prod_id']."'>".$fetch['prod_name']."</td> <td><input type=text id=quantBox[] maxlength=6 name=quantBox[]></td> <td><input type=text maxlength=6 id=teethBox[] name=teethBox[]></td>"; echo "</tr>";}
  5. I just posted an image and it is showing that there is one entry instead of three. Have a look at the image and see the red highlighted area
  6. Have a look at this image and you will understand what I am trying to get out of this form. it is only inserting one value in the 2nd table (orderprod) where it should insert all the enteries that are filled.
  7. The first query inserts values in table job_oder The second query is supposed to insert array data into table 'orderprod' sql="insert into job_order(order_num,order_date,order_customer_id, order_remarks) values(".$_GET['id'].",NOW(),".$_POST['companyBox'].",'".$_POST['remarkBox']."');"; $res=mysql_query($sql); AND THE SECOND ONE $order="INSERT INTO orderprod (order_num,prod_id,order_amount,teeth_amount) VALUES ('$_GET[id]','$value','$value','$value');"; $orderres=mysql_query($order) or die(mysql_error()); and you are right this ($key.' => '.trim(strip_tags($value)); ) does not do anything. I had removed it ealier
  8. I have already tried it, it shows incorrect int value for prod_id and if I echo value it does not show all the entries as shown in the image url attached. Also, the second table is all int. I just need a fix to while loop arrays. As I said earlier values are inserted in table 1 (joborder) correctly, I am having problem inserting array values in the 2nd table (orderprod)
  9. First page adds a new job number, then the order page loaded with the job number id as a get id. Basically there is a while loop in the order page which shows products/services client can order and he chooses what he requires 'one or eight services' (8 in total) and some other variables like date of order and client name etc. Here is the order item code The first sql statement executes fine, but in the second sql query nothing happens $sql="insert into job_order(order_num,order_date,order_customer_id, order_remarks) values(".$_GET['id'].",NOW(),".$_POST['companyBox'].",'".$_POST['remarkBox']."');"; $res=mysql_query($sql); $id=mysql_insert_id(); foreach($_POST as $key => $value) { if(!empty($value)) { $key.' => '.trim(strip_tags($value)); $order="INSERT INTO orderprod (order_num,prod_id,order_amount,teeth_amount) VALUES ('$_GET[id]','$value','$value','$value');"; $orderres=mysql_query($order) or die(mysql_error()); } }?>$sql="insert into job_order(order_num,order_date,order_customer_id, order_remarks) values(".$_GET['id'].",NOW(),".$_POST['companyBox'].",'".$_POST['remarkBox']."');"; $res=mysql_query($sql); $id=mysql_insert_id(); foreach($_POST as $key => $value) { if(!empty($value)) { $key.' => '.trim(strip_tags($value)); $order="INSERT INTO orderprod (order_num,prod_id,order_amount,teeth_amount) VALUES ('$_GET[id]','$value','$value','$value');"; $orderres=mysql_query($order) or die(mysql_error()); } } ?> ============= This is the formI have removed parts which are irrelevant. Please note that dateBox and companyBox are not required to be looping as they are only for first table, echo "<form action=".$config_basedir."./vieworder.php?id=".$_GET['id']." name=form1 method=post>";?><table><tr><td><h4>JOB ORDER</H4></TD><TD></TD></TR><TR><TD>ORDER NUMBER</TD><TD><?PHP ECHO $_GET['id'] ?></td></tr><tr><td>ORDER DATE</td><td><input type=text name=dateBox></td></tr> <tr><td>COMPANY NAME</td><td><?PHP$sql="select * from customers";$res=mysql_query($sql);echo "<select name=companyBox><option value=''>Please select</option>";WHILE($fetch=mysql_fetch_assoc($res)){ echo "<option value='".$fetch['id']."'>".$fetch['cust_name']."</option>";} echo "</select>"; echo "</td></tr>"; ?> </table> <table><tr><th>ITEM</th><th>QUANTITY</th><th>N0. of Teeths</th></tr><tr><?PHP$sql="select * from products";$res=mysql_query($sql); WHILE($fetch=mysql_fetch_assoc($res)){ echo "<td><input type=text name=desBox value='".$fetch['prod_id']."'>".$fetch['prod_name']."</td><td><input type=text name=quantBox></td><td><input type=text name=teethBox></td>";echo "</tr>";}echo "</table>";?>echo "<form action=".$config_basedir."./vieworder.php?id=".$_GET['id']." name=form1 method=post>"; ?> <table> <tr> <td><h4>JOB ORDER</H4></TD><TD></TD> </TR> <TR> <TD>ORDER NUMBER</TD><TD><?PHP ECHO $_GET['id'] ?></td> </tr> <tr> <td>ORDER DATE</td><td><input type=text name=dateBox></td> </tr> <tr> <td>COMPANY NAME</td><td> <?PHP $sql="select * from customers"; $res=mysql_query($sql); echo "<select name=companyBox><option value=''>Please select</option>"; WHILE($fetch=mysql_fetch_assoc($res)){ echo "<option value='".$fetch['id']."'>".$fetch['cust_name']."</option>";} echo "</select>"; echo "</td></tr>"; ?> </table> <table> <tr> <th>ITEM</th><th>QUANTITY</th><th>N0. of Teeths</th> </tr> <tr> <?PHP $sql="select * from products"; $res=mysql_query($sql); WHILE($fetch=mysql_fetch_assoc($res)){ echo "<td><input type=text name=desBox value='".$fetch['prod_id']."'>".$fetch['prod_name']."</td> <td><input type=text name=quantBox></td> <td><input type=text name=teethBox></td>"; echo "</tr>";} echo "</table>"; ?> HERE IS THE IMAGE showing the populated services. http://dubads.com/images/order.jpg
×
×
  • 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.