Jump to content

SocomNegotiator

Members
  • Posts

    106
  • Joined

  • Last visited

    Never

Everything posted by SocomNegotiator

  1. This is my DB setup: products_sizing: sizingid sizingname value type hidden freesize 4 Large 1 absolute 5 X-Large 1 absolute 6 Small 1 absolute products: Of course I have productid, and all the other info about the product. Then their is a field called "sizing" This then has the id's of whatever sizing method (products_sizing) it has assigned to it. productid ....... sizing 1 4,5 Notice how a product does not have to have all the sizing methods. I am trying to figure out how to create an array to grab this information for each product automatically. This way I can use the array in a foreach to loop through a users selected products and show them which sizing option they can choose from for each individual product. Thanks so much for your help!
  2. Ok here is what I have come up with. The only problem with this code is that if I have more than one product the sizing methods for each product will be the last product to go through the loop. For instance, the first and second product will have the same sizing methods as the third even though the first and second product don't have the same sizing methods. Any ideas on how to fix this? Again this is a Smarty template, and I can use normal coding in the scripts. {foreach from=$ProdsCarts key=ProductID item=ProductRow name=ProductsLoop}//This goes through how many products there are. {if $ProductRow.sizing != ''} <tr class="head"> <td height="15" colspan="3" style="border:none;"><div align="justify">{#Sizing_Method#} ({$ProductRow.name})</div></td> </tr> <tr> <td colspan="2"> <div align="left"> {foreach from=$ProductSizing key=key item=isOn name=ProductsLoop} // This goes through the sizing methods. Right here I think is the problem. It does not associate with which product the sizing methods go with. <input name="sizingmethods" type="radio" id="sizingmethods{$SizingID}" value="{$SizingID}"/> <label for="sizingmethods{$SizingID}"> {$Sizing.$key.name} | {if $Sizing.$key.value ne 0} +{$Sizing.$key.value} {if $Sizing.$key.typename eq 'absolute'}{#CURRENCY#}{else}%{/if}{else} {#free#} {/if}</label><br /> {/foreach} </div></td> </tr> {else} {/if} {/foreach} Ideas????
  3. Sorry, yes I am using a template. It is Smarty. I can though input regular code into the scripts.
  4. I have a products table that has a field called sizing. The sizing field contains an ID from another table called products_sizing. The main reason for the sizing field in the products table is to decipher which products have what kind of sizing method. For instance, some products (shirts) only are available in small and medium not large, but others have the option for all three. In the products table the sizing field shows which sizing method a product will have if any. {foreach from=$SizingMethods key=SizingID item=SizingRow name=SizingMethods} {if (what query should go here to only show the sizing methods a certain product has?)} <input name="sizingmethods" type="radio" id="sizingmethods{$SizingID}" value="{$SizingID}"/> <label for="sizingmethods{$SizingID}"> {$SizingRow.name} | {if $SizingRow.value ne 0} +{$SizingRow.value} {if $SizingRow.typename eq 'absolute'}{#CURRENCY#}{else}%{/if}{else} {#free#} {/if}</label><br /> {/if} {/foreach} Thanks in advance!
  5. Sorry I did not specify...the script is in the sources folder, and I want the uploaded file to go to the hotsheet folder, which is in the files folder.
  6. I am trying to upload a file to a certain folder in my directory. However, the folder I want is not in the same folder as the file. This is what I have...Do I have the correct path? move_uploaded_file($_FILES["file"]["tmp_name"], "../files/hotsheet/" . $_FILES["file"]["name"]); echo "Stored in: " . "../files/hotsheet/" . $_FILES["file"]["name"]; Here is an example of my folder setup /html/ /files/ /hotsheet/ /sources/ file.php
  7. It's just not displaying anything...when in the DB I know there are items
  8. Do you see anything wrong with this code? I don't get this...a few months ago this iece of code was working fine, but now it does not work. I think that my host provider upgraded his PHP version or something. $ladders=mysql_query("SELECT item.id, item.name, pre_order.amount, DATE_FORMAT(pre_order.date,'%m/%d/%y - %H:%i') FROM pre_order LEFT JOIN item ON pre_order.item_id = item.id WHERE pre_order.user_id='".$user_id."'") or die(mysql_error()); while(list($id,$name,$amount,$date)=mysql_fetch_row($ladders)){ $out[body].="<tr><td align='center'>$amount</td><td align='center'>$name</td><td align='center'>$date</td></tr>"; }
  9. Ah thanks "The Little Guy" I hate all of this stupid stuff that php has!!!
  10. I have this code...it was working when I created the site like 3 months ago, but now it does not work. I get an error that says this "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1". Any help would be much appreciated. $res = mysql_query("SELECT * FROM `guide_order` WHERE user_id = '$userid' ORDER BY priority") or die('Error, query failed'); while($r = mysql_fetch_array($res)){ $db->query("INSERT INTO `order` (`order_number`,`pre_order_id` , `item_id` , `amount` , `user_id` ) VALUES (".$num.",".$r['id'].", ".$r['item_id'].", ".$r['amount'].", ".$r['user_id'].")") or die (mysql_error());
  11. Hmm...so there is no way to just get a module that will convert the text to the language selected. I know I would have to create something with the sessions so that it knows what language a user wants. But the default would be english and if they selected spanish then the text would change. Most of the text is not in a database. The site is mainly static html, but with a php framwork.
  12. Well I am not sure what to do with this. I have a client who wants their site to also be in Spanish. Well do I need to re-create the whole site in Spanish. Or is there some sort of module I can get that when the user selects the language the site will change accordingly.
  13. Yeah I think I understand the query...except for one thing ('".implode("','",$data)."') Why are their two commas? I know one to separate each value, but the other I am not sure...
  14. Yeah I need to read up on the whole implode thing. I use arrays, but I don't use them as often as I should.
  15. Sweet stuff that right there worked. Thanks a lot everyone for your help.
  16. Ok yes it is an Integer that is set to NULL. I tried $amount == "" and it did not work. Ok that is for an update...now if I have an INSERT like this $db->query("INSERT INTO guide_order (item_id, amount, user_id, priority) VALUES ( '$item_id', '$amount', '$user_id', '$num')") or die('Error, query failed'); Now you notice that I have $amount...could I change that to NULL? However, with that if the person enters in an amount I want it put the amount they entered into the database. So I can't use NULL here, because no matter if they left it blank or entered in something they would always get nothing.
  17. Ok I have a submit button that takes the values entered and enters them into a database...pretty simple. Well if the quantity is not entered I want nothing to be put into the database under that field. However, it is putting a "0" into the field. I even have this code to try and prevent that... if($amount = ""){ $amount = ""; } Also I have the structure of this field set to Null. I had it as Not Null before and the default was zero. I thought by changing that to Null would change it, but it did not. Any suggestions?
  18. Wow believe it or not...that was the problem. Thanks for the idea
  19. Because I have an update button for each individual item.
  20. Ok this is what I have. I am not getting an error at all. What happens is that when I select an item to delete and hit the delete button the page just refreshes and that's it. The item or items that were checked do not get deleted. I am getting a value for <?=$row['id']?> so that is not the problem. Something is happening where the page is loosing the post. Because when I do echo $del_id; I get nothing. However, if I hardcore a number into the query like $del = $db->query("DELETE FROM `guide_order` WHERE id = '3'"); it works just fine. <?php while($row = $db->fetch_array()) { ?> <form id='order_form1' action='?page=guide' method='post'> <input type='hidden' name='pre_id' value='<?=$row['id']?>'/> <tr> <td align='center'><input type='text' name='amount' size='5' value='<?=$row['amount']?>' /></td> <td align='center'><?=$row['name']?></td> <td align='center'><input type='text' name='priority' size='5' value='<?=$row['priority']?>' /></td> <td align='center'><input name="checkbox[]" type="checkbox" value="<?=$row['id']?>"></td> </tr> </form> <?php } ?><br /> </table> <form id='order_form' action='?page=guide' method='post'> <input type='hidden' name='user_id' value='<?=$user_id?>'/><br /> Delivery Date: <input type="text" name="deliver" size="20" /><br /><br /> <input type='submit' name='submit' value='Submit Order'/> <input name="delete" type="submit" value="Delete"> <?php // Check if delete button active, start this $delete = $_REQUEST['delete']; if( $delete != '' ){ $checkbox = $_REQUEST['checkbox']; $count = count($_REQUEST['checkbox']); for($i=0;$i<$count;$i++){ $del_id = $checkbox[$i]; $del = $db->query("DELETE FROM `guide_order` WHERE id = '$del_id'"); } // if successful redirect if($del){ echo "<html><head><meta HTTP-EQUIV=\"Refresh\" CONTENT=\"1; URL=index.php?page=guide\"></html>"; } } ?> </form> Any help would be much appreciated.
  21. Any ideas...? I think it would be similar to having a multiple delete, but with this it's an update to the database. Granted it will have more things that need to be put into the database.
  22. Ok what I am trying to do is take the items that are generated from the query below and upon submit add them to my order table in the DB. This sounds easy, but if you look at my code you will notice that before they submit an order they can re-enter in an amount next to their item. Well I need to keep track of each amount entered for each item. I am thinking I will have to use an array, but I am not sure of how to even set it up. As of right now I have it so that if an amount is changed they have to update each item individually before they can hit the final submit button. However, I know there is a way to make it so that all they have to do is enter in an amount next to each item and then hit submit. I also need this for the priority, but once I figure out how to do the amount I will be able to do the priority. <?php $user_id = $user->inf['id']; $db->query('SELECT item.id, item.name, guide_order.id, guide_order.amount, guide_order.priority, guide_order.user_id FROM guide_order LEFT JOIN item ON guide_order.item_id = item.id WHERE guide_order.user_id='.$user_id.' ORDER BY guide_order.priority ASC') or die(mysql_error()); $count = $db->num_rows(); if ($count == 0) { echo "<br /><div id='case'><p align='center' style='color: red;'>You have no items for this order to view.</p></div>"; } if ($count != 0) { ?> <style type="text/css"> .menu22 ul{ margin: 0px; padding: 0px; float: left;} .menu22 ul li{ display: inline; margin:2px 5px 5px 20px;} </style> <div class="menu22" align="center"> <table cellpadding='2' cellspacing='2' align='center'> <tr> <td align='center' style='border-bottom: 1px solid #FFFFFF; padding-right: 20px;'>Quantity</td> <td align='center' style='border-bottom: 1px solid #FFFFFF; padding-right: 20px;'>Item</td> <td align='center' style='border-bottom: 1px solid #FFFFFF; padding-right: 20px;'>Priority</td> <td align='center' style='border-bottom: 1px solid #FFFFFF; padding-right: 20px;'>Delete</td> </tr> <?php while($row = $db->fetch_array()) { ?> <form id='order_form1' action='' method='post'> <input type='hidden' name='pre_id' value='<?=$row['id']?>'/> <tr> <td align='center'><input type='text' name='amount' size='5' value='<?=$row['amount']?>' /></td> <td align='center'><?=$row['name']?></td> <td align='center'><input type='text' name='priority' size='5' value='<?=$row['priority']?>' /></td> <td align='center'><input type='submit' name='submit_delete' value='Delete' style="font-size:9px;"/></td> </tr> </form> <?php } ?><br /> </table> <form id='order_form' action='' method='post'> <input type='hidden' name='user_id' value='<?=$user_id?>'/><br /> Delivery Date: <input type="text" name="deliver" size="20" /><br /><br /> <input type='submit' name='submit' value='Submit Order'/> </form> </div> <?php } ?>
  23. Ok for anyone who is having the same problem I got it solved. I just had to do two parameters in the MySQL ORDER BY syntax. For instance... $query = "SELECT *, DATE_FORMAT(order.date,'%m/%d/%y - %H:%i') AS order_date FROM `order` LEFT JOIN `item` ON order.item_id = item.id LEFT JOIN `docj_user` ON docj_user.id = order.user_id ORDER BY order_number DESC, order.id ASC"; $result = mysql_query($query) or die (mysql_error());
  24. Ok so lets say I add an item_number to the order table (I do have an item_id...would that work for what you are talking about?). How would I change around the MySQL or what would I need to add? Because like I said I have to have the order_number as the ORDER BY. Reason being because each individual order needs to be displayed in DESC order.
  25. Ok so with that how would I be able to put that into the query? Because I have to have ORDER BY order_number because that puts the single orders in order from most recent to less recent. It is the items in each order that needs to be displayed that way.
×
×
  • 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.