Jump to content

akienghie09

Members
  • Content Count

    5
  • Joined

  • Last visited

Community Reputation

0 Neutral

About akienghie09

  • Rank
    Newbie
  • Birthday 02/13/1992

Previous Fields

  • Languages
    PHP, HTML, MySQL, ASP, JAVA, MULTIMEDIA, FLASH

Profile Information

  • Gender
    Male
  • Location
    Philippines, Manila
  • Interests
    Computer Games, Reading Articles about Technology
  1. akienghie09

    Looping

    It's like what you're trying to explain is that you wanted to have a select option where when you select it all the record in that date will display and it did not consider the name of the restaurant? Is that what you wanted to do? Is that right?
  2. You can't just sit there and wait for people to give you that golden dream: you've got to go out and make it happen for yourself.

  3. You can't just sit there and wait for people to give you that golden dream: you've got to go out and make it happen for yourself.

  4. You can't just sit there and wait for people to give you that golden dream: you've got to go out and make it happen for yourself.

  5. You can't just sit there and wait for people to give you that golden dream: you've got to go out and make it happen for yourself.

  6. Hi! I have a code where I populate the drop down list base on one of the columns in my database. It already display but the value of the chosen list did not affect my mysql query. Now I wanted to ask how I can put the value of the list to my mysql query.This is my code: <?php// db connection$db = "mds_reports";[/indent]if($connect = mysql_connect("172.16.8.32", "mds_reports", "password")) $connect = mysql_select_db($db); else die("Unable to connect".mysql_error());$date_from = $_POST['dfrom'];$date_to = $_POST['dto'];?><html><head><title>Cancelled Orders </title></head><body> <h1>Cancelled Orders</h1> <form name="cancelled_orders" method="POST" action="cancelled_orders_index.php"> Date From: <input type="text" name="dfrom" id="dfrom"> To: <input type="text" name="dto" id="dto"><br /><br /> <?php $i = $_POST['name']; $result_query = mysql_query ("SELECT name FROM restaurant_master") or die (mysql_error()); echo "<select name='name' value=''>Restaurant Name</option>"; $i=1; while($nt=mysql_fetch_assoc($result_query)) { echo "<option selected value='$i' > $nt[name] </option>"."<BR>"; $i++; } echo "</select>"; ?> <input name="submit" type="submit" value="Go"> </form> <table> <table border="2" cellpadding="2" cellspacing="1" style='width:100%;'> <tr> <th>Restaurant Code</th> <th>Restaurant Name</th> <th>Order No</th> <th>Order Source</th> <th>Payment Type</th> <th>Net Total</th> <th>Gross Total</th> <th>Reason</th> </tr> <?php if(isset($_POST['submit'])){ echo "Date select from $date_from to $date_to"."</p>"; echo "Restaurant: $i"."</p>"; $sql = "Select restaurant_master.code, restaurant_master.name, mds_orders.OrderNo, mds_orders.OrderSourceText AS 'Order Source', mds_orders.PaymentTypeText AS 'Payment Type', mds_orders.NetTotal, mds_orders.GrossTotal, ReasonMaster.ReasonDescription AS 'Reason' FROM mds_orders INNER JOIN ReasonMaster ON mds_orders.ReasonFKID = ReasonMaster.PKID INNER JOIN restaurant_master ON mds_orders.RestaurantID = restaurant_master.pkid WHERE mds_orders.OrderDate BETWEEN '".$date_from." 00:00:00' AND '".$date_to." 23:59:59' AND mds_orders.RestaurantID LIKE '$i' AND mds_orders.StatusFKID = 3 ORDER BY restaurant_master.code"; echo $sql; $result = mysql_query($sql) or die("Error: ".mysql_error()); $num_rows = mysql_num_rows($result); $i = 0; if (mysql_num_rows($result) >0) { while ($row = mysql_fetch_array($result,MYSQL_ASSOC)){ $csv .= $row['code'].",". $row['name'].",". $row['OrderNo'].",". $row['Order Source'].",". $row['Payment Type'].",". $row['NetTotal'].",". $row['GrossTotal'].",". $row['Reason'].","."<br>"; ?> <tr> <td><?php echo $row['code'];?></td> <td><?php echo $row['name'];?></td> <td><?php echo $row['OrderNo'];?></td> <td><?php echo $row['Order Source'];?></td> <td><?php echo $row['Payment Type'];?></td> <td><?php echo $row['NetTotal'];?></td> <td><?php echo $row['GrossTotal'];?></td> <td><?php echo $row['Reason'];?></td> </tr> <?php }}} ?> </table><br /> <form name="export" method="POST" action="cancelled_orders_export.php"> <input type="hidden" name="cancel_dfrom" id="data" value="<?=$date_from?>"> <input type="hidden" name="cancel_dto" id="data" value="<?=$date_to?>"> <input type="hidden" name="cancel_name" id="data" value="<?=$name;?>"> <input type="submit" name="extract" value="Extract"> </form></body></html> Thanks and best regards.
  7. You can't just sit there and wait for people to give you that golden dream: you've got to go out and make it happen for yourself.

  8. Ingolme & Err, thank you for your help. It already work. Thanks again. Best Regards!
  9. Hi!, This is my sample part of my program.. $row['name'].",". $row['region'].",". $row['city'].",". $row['area'].",". $row['street'].",". $row['building'].",". $row['totalorders'].",". $row['totalgross'].","."<br>"; that the output is like this...name, region, city, area, street, building, totalorders, totalgross the output that I need is like this.."name","city","area","street","building","totalorders","totalgross", can you help me how can I make this output..?thanks and have a great day ahead!
  10. I have a query where I will display how many transactions are made base on the amount of each transaction. But it has an error, the error is that the last amount which is 1,000 above is the same with the total transaction. Can someone check my query? This is my query: SELECT restaurant_master.code, restaurant_master.name, COUNT(CASE WHEN mds_orders.GrossTotal < '100' THEN 1 END) AS less100, COUNT(CASE WHEN mds_orders.GrossTotal >= '100' AND mds_orders.GrossTotal < '200' THEN 1 END) AS less200, COUNT(CASE WHEN mds_orders.GrossTotal >= '200' AND mds_orders.GrossTotal < '300' THEN 1 END) AS less300, COUNT(CASE WHEN mds_orders.GrossTotal >= '300' AND mds_orders.GrossTotal < '400' THEN 1 END) AS less400, COUNT(CASE WHEN mds_orders.GrossTotal >= '400' AND mds_orders.GrossTotal < '500' THEN 1 END) AS less500, COUNT(CASE WHEN mds_orders.GrossTotal >= '500' AND mds_orders.GrossTotal < '600' THEN 1 END) AS less600, COUNT(CASE WHEN mds_orders.GrossTotal >= '600' AND mds_orders.GrossTotal < '700' THEN 1 END) AS less700, COUNT(CASE WHEN mds_orders.GrossTotal >= '700' AND mds_orders.GrossTotal < '800' THEN 1 END) AS less800, COUNT(CASE WHEN mds_orders.GrossTotal >= '800' AND mds_orders.GrossTotal < '900' THEN 1 END) AS less900, COUNT(CASE WHEN mds_orders.GrossTotal >= '900' AND mds_orders.GrossTotal < '1000' THEN 1 END) AS less1k, COUNT(CASE WHEN mds_orders.GrossTotal > '1000' THEN 1 END) AS gtr1k, COUNT(mds_orders.GrossTotal) AS total FROM mds_orders JOIN restaurant_master ON mds_orders.RestaurantID = restaurant_master.PKID WHERE mds_orders.OrderDate BETWEEN '2011-11-01' AND '2011-11-30' GROUP BY restaurant_master.code, restaurant_master.name"; --Thanks. Best Regards.
×
×
  • Create New...