Jump to content

jaxdevil

Members
  • Posts

    268
  • Joined

  • Last visited

Everything posted by jaxdevil

  1. I just tried removing the loop at the bottom, for the number of $results runs to perform, so it would always do one regardless, and it didn't update. So it is stopping somewhere in the $query area. Here is what I used and it doesn't post to the database: <?php echo '<pre>' . print_r($_POST,true) . '</pre>'; require($_SERVER['DOCUMENT_ROOT'].'/includes/configs/sql_connect.php'); $received_date = date("m|d|Y"); $dateandtime = date("YmdHis" ,time()); ?> <?php for ($i = 1; $i < 21; $i++) { // loop for the number of $item_number if ($_POST['item_number_' . $i] != '') { $q = "SELECT * FROM products_description WHERE model_number='" . mysql_real_escape_string($_POST['item_number_checkbox_' . $i]) . "'"; $result = mysql_query($q) or die("Problem with the query: $q<br>" . mysql_error()); $row = mysql_fetch_assoc($result); $descriptions = $row['description']; $query="INSERT INTO inventory (manufacturer,model_no,name,description,condition,po_number,received_date,edit_record,location,scan_code) VALUES ('" . mysql_real_escape_string($_POST['manufacturer_' . $i]) . "','" . mysql_real_escape-string($_POST['item_number_' . $i]) . "','" . mysql_real_escape_string($_POST['description_' . $i]) . "','$descriptions','New','$new_po_number','$received_date','$name','Undefined','Undefined')" or die("Problem with the query: $q<br>" . mysql_error()); $result=mysql_query($query) or die ("Problem with the query $query<br>: " . mysql_error()); } } ?> Any ideas?
  2. Array ( [new_po_number] => 10000001-100050001 [vendor_name] => DISPENSE-RITE [vendor_address] => 2205 CARLSON DRIVE [vendor_csz] => NORTHBROOK, IL, 60062 [vendor_phone] => 847-753-9595 [vendor_fax] => 1-847-753-9648 [ship_to_name] => Global Restaurant Equipment and Supplies, Inc. [ship_to_address] => 650 NW 123rd ST [ship_to_csz] => MIAMI, FL, 33168 [ship_to_phone] => 305-688-8700 [ship_to_contact] => CASEY RAJA [date_of_order] => 09|11|2008 [date_wanted] => 09|11|2008 [ise_number] => 5437112 [account_number] => 223344 [ship_via] => UPS [item_number_checkbox_1] => JT20-A8450 [box_1] => 3 [item_number_1] => JT20-A8450 [description_1] => (A8450) Jet Spray Cold Beverage Dispenser JT20 [quantity_1] => 3 [price_1] => 951.99 [line_total_1] => 2855.97 [manufacturer_1] => Cornelius [item_number_checkbox_2] => 17BC-SC [box_2] => 7 [item_number_2] => 17BC-SC [description_2] => ELECTRIC PASTA SYSTEMS [quantity_2] => 7 [price_2] => 1242.23 [line_total_2] => 8695.61 [manufacturer_2] => Frymaster [item_number_checkbox_3] => 174CBA [box_3] => 1 [item_number_3] => 174CBA [description_3] => BROIL-O-DOGS [quantity_3] => 1 [price_3] => 845.37 [line_total_3] => 845.37 [manufacturer_3] => Star Mfg ) Those are the results. Any ideas? Thanks again, I appreciate it!
  3. Yes, that was it. It is not breaking anymore but it isn't posting anything. I checked using an echo in different spots, it is getting to row 1 but ends there, it only ouputs two number 1's using the below code. It never gets to the post 'box_' I am pretty sure the problem is in this area: for ($j = 1; $j <= $_POST['box_' . $i]; $j++) { But I can't figure out. Wouldn't that be looking for a number with no text (i.e. no box_1, box_2 but just 1 or 2)? for whatever reason it stops the code right there. Any ideas? Below is what I used to test where it was stoping at: <? require($_SERVER['DOCUMENT_ROOT'].'/includes/configs/sql_connect.php'); $received_date = date("m|d|Y"); $dateandtime = date("YmdHis" ,time()); ?> <?php for ($i = 1; $i < 21; $i++) { // loop for the number of $item_number if ($_POST['item_number_' . $i] != '') { $q = "SELECT * FROM products_description WHERE model_number='" . mysql_real_escape_string($_POST['item_number_checkbox_' . $i]) . "'"; $result = mysql_query($q) or die("Problem with the query: $q<br>" . mysql_error()); $row = mysql_fetch_assoc($result); $descriptions = $row['description']; echo "1"; echo "<br>"; echo $i; $query="INSERT INTO inventory (manufacturer,model_no,name,description,condition,po_number,received_date,edit_record,location,scan_code) VALUES ('" . mysql_real_escape_string($_POST['manufacturer_' . $i]) . "','" . mysql_real_escape-string($_POST['item_number_' . $i]) . "','" . mysql_real_escape_string($_POST['description_' . $i]) . "','$descriptions','New','$new_po_number','$received_date','$name','Undefined','Undefined')"; for ($j = 1; $j <= $_POST['box_' . $i]; $j++) { echo "1"; echo "<br>"; echo $j; $result=mysql_query($query) or die ("Problem with the query $query<br>: " . mysql_error()); } } } ?>
  4. Thanks Ken, that looks just like what I need, except it is giving me an error ( syntax error unexpected ',' ) when I check it with phpdesigner, it wouldn't run on the site, so I checked it to see whats wrong, its on line 13 somewhere. Its in one of the mysql_real_escape_strings i.e.: '" . mysql_real_escape_string($_POST['manufacturer_' . $i] . "' I think it is something to do with where the ' . $i] ."' part is at, but I cannnot tell. Can you figure it out? Thanks!
  5. There has to be a way to do this. Lets do something simple: I want to print the word cat on the screen x number of times, I am going to let a variable posted to the page determine how many times it is posted. So the page would be printcat.php?x=7 which would mean to print it 7 times. What would be the code for duplicating a line via a variable number of times based on a posted variable?
  6. Isn't there a way I can, under each if box_1 == , box_1 == 2 , box_1 ==3, etc. I can insert some code that makes rows of data, counting them, until it reaches a number, like 50 ( run until x > 50 ), so it writes out that some code over and over until it reaches that number? Say for example you wanted your php code to write the numbers for pagination, but only wanted to go as high as 10 , you would have some type of coding that would start the count, display the numbers, and stop when it reached 10, instead of numbers couldn't this be anything? Coding, html, images, etc? If so, how would you do that, I can use that and can shrink down the size of the script severely.
  7. <table width="800" cellpadding="0" cellspacing="0" border="0"> <tr> <td width="360" align="center" valign="top"> <font style="font-size: 1em;" face="Tahoma"><b> GLOBAL RESTAURANT<br> EQUIPMENT AND SUPPLIES, INC.<br> </font> <font style="font-size: 0.8em;" face="Tahoma"> LEASING &#149; SALES &#149; EXPORT &#149; REPAIRS</b><br> 650 N.W. 123rd Street &#149; Miami, Florida 33168<br> Office: (305) 688-8700 &#149; Fax: (305) 688-9455 </font> </td> <td width="80"> <td> <td width="360"> <table width="360"> <tr> <td width="120"> </td> <td width="230"> <font style="font-size: 1.3em;" face="Tahoma"><b> <center>PURCHASE ORDER </b> </font> <br> </center> <form name="clientForm" action="http://<?=$_SERVER['HTTP_HOST']?>/pages/po_update_submit.php" method="post"> <div style="padding-left:3px;padding-top:4px; padding-bottom:4px; "> <input type="text" name="new_po_number" class="po_number" value="<?=$po_number?>" READONLY onFocus="this.blur()" size="25"> </div> <font style="font-size: 0.7em;" face="Tahoma"> THIS NUMBER MUST APPEAR ON INVOICES, B/L, BUNDLES, CASES,PACKING LIST, AND CORRESPONDENCE. </td> </tr> </table> </td> </tr> </table> <br> <table width="800" cellpadding="0" cellspacing="0" border="0"> <tr> <td width="360"> <table width="360" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px;"> <tr> <td width="360"> <font style="font-size: 0.9em;" face="Tahoma"> <center><b>VENDOR</b></center> </font> </td> </tr> </table> <? $sql_vendor = "SELECT * FROM `vendor_database` WHERE `vendor_code`='$vendor_code' LIMIT 1"; $query_vendor = mysql_query($sql_vendor); while($vendor_row = mysql_fetch_array($query_vendor)){ $vendor_code = $vendor_row['vendor_code']; $vendor_name = $vendor_row['vendor_name']; $vendor_saddress = $vendor_row['vendor_saddress']; $vendor_saddress2 = $vendor_row['vendor_saddress2']; $vendor_city = $vendor_row['vendor_city']; $vendor_state = $vendor_row['vendor_state']; $vendor_zip = $vendor_row['vendor_zip']; $vendor_country = $vendor_row['vendor_country']; $vendor_phone = $vendor_row['vendor_phone']; $vendor_fax = $vendor_row['vendor_fax']; $vendor_contact = $vendor_row['vendor_contact']; $ise_vendor = $vendor_row['ise_vendor']; $edit_record = $vendor_row['edit_record']; $shipto_links = $vendor_row['shipto_links']; $vendor_csz =$vendor_city.", ".$vendor_state.", ".$vendor_zip; } ?> <table width="360" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:0px; border-top-width: 0px; border-bottom-width: 1px; border-left-width: 0px;"> <tr> <td width="360" align="left"> <font style="font-size: 0.7em;" face="Tahoma"> NAME:</font> <input type="text" name="vendor_name" id="vendor_name" class="text_input" value="<?=$vendor_name?>" READONLY onFocus="this.blur()" size="60"> </td> </tr> </table> <table width="360" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:0px; border-top-width: 0px; border-bottom-width: 1px; border-left-width: 0px;"> <tr> <td width="360" align="left"> <font style="font-size: 0.7em;" face="Tahoma"> ADDRESS:</font> <input type="text" name="vendor_address" id="vendor_address" class="text_input" value="<?=$vendor_saddress?>" READONLY onFocus="this.blur()" size="57"> </td> </tr> </table> <table width="360" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:0px; border-top-width: 0px; border-bottom-width: 1px; border-left-width: 0px;"> <tr> <td width="360" align="left"> <font style="font-size: 0.7em;" face="Tahoma"> CITY,STATE,ZIP:</font> <input type="text" name="vendor_csz" id="vendor_csz" class="text_input" value="<?=$vendor_csz?>" READONLY onFocus="this.blur()" size="50"> </td> </tr> </table> <table width="360" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:0px; border-top-width: 0px; border-bottom-width: 1px; border-left-width: 0px;"> <tr> <td width="360" align="left"> <font style="font-size: 0.7em;" face="Tahoma"> PHONE:</font> <input type="text" name="vendor_phone" id="vendor_phone" class="text_input" value="<?=$vendor_phone?>" READONLY onFocus="this.blur()" size="59"> </font> </td> </tr> </table> <table width="360" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:0px; border-top-width: 0px; border-bottom-width: 1px; border-left-width: 0px;"> <tr> <td width="360" align="left"> <font style="font-size: 0.7em;" face="Tahoma"> FAX:</font> <input type="text" name="vendor_fax" id="vendor_fax" class="text_input" value="<?=$vendor_fax?>" READONLY onFocus="this.blur()" size="61"> </td> </tr> </table> </td> <td width="80"> </td> <td width="360"> <table width="360" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px;"> <tr> <td width="360"> <font style="font-size: 0.9em;" face="Tahoma"> <center><b>SHIP TO:</b></center> </font> </td> </tr> </table> <? $sql_shipto = "SELECT * FROM `shipto_database` WHERE `shipto_code`='$shipto_code' LIMIT 1"; $query_shipto = mysql_query($sql_shipto); while($shipto_row = mysql_fetch_array($query_shipto)){ $shipto_code = $shipto_row['shipto_code']; $shipto_name = $shipto_row['shipto_name']; $shipto_saddress = $shipto_row['shipto_saddress']; $shipto_saddress2 = $shipto_row['shipto_saddress2']; $shipto_city = $shipto_row['shipto_city']; $shipto_state = $shipto_row['shipto_state']; $shipto_zip = $shipto_row['shipto_zip']; $shipto_country = $shipto_row['shipto_country']; $shipto_phone = $shipto_row['shipto_phone']; $shipto_fax = $shipto_row['shipto_fax']; $shipto_contact = $shipto_row['shipto_contact']; $shipto_bol = $shipto_row['shipto_bol']; $edit_record = $shipto_row['edit_record']; $shipto_csz = $shipto_city.", ".$shipto_state.", ".$shipto_zip; } ?> <table width="360" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:0px; border-top-width: 0px; border-bottom-width: 1px; border-left-width: 0px;"> <tr> <td width="360" align="left"> <font style="font-size: 0.7em;" face="Tahoma"> NAME:</font> <input type="text" name="ship_to_name" id="ship_to_name" class="text_input" value="<?=$shipto_name?>" READONLY onFocus="this.blur()" size="59"> </td> </tr> </table> <table width="360" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:0px; border-top-width: 0px; border-bottom-width: 1px; border-left-width: 0px;"> <tr> <td width="360" align="left"> <font style="font-size: 0.7em;" face="Tahoma"> ADDRESS:</font> <input type="text" name="ship_to_address" id="ship_to_address" class="text_input" value="<?=$shipto_saddress?>" READONLY onFocus="this.blur()" size="57"> </td> </tr> </table> <table width="360" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:0px; border-top-width: 0px; border-bottom-width: 1px; border-left-width: 0px;"> <tr> <td width="360" align="left"> <font style="font-size: 0.7em;" face="Tahoma"> CITY,STATE,ZIP:</font> <input type="text" name="ship_to_csz" id="ship_to_csz" class="text_input" value="<?=$shipto_csz?>" READONLY onFocus="this.blur()" size="49"> </td> </tr> </table> <table width="360" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:0px; border-top-width: 0px; border-bottom-width: 1px; border-left-width: 0px;"> <tr> <td width="360" align="left"> <font style="font-size: 0.7em;" face="Tahoma"> PHONE:</font> <input type="text" name="ship_to_phone" id="ship_to_phone" class="text_input" value="<?=$shipto_phone?>" READONLY onFocus="this.blur()" size="58"> </td> </tr> </table> <table width="360" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:0px; border-top-width: 0px; border-bottom-width: 1px; border-left-width: 0px;"> <tr> <td width="360" align="left"> <font style="font-size: 0.7em;" face="Tahoma"> CONTACT:</font> <input type="text" name="ship_to_contact" id="ship_to_contact" class="text_input" value="<?=$shipto_contact?>" READONLY onFocus="this.blur()" size="56"> </td> </tr> </table> </td> </tr> </table> <br> <table width="800" cellpadding="0" cellspacing="0" border="0"> <tr> <td width="150"> <table width="150" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:1px; border-top-width: 1px; border-bottom-width: 1px; border-left-width: 1px;"> <tr> <td width="150" height="10" align="left"> <font style="font-size: 0.7em;" face="Tahoma"> DATE OF ORDER </font> </td> </tr> <tr> <td width="150" height="20"> <div style="padding-left:3px;"> <input type="text" name="date_of_order" class="text_input" value="<?=$order_date?>" READONLY onFocus="this.blur()" size="25"> </div> </td> </tr> </table> </td> <td width="150"> <table width="150" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:1px; border-top-width: 1px; border-bottom-width: 1px; border-left-width: 0px;"> <tr> <td width="150" height="10" align="left"> <font style="font-size: 0.7em;" face="Tahoma"> DATE WANTED </font> </td> </tr> <tr> <td width="150" height="20"> <div style="padding-left:3px;"> <input type="text" name="date_wanted" class="text_input" value="<?=$date_wanted?>" READONLY onFocus="this.blur()" size="25"> </div> </td> </tr> </table> </td> <td width="100"> <table width="100" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:1px; border-top-width: 1px; border-bottom-width: 1px; border-left-width: 0px;"> <tr> <td width="100" height="10" align="left"> <font style="font-size: 0.7em;" face="Tahoma"> ISE NUMBER </font> </td> </tr> <tr> <td width="100" height="20"> <div style="padding-left:3px;"> <input type="text" name="ise_number" class="text_input" value="<?=$ise_number?>" READONLY onFocus="this.blur()" size="15"> </div> </td> </tr> </table> </td> <td width="200"> <table width="200" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:1px; border-top-width: 1px; border-bottom-width: 1px; border-left-width: 0px;"> <tr> <td width="200" height="10" align="left"> <font style="font-size: 0.7em;" face="Tahoma"> ACCOUNT NUMBER </font> </td> </tr> <tr> <td width="200" height="20"> <div style="padding-left:3px;"> <input type="text" name="account_number" class="text_input" value="<?=$account_number?>" READONLY onFocus="this.blur()" size="35"> </div> </td> </tr> </table> </td> <td width="200"> <table width="200" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:1px; border-top-width: 1px; border-bottom-width: 1px; border-left-width: 0px;"> <tr> <td width="200" height="10" align="left"> <font style="font-size: 0.7em;" face="Tahoma"> SHIP VIA </font> </td> </tr> <tr> <td width="200" height="20"> <div style="padding-left:3px;"> <input type="text" name="ship_via" class="text_input" value="<?=$ship_via?>" READONLY onFocus="this.blur()" size="35"> </div> </td> </tr> </table> </td> </tr> </table> <table width="670" cellpadding="0" cellspacing="0" border="0"> <tr> <td width="69"> <table width="69" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:1px; border-top-width: 0px; border-bottom-width: 1px; border-left-width: 1px;" <tr> <td width="69" height="10" align="left"> <font style="font-size: 0.7em;" face="Tahoma"> <center>RECEIVED</center> </font> </td> </tr> </table> </td> <td width="64"> <table width="64" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:1px; border-top-width: 0px; border-bottom-width: 1px; border-left-width: 1px;" <tr> <td width="64" height="10" align="left"> <font style="font-size: 0.7em;" face="Tahoma"> <center>AMOUNT</center> </font> </td> </tr> </table> </td> <td width="89"> <table width="89" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:1px; border-top-width: 0px; border-bottom-width: 1px; border-left-width: 1px;" <tr> <td width="89" height="10" align="left"> <font style="font-size: 0.7em;" face="Tahoma"> <center>ITEM NUMBER</center> </font> </td> </tr> </table> </td> <td width="349"> <table width="349" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:1px; border-top-width: 0px; border-bottom-width: 1px; border-left-width: 0px;"> <tr> <td width="349" height="10" align="left"> <font style="font-size: 0.7em;" face="Tahoma"> <center>DESCRIPTION</center> </font> </td> </tr> </table> </td> <td width="78"> <table width="78" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:1px; border-top-width: 0px; border-bottom-width: 1px; border-left-width: 0px;"> <tr> <td width="78" height="10" align="left"> <font style="font-size: 0.7em;" face="Tahoma"> <center>QUANTITY</center> </font> </td> </tr> </table> </td> <td width="71"> <table width="71" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:1px; border-top-width: 0px; border-bottom-width: 1px; border-left-width: 0px;"> <tr> <td width="71" height="10" align="left"> <font style="font-size: 0.7em;" face="Tahoma"> <center>PRICE</center> </font> </td> </tr> </table> </td> <td width="80"> <table width="80" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:1px; border-top-width: 0px; border-bottom-width: 1px; border-left-width: 0px;"> <tr> <td width="80" height="10" align="left"> <font style="font-size: 0.7em;" face="Tahoma"> <center>TOTAL AMOUNT</center> </font> </td> </tr> </table> </td> </tr> </table> <? $sql_po_items = "SELECT * FROM `purchase_order` WHERE `po_number`='$po_number'"; $query_po_items = mysql_query($sql_po_items); while($po_items = mysql_fetch_array($query_po_items)){ $variable_num = $variable_num+1; ?> <table width="670" cellpadding="0" cellspacing="0" border="0"> <tr> <td width="69"> <table width="69" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:1px; border-top-width: 0px; border-bottom-width: 1px; border-left-width: 1px;" <tr> <td width="69" height="22" align="left"> <center> <font style="font-size: 0.7em;" face="Tahoma"> <input class="text_input" onCheck="makeTxt('box_<?=$variable_num?>', '<?=$po_items['quantity']?>');" onUnCheck="makeTxt('box_<?=$variable_num?>', '');" type="checkbox" name="item_number_checkbox_<?=$variable_num?>" value="<?=$po_items['item_number']?>"> </font> </center> </td> </tr> </table> </td> <td width="64"> <table width="64" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:1px; border-top-width: 0px; border-bottom-width: 1px; border-left-width: 1px;" <tr> <td width="64" height="22" align="left" valign="middle"> <center> <textarea class="text_input" rows="1" cols="2" name="box_<?=$variable_num?>" id="box_<?=$variable_num?>" style="height:14px;width:50px;"></textarea> </center> </td> </tr> </table> </td> <td width="89"> <table width="89" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:1px; border-top-width: 0px; border-bottom-width: 1px; border-left-width: 1px;" <tr> <td width="89" height="22" align="left"> <div style="padding-left:3px;"> <input type="text" name="item_number_<?=$variable_num?>" class="text_input" value="<?=$po_items['item_number']?>" READONLY onFocus="this.blur()" size="12"> </div> </td> </tr> </table> </td> <td width="349"> <table width="349" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:1px; border-top-width: 0px; border-bottom-width: 1px; border-left-width: 0px;"> <tr> <td width="349" height="22" align="left"> <div style="padding-left:3px;"> <input type="text" name="description_<?=$variable_num?>" class="text_input" value="<?=$po_items['name']?>" READONLY onFocus="this.blur()" size="50"> </div> </td> </tr> </table> </td> <td width="78"> <table width="78" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:1px; border-top-width: 0px; border-bottom-width: 1px; border-left-width: 0px;"> <tr> <td width="78" height="22" align="left"> <div style="padding-left:3px;"> <input type="text" name="quantity_<?=$variable_num?>" class="text_input" value="<?=$po_items['quantity']?>" READONLY onFocus="this.blur()" size="5"> </div> </td> </tr> </table> </td> <td width="70"> <table width="70" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:1px; border-top-width: 0px; border-bottom-width: 1px; border-left-width: 0px;"> <tr> <td width="70" height="22" align="left"> <div style="padding-left:3px;"> <input type="text" name="price_<?=$variable_num?>" class="text_input" size="10" value="<?=$po_items['item_cost']?>" READONLY onFocus="this.blur()"> </div> </td> </tr> </table> </td> <td width="80"> <table width="80" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:1px; border-top-width: 0px; border-bottom-width: 1px; border-left-width: 0px;"> <tr> <td width="80" height="22" align="left"> <? $item_total = $po_items['item_cost']*$po_items['quantity']; ?> <div style="padding-left:3px;"> <input type="text" name="line_total_<?=$variable_num?>" class="text_input" value="<?=$item_total?>" READONLY onFocus="this.blur()" size="10"> <input type="hidden" name="manufacturer_<?=$variable_num?>" value="<?=$po_items['manufacturer']?>"> </div> </td> </tr> </table> </td> </tr> </table> <? } ?> <br><br> <table width="800" cellpadding="0" cellspacing="0" border="0"> <tr> <td width="360"> <table width="360" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px;"> <tr> <td width="360"> <font style="font-size: 0.9em;" face="Tahoma"> </font> </td> </tr> </table> <table width="360" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:0px; border-top-width: 1px; border-bottom-width: 0px; border-left-width: 0px;"> <tr> <td width="360" align="left"> <font style="font-size: 0.7em;" face="Tahoma"> ORDERED BY </font> </td> </tr> </table> </td> <td width="80"> </td> <td width="360"> <table width="360" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px;"> <tr> <td width="360"> <font style="font-size: 0.9em;" face="Tahoma"> </font> </td> </tr> </table> <table width="360" cellspacing="0" cellpadding="0" border="0" bordercolor="black" style="border-right-width:0px; border-top-width: 1px; border-bottom-width: 0px; border-left-width: 0px;"> <tr> <td width="360" align="left"> <font style="font-size: 0.7em;" face="Tahoma"> AUTHORIZED BY </font> </td> </tr> </table> </td> </tr> </table> </form>
  8. I have a database I need to update with duplicate data but on their own individual rows, so it is taking data from a form, using a multiplier (1,2,3,etc. all the way to 50) and taking the insert query and running it x amount of times for each item (x is the multiplier).
  9. I have a gigantic script that updates a database with posted variables. The code is too large to post here in the message so I made it into a text file here: http://ainventory.com/pages/po_update_submit.php.txt It is nearly 2MB in size and its mostly duplicate code, I would save it instead of clicking it and view it in notepad or something as it is pretty large for a browser. It was working before I added all the duplicate code, I think it is too big to function now. I have checked it for coding errors in phpdesigner and there is none, but before when it only had 3 items with 1-25 updates on each it worked, when I duplicated them out to 20 items with 1-50 updates on each it is not working and seems to stop loading a few seconds into loading. There should be some way to duplicate those rows without having them typed out the way they are. Any ideas?
  10. No, I added 'test' as text after the code so I could make sure the script wasn't breaking. I figured it out though: <? require($_SERVER['DOCUMENT_ROOT'].'/includes/configs/sql_connect.php'); $result = mysql_query("SELECT * FROM products_description WHERE model_number='JT20-A8450'") or die(mysql_error()); $row = mysql_fetch_array($result); echo $row['id']; echo "<br>"; echo $row['description']; ?>
  11. I tried with the below, nothing returned other than the text 'test': $sql = "SELECT * FROM products_description WHERE model_number LIKE '%'"; $query = mysql_num_rows($sql); // returns number of rows should you need that $query_a = mysql_fetch_array($sql); // returns the array of info from the row while($row = mysql_fetch_array($query_a)){ $descriptions = $row['$id']; echo $descriptions; echo $row[$description]; }
  12. Nope, I put the document root so I can move the script between websites. I tried without the slashes and with the actual connection string on the page, i put sample text below the script of 'test' to make sure the script wasn't breaking. So the only thing output to the browser is the text 'test'. Here is the code, with the slashes removed, and the connection string with the username password changed of course. It is the right connection string and the fields are in the database. I even tried like below with a LIKE statement and just a wildcard, still nothing. <? mysql_connect('localhost','xxx_xxx','xxx'); mysql_select_db('xxx_xxx'); $sql = "SELECT * FROM products_description WHERE model_number LIKE '%'"; $query = mysql_query($sql) or die ("MySQL Error: " . mysql_error()); while($row = mysql_fetch_array($query)){ $descriptions = $row['$id']; echo $descriptions; echo $row[$description]; } ?>
  13. It is not returning any results, when I run that exact $sql in phpmyadmin it returns results. Anyone see what I am missing? <? require($_SERVER['DOCUMENT_ROOT'].'/includes/configs/sql_connect.php'); $sql = 'SELECT * FROM products_description WHERE model_number=\'JT20-A8450\''; $query = mysql_query($sql) or die ("MySQL Error: " . mysql_error()); while($row = mysql_fetch_array($query)){ $descriptions = $row['$id']; echo $descriptions; echo $row[$description]; } ?>
  14. Thanks for the quick response. There isn't a simple way to do it other than that. Its actually geometrically more complex than the dog cat thing, but I just broke it down into basics as I can build from that. There is a database that stores orders made, and one that stores inventory, when an item is received that was ordered it will display on the form and the user can select if all items arrived, or just some and change the quantity, in either case when they post the receipt of items it needs to update the inventory with the product data and it needs each item to be on its own row in the database so when it is bought or moved it can be marked that way, among other things, like serial numbers and the like, so they each need to submit to their own row, the only way I have so far is to make a query, and use an if statement 100x for each possible line item (max 20 on an order) so it will do the $result 1 time if ==1, 2 times if ==2, etc. But that ends up being a big bit of code. if you figure that for the if 1 makes 1 result row, and if 2 makes 2, by the time you get to 100 (which would have 100 result rows) its like 100+99+98+97+96+95, etc. And thats done 20 times (1 for each line item) so its pretty cumbersome. It would better if it could say see that quantity is 8 so run the result 8 times (which would in effect run the submit query 8 times). I would post the code up here but there is too much notation to go with it as it is heavily using ajax, javascript, cgi, and php so even posting the one file would need to be explained by seeing the other 7 files linked to it. I can easily expand the functionality if we could figure out how to change posted variables of this: $1_row_item = "Dog"; $1_row_quantity = "3"; $2_row_item = "Cat"; $2_row_quantity = "2"; $3_row_item = "Bird"; $3_row_quantity = "1"; To an insert query of that works like the below but doesn't require all the repetitious entries: $query="INSERT INTO inventory (`Item_Name`) VALUES ('$1_row_item')"; if ($1_quantity == '1') { $result=mysql_query($query) or die ("MySQL Error: " . mysql_error()); } if ($1_quantity == '2') { $result=mysql_query($query) or die ("MySQL Error: " . mysql_error()); $result=mysql_query($query) or die ("MySQL Error: " . mysql_error()); } if ($1_quantity == '3') { $result=mysql_query($query) or die ("MySQL Error: " . mysql_error()); $result=mysql_query($query) or die ("MySQL Error: " . mysql_error()); $result=mysql_query($query) or die ("MySQL Error: " . mysql_error()); } $query="INSERT INTO inventory (`Item_Name`) VALUES ('$2_row_item')"; if ($2_quantity == '1') { $result=mysql_query($query) or die ("MySQL Error: " . mysql_error()); } if ($2_quantity == '2') { $result=mysql_query($query) or die ("MySQL Error: " . mysql_error()); $result=mysql_query($query) or die ("MySQL Error: " . mysql_error()); } if ($2_quantity == '3') { $result=mysql_query($query) or die ("MySQL Error: " . mysql_error()); $result=mysql_query($query) or die ("MySQL Error: " . mysql_error()); $result=mysql_query($query) or die ("MySQL Error: " . mysql_error()); } $query="INSERT INTO inventory (`Item_Name`) VALUES ('$3_row_item')"; if ($3_quantity == '1') { $result=mysql_query($query) or die ("MySQL Error: " . mysql_error()); } if ($3_quantity == '2') { $result=mysql_query($query) or die ("MySQL Error: " . mysql_error()); $result=mysql_query($query) or die ("MySQL Error: " . mysql_error()); } if ($3_quantity == '3') { $result=mysql_query($query) or die ("MySQL Error: " . mysql_error()); $result=mysql_query($query) or die ("MySQL Error: " . mysql_error()); $result=mysql_query($query) or die ("MySQL Error: " . mysql_error()); } Any ideas?
  15. I have a form that displays entries and allows you to write down the quantity. For example: Dogs: 3 Cats: 2 Birds: 5 When I submit the form I have an update query that will update a database with those entries, but I want to insert one row for each item i.e. like the above example if dogs have three then I want to insert 'dogs' three times to the database, and cats twice, and birds five times, so the database would have 10 new rows, 5 saying dogs, 2 saying cats, and 3 saying birds How do you go about doing this? The way I would like to do it is have a signle insert query for each entry but multiply it based on the number of entries. Somehow dynamically have the script see 'there are 3 entries so lets duplicate the query three times'. Any ideas? Thanks in advance, SK
  16. I figured it out. The problem was the variables ( $path_pdf1 , $path_pdf2 , $path_pdf3 ) were enclosed in quotations, they should not have been.
  17. Below is my form for posting to the script 'pdf_upload_test_form.php' <form action="pdf_upload_test.php" method="post" enctype="multipart/form-data" name="form1" id="form1"> File1: <input type="file" name="pdf[]" id="pdf[]"><br> File2: <input type="file" name="pdf[]" id="pdf[]"><br> File3: <input type="file" name="pdf[]" id="pdf[]"><br> Model: <input type="text" name="model_number" id="model_number"><br> <input type="submit"> </form> And below is the script 'pdf_upload_test.php' <? $path_pdf1= $_SERVER['DOCUMENT_ROOT']."/prod_pdfs/temp/".$HTTP_POST_FILES['pdf']['name'][0]; $path_pdf2= $_SERVER['DOCUMENT_ROOT']."/prod_pdfs/temp/".$HTTP_POST_FILES['pdf']['name'][1]; $path_pdf3= $_SERVER['DOCUMENT_ROOT']."/prod_pdfs/temp/".$HTTP_POST_FILES['pdf']['name'][2]; copy($HTTP_POST_FILES['pdf']['tmp_name'][0], $path_pdf1); copy($HTTP_POST_FILES['pdf']['tmp_name'][1], $path_pdf2); copy($HTTP_POST_FILES['pdf']['tmp_name'][2], $path_pdf3); $orig4_filename = "$path_pdf1"; $new4_filename = $_SERVER['DOCUMENT_ROOT']."/prod_pdfs/".$model_number."-specs.pdf"; $status = rename($orig4_filename, $new4_filename) or exit("Could not add the item"); $orig5_filename = "$path_pdf2"; $new5_filename = $_SERVER['DOCUMENT_ROOT']."/prod_pdfs/".$model_number."-warranty.pdf"; $status = rename($orig5_filename, $new5_filename) or exit("Could not add the item"); $orig6_filename = "$path_pdf3"; $new6_filename = $_SERVER['DOCUMENT_ROOT']."/prod_pdfs/".$model_number."-instructions.pdf"; $status = rename($orig6_filename, $new6_filename) or exit("Could not add the item"); $filesize1=$HTTP_POST_FILES['pdf']['size'][0]; $filesize2=$HTTP_POST_FILES['pdf']['size'][1]; $filesize3=$HTTP_POST_FILES['pdf']['size'][2]; if($filesize1 && $filesize2 && $filesize3 != 0) { echo "We have recieved your files"; } else { echo "ERROR....."; } if($filesize1==0) { echo "There're something error in your first file"; echo "<BR />"; } if($filesize2==0) { echo "There're something error in your second file"; echo "<BR />"; } if($filesize3==0) { echo "There're something error in your third file"; echo "<BR />"; } ?> Its not working but also doing something very strange. When I go to use it at /pdf_upload_test_form.php , i select 3 pdf files and type in a model name, it sits for a minute or two while it is sending the data to the script, then the page refreshes, clears all the text in the form fields, and the url then becomes: /pdf_upload_test_form.php/pdf_upload_test.php which is weird in and of itself. Why is it not working first off, and why is it showing it to be in a directory called pdf_upload_test_form.php when that is just the filename? Any ideas? Thanks, SK
  18. $result=mysql_query("select * from payments_received order by invoice_number WHERE `date`>='2008-09-25 11:10:31' asc"); That is my query string now, obviously it doesn't work. I need to find out how I can convert the timestamp, formatted as above, into the unix style numerical values only (ex: 1222433088) . I need that so I can use the greater than less than in my query to locate data based on the date and time of entry into database. Thanks in advance, SK
  19. Here is a better code for listing the files, but I still can't make it limit the results returned.? <?php if ($handle = opendir($_SERVER[DOCUMENT_ROOT].'/files/db/')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $thelist .= '<a href="'.$file.'">'.$file.'</a>'; } } closedir($handle); } ?> <?=$thelist?><br>
  20. I am trying to list the last say 5 files in my directory. I have a code snippet to list the files. Problem is also that this code displays two lines above the list of files. A single period on the first line and two periods on the second line. So first, how can I make this limit to just 5 files, and second, why the periods above the results? Thank in advance. <?php if ($handle = opendir($_SERVER[DOCUMENT_ROOT].'/files/db/')) { while (false !== ($file = readdir($handle))) { echo "$file<br>"; } closedir($handle); } ?>
  21. Thank you man! I completely forgot to try that. I would have taken days to remember to. I found the problem and fixed it. Thanks! SK
  22. The below query is not returning results. It is something wrong in that query. There are two queries below, the second one does return the values I am looking for, the first one does not, so the variable is being sent properly to the page ( $model_number ) but the first query never returns any results. Please check it and see if you see any errors. Thanks! SK <?php require($_SERVER['DOCUMENT_ROOT'].'/includes/configs/sql_connect.php'); $sql_media = "SELECT * FROM `products_media` WHERE `model_number`='$model_number' OR `number_search`='$model_number'"; $query_media = mysql_query($sql_media); while($media = mysql_fetch_array($query_media)){ $image_file = $media['image_file']; $image_file_thumb = $media['image_file_thumb']; $pdf_specs = $media['pdf_specs']; $pdf_specs_thumb = $media['pdf_specs_thumb']; $pdf_one = $media['pdf_one']; $pdf_one_thumb = $media['pdf_one_thumb']; $pdf_two = $media['pdf_two']; $pdf_two_thumb = $media['pdf_two_thumb']; $pdf_three = $media['pdf_three']; $pdf_three_thumb = $media['pdf_three_thumb']; $pdf_four = $media['pdf_four']; $pdf_four_thumb = $media['pdf_four_thumb']; } $sql_info = "SELECT * FROM `products` WHERE `model_number`='$model_number' OR `number_search`='$model_number'"; $query_info = mysql_query($sql_info); while($info = mysql_fetch_array($query_info)){ $manufacturer = $info['manufacturer']; $model_number = $info['model_number']; $name = $info['name']; } ?>
  23. Simple. Give an if statement and do a body onload, like this: <? if($number >= 5)) { ?> <body onload="parent.framename.location.href='http://<?=$_SERVER[HTTP_HOST]?>/page.php'"> <? } ?> Make the $number variable the count you are doings result, and in the onload statement change the 'framename' to whatever the name of the iframe is. Make the page.php the page that is loading in the iframe, that will essentially 'reload' the page if the event you want to trigger it occurs. Does that help you? SK
×
×
  • 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.