Jump to content

kool_samule

Members
  • Posts

    169
  • Joined

  • Last visited

Everything posted by kool_samule

  1. sweet, just what i'm after, i'm guessing that you could do something similar with COLUMNs as well as tables. . . . .many thanks!
  2. Hi Chaps, I'm trying to get a list of MySQL table names in a PHP/HTML Select List/Menu with the value of the Select Option being the table name. I have this as a starting point, but can't figure out how to get the values into the Select. $result = mysql_query("SHOW TABLES FROM 'DATABASE'"); while($table = mysql_fetch_array($result)) { $tables[]=$table; } Any help would be sweet. .
  3. Hi Chaps, I've been searching on Google for ages now and can't seem to find a solution that works. I have a mail script: $to = 'someone@somewhere.com'; $subject = "You've got Mail!"; $message = 'This is a test Email'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: Webmaster <do-not-reply@domain.com>' . "\r\n"; $sent = mail("$to", "$subject", "$message", "$headers") ; This code is tried and tested on a UNIX server and sends to Hotmail accounts. However, I had to change this: to this: to even get mail() to work on my work IIS server, but it doesn't send to Hotmail accounts. I thought that Hotmail may have blacklisted our work DNS settings, but I can send emails from my work email account to Hotmail account without any problems and IIS and MS Exchange on the same server. . . . . Is there something else I can try or look for as this is doing my nut in?
  4. Cool, cheers dude, just what I'm after. . . .Boom!
  5. Hi Chaps, I'm building a simple on-line clothing shop and I've got to the payments bit and need a bit of advice. I've checkedout PayPal IPN and can figure out how it all links together, but I'm wondering if there is something similar that doesn't redirect to the PayPal site and resides within your domain. Any guidence would help a lot. Cheers
  6. Hi Chaps, I'm having trouble setting a cookie. The login.php file is in a directory called 'account' The cookie name in Termporary Internet Files shows as: instead of the standard This results in the cookie being read by files with the 'account' directory. I've searched around played around the the $path and $domain variables, but they don't seem to do anything. Although the PHP code looks like this: setcookie($name, $value, $hour); The cookie looks like this: Can someone tell me where I'm going wrong with this?
  7. Hi Chaps, I have some basic code that takes a UNIX time, adds a pre-calulated duration, to give a 'due date/time'. I then convert the UNIX time to [Y-m-d H:i:s] format for presentation. The problem I'm having at the moment is that the due date/time can be something like 2010-05-12 23:55:10. This time is outside of normal working hours, I need to insure the due date/time falls between 09:00 - 17:30 (Mon-Fri). So if the start time is: 16:00 and the duration is: 5 hours, firstly I need the time to 'carry over' to the next day, starting from 09:00, and secondly, if the next day is a weekend, carry over to the next working day. . . . . Can anyone point me in the right direction? Cheers
  8. Hi, thanks for the reply. I have checked out the tutorial, and that it is basically what I have done. The user doesn't have to sign in to an account to browse and build a cart. The tutoial doesn't cover the checkout stage, where a user would sign in and then the cart contents would be added to an order, including the user id. I guess I'm after a bit of guidence to get session data into a database really. Once I have an order, I'll be (trying) to link the order info with an integrated payment system, such as PayPal.
  9. Hi Chaps, I have a really basic shopping cart, which uses Sessions to add/update/delete/write products. My question is, what's the best way to transfer the cart/session information to a checkout stage where a user would sign in/sign up, then complete the payment? I'm guessing that when the user gets to the checkout, an 'order/order item' is created, which would need a customer id. I'm not sure how to link the session cart to a customer/order?? Sorry if this is a bit of a daft question, but I guess it's beeter to be sure before doing something stupid! Cheers
  10. Hi Chaps, I have a basic Online Shop Application: tbl_category (cat_id, category, fk_cat_id, sub_cat_id, sub_category) tbl_product (prod_id, fk_sub_cat_id, prod_title, prod_price, prod_thumb, prod_image, prod_price) tbl_product_size (prod_size_id, prod_size) tbl_product_has_size (prod_has_size_id, fk_prod_id, fk_prod_size_id, prod_quantity) tbl_shopid (shop_id, shop_title) tbl_shop_has_product (shop_has_prod_id, fk_shop_id, fk_prodid) A product can be in more than one shop, have various sizes and different quantities of those sizes. In the Backend Admin pages, I want to have a Shop Summary page, which will list the shops and its products + product quantities. At the moment, I have a query: // QUERY mysql_select_db($database_dbconnect, $dbconnect); $query_rsShop = "SELECT tbl_shop_has_prod.shop_has_prod_id, tbl_shop_has_prod.FK_shop_id, tbl_shop_has_prod.FK_prod_id, tbl_shop.shop_id, tbl_shop.shop_title, tbl_product.prodtitle, tbl_product_has_size.prod_quantity FROM tbl_shop_has_prod INNER JOIN tbl_shop ON tbl_shop.shop_id=tbl_shop_has_prod.FK_shop_id INNER JOIN tbl_product ON tbl_product.prod_id=tbl_shop_has_prod.FK_prod_id INNER JOIN tbl_product_has_size ON tbl_product_has_size.FK_prod_id=tbl_product.prod_id WHERE tbl_shop_has_prod.FK_shop_id=tbl_shop.shop_id AND tbl_product.prod_id=tbl_shop_has_prod.FK_prod_id"; $rsShop = mysql_query($query_rsShop, $dbconnect) or die(mysql_error()); $row_rsShop = mysql_fetch_assoc($rsShop); $totalRows_rsShop = mysql_num_rows($rsShop); // PHP <table border="0" cellpadding="0" cellspacing="0" id="tblrepeat"> <tr> <td>Shop</td> <td>Product</td> <td>Quantity</td> </tr>// <?php $previousShop = ''; $previousProduct = ''; if ($totalRows_rsShop > 0) { // Show if recordset not empty do { if ($previousShop != $row_rsShop['shop_id']) { // for every Shop, show the Shop Name //if ($previousProduct != $row_rsShop['prod_id']) { // for every Product, show the Product Name ?> <tr> <td><?php echo $row_rsShop['shop_title']; ?></td> <td> </td> <td> </td> </tr> <?php $previousShop = $row_rsShop['shop_id']; } ?> <tr> <td> </td> <td><?php echo $row_rsShop['prodtitle']; ?> </td> <td><?php echo $row_rsShop['prod_quantity']; ?></td> </tr> <?php //$previousProduct = $row_rsShop['proj_id']; } ?> <?php } while ($row_rsShop = mysql_fetch_assoc($rsShop)); ?> <?php } // Show if recordset not empty ?> </table> that produces something like this(e.g. for SHOP 1): What I'm after is to produce something like this: How do I either alter my QUERY to group it together, or alter the PHP to produce the results as I require????? Arrrghhhh!
  11. Coolio, sorted it, thanks for the advice. I altered the function that was inserting '/" marks between text, double, date, float data types. Out of interest, what do you use to do your coding? notepad?
  12. hi, thanks for the reply. . . I'm aware of the way to normally do things, this is a unique field that must NOT be NULL, and takes it's name from two different inputs. GetSQLValueString() is an Adobe DreamWeaver built-in function.
  13. Hi Chaps, Maybe a simple answer to this one, I have two input fields, which I want to combine into 1 SQL column. Inputs: <input type="text" name="job_no" value="00001" size="32" /> <input type="text" name="job_model" value="MODEL_A" size="32" /> SQL: "INSERT INTO tbl_job (job_title) VALUES (%s)", GetSQLValueString($_POST['job_no'], "text").GetSQLValueString(' - '.$_POST['job_model'], "text"); This produces: job_title = 00001' - MODEL_A Problem: Notice the character after the job_no. . . .how do I get rid of this?
  14. Yeah, I see your point, think I may have ben over confusing myself with the matter. Thanks for your advice, I'll crack on with creating the database tomorrow and see how I get on. Cheers for your help. Samuel
  15. * That makes sense, but what if the customer buys multiple items, e.g., 1 skirt and 1 dress? tbl_orders = 1 order for every product or could you have something like: tbl_order = 1 Order (id, customer_id, purchase_date, price) + tbl_order_items = Single/Multiple products (id, order_id, product_has_size_id, quantity)? Thanks for your help with this, it is really appreciated!
  16. Cool, that makes sense, think I can work the products/sizes/quantities/shop etc. so thank you for that. How would I then structure the order tables, where process = a customer has logged in, added items to their cart and ready to complete the checkout stage. How do I log orders and order items so I can use them for accounting / customer reports?
  17. - Should this be (shop_id, product_has_sizes_id) ? Or have I misunderstood? - Category = skirt, dress, tops - Sub-category = floral, denim, leather - A product = eg. skirt > floral * So products will show up under a category and subcategory - A product = eg. skirt > floral, skirt > leather * If i swapped the categories over, e.g.: - tbl_category = floral, denim, leather - tbl_sub-category = skirt, dress, top * Then a product would only show up under one sub-category, which would you suggest is the correct way to go about it? * Yes, using the tbl_shop.id would e useful to store the same product in different shops * Where would the customer_id come from if the user isn't logged in? Sorry for all the questions, just trying to get my head around this!? Also, could you give me an idea of how to structure the info from shop - order - order_items? (this would be useful for reports, etc.) Thanks!
  18. Hi, thanks for the reply. . . Yeah I see what you mean with my ERD being a bit flawed. All items will cost the same, regardless of size. Does this look any better?: tbl_cust - [custid] (customer details) tbl_cat - [catid] (denim, floral, leather) tbl_sub_cat - ([subcatid] (skirt, dress, top) tbl_size - [sizeid, subcatid] (S, M, L) tbl_product - [prodid, catid, subcatid, sizeid] (skirt product, dress product, top product) tbl_shop - [shopid, prodid] (quantity, price] tbl_sales - [saleid, prodid, custid] (size, quantity, price, sale_date) tbl_sale_item - [saleitemid, saleid . . . . . and that's when I get a bit confused . . . I need help sorting our the orders, quantities, customer etc. . . . HELP!
  19. Hi Chaps, I'm starting to build a small online clothing shop for my friend. I've sorted out the basic database schema: tbl_category (skirt/dress/top/etc) tbl_product (item) tbl_customer (customer) tbl_order (order_id/customer_id/quantity/price/postage/etc) tbl_order_item (order_id/product_id) I've lokoed at a few online shopping tutorials but they are pretty simple and don't deal with products where you can have different sizes of things, like tops/dresses. I'm after a bit of guidence on how to set up details such as sizes and quantities. What I want at the end, is a products page with a list of items (no duplicates), then on the product details page, a list of available sizes and the quantity available. As an example, I have 4 skirts, all the same type, in stock. 3 x size [M] 1 x size [L]. If the large skirt is sold, the quantity (in stock figure) will be reduced and the size [L] will be unavailable. Any help or recommendations would be appreciated. Cheers
  20. Uhh, maybe. . . basically, this is the result I'm currently getting: SELECT tbl_gantt.ganttid, tbl_gantt.FK_projid, tbl_gantt.gantttaskno, tbl_gantt.gantteventtype, tbl_gantt.ganttname FROM tbl_gantt LEFT OUTER JOIN tbl_user ON tbl_user.userid=tbl_gantt.FK_userid WHERE FK_userid = 7 ORDER BY FK_projid ASC, FK_jobid ASC, gantttaskno ASC But what I'm after is (photoshop'ed):
  21. Hi Chaps, I have a MySQL table: tbl_gantt: CREATE TABLE `tbl_gantt` ( `ganttid` int(11) NOT NULL auto_increment, `gantteventtype` varchar(100) default NULL, `FK_projid` varchar(100) default NULL, `FK_jobid` int(6) default NULL, `FK_userid` int(6) default NULL, `gantttaskno` varchar(20) default NULL, `ganttname` varchar(100) default NULL, UNIQUE KEY `ganttid` (`ganttid`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC; insert into `tbl_gantt`(`ganttid`,`gantteventtype`,`FK_projid`,`FK_jobid`,`FK_userid`,`gantttaskno`,`ganttname`) values (1,'group','4001',NULL,NULL,0,'4001 - Project Title'), (2,'group','4001',182,NULL,1,'Job Sheet 1'), (4,'task','4001',182,7,4,'Translation'), (5,'task','4001',182,2,8,'Typesetting'), (6,'group','4001',183,NULL,1,'Job Sheet 2'), (8,'task','4001',183,1,4,'Translation'), (9,'task','4001',183,7,8,'Typesetting'), (10,'group','4002',NULL,NULL,0,'4002 - Project Title'), (11,'group','4002',184,NULL,1,'Job Sheet 1'), (13,'task','4002',184,1,4,'Translation'), (14,'task','4002',184,2,8,'Typesetting'), (15,'group','4002',185,NULL,1,'Job Sheet 2'), (17,'task','4002',185,11,4,'Translation'), (18,'task','4002',186,7,8,'Typesetting'); What I'm trying to do is a SELECT query: SELECT tbl_gantt.ganttid, tbl_gantt.FK_projid, tbl_gantt.gantttaskno, tbl_gantt.gantteventtype, tbl_gantt.ganttname, tbl_language.langtname, tbl_user.useralias FROM tbl_gantt LEFT OUTER JOIN tbl_user ON tbl_user.userid=tbl_gantt.FK_userid WHERE FK_userid = 7 ORDER BY FK_projid ASC, FK_jobid ASC, gantttaskno ASC This produces the correct results, but I'm after some sort of 'add-on' to this query where I can see: FK_userid=7; select ganttaskno from tbl_gantt where gantttaskno= 0 AND FK_Projid = ('FK_userid=7' gantttaskno.FK_projid) I hope that is clear and makes some sort of sense. Cheers
  22. OK, I've got the upload function working correctly now, using: $raw_file = $x function FixEncoding($raw_file){ if(mb_detect_encoding($raw_file)=='UTF-8'){ return $raw_file; }else{ return utf8_decode($raw_file); } } $file = utf8_decode($raw_file); ...which works for a file a sinlge file ($x), passed from a form. I have a ftp_nlist array which I need to convert to UTF-8, so that the disply list and download links work correctly. . . . This is my table so far: <table border="0" cellpadding="0" cellspacing="0" id="tbldisplay"> <tr> <th>Type</th> <th>Title</th> <th>Open</th> <th>Download</th> <th>Delete</th> </tr> <?php $ftp_nlist = ftp_nlist($conn, "."); //alphabetical sorting sort($ftp_nlist); foreach ($ftp_nlist as $value) { //1. Size is '-1' => directory if (ftp_size($conn, $value) == -1) { //output as [ directory ]?> <tr> <td><img src="images/folder.png" /></td> <td><?php echo $value;?></td> <td><a href="<?php $_SERVER['PHP_SELF']?>?dir=<?php echo $ftpPath.'/'.$value ;?>"><img src="images/open_folder.png" width="20" height="20" border="0" /></a></td> <td>---</td> <td><a href="ftp_dir_delete.php?dir=<?php echo $ftpPath;?>&delete_dir=<?php echo $value ;?>"><img src="images/delete2.png" border="0"/></a></td> </tr> <?php } } foreach ($ftp_nlist as $value) { //2. Size is not '-1' => file if (!(ftp_size($conn, $value) == -1)) { //output as file?> <tr> <td><img src="images/file.png" /></td> <td><?php echo $value;?></td> <td>---</td> <td><a href="ftp_file_download_select.php?dir=<?php echo $ftpPath;?>&file=<?php echo $value ;?>"><img src="images/download.png" border="0"/></a></td> <td><a href="ftp_file_delete.php?dir=<?php echo $ftpPath;?>&file=<?php echo $value ;?>"><img src="images/delete2.png" border="0"/></a></td> </tr> <?php } } ?> </table> If someone can help me get the values of the ftp_nlist through the encoding function to display the correct filenames, that would be ultra-sweet
×
×
  • 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.