[PHP-DB] How to get 2 columns to display
Hi guys, I'm trying to get two columns of td/td to display side by side and then go to a new row. I am using this code but nothing I seem to do is working this far. ?php for ($r=0;$products = db_fetch($productsQuery);$r++) { ? td align=centera href=?php echo $base_url; ?products/?php echo $category; ?/?php echo $products['name_url']; ? class=product_linkimg src=?php echo $base_url; ?product_images/thumbs/?php echo $products['thumb']; ? border=0 width=159br?php echo $products['name']; ?/a/td ?php if ((($r+1) % 2) == 0) { ? /tr tr valign=top ?php } } ? What is happening with this code is I am getting results like: tr tdIMAGE HERE/td tdIMAGE HERE/td tdIMAGE HERE/td tdIMAGE HERE/td tdIMAGE HERE/td /tr What I WANT is: tr tdIMAGE HERE/td tdIMAGE HERE/td /tr tdIMAGE HERE/td tdIMAGE HERE/td /tr tdIMAGE HERE/td td/td /tr ANY clue where I am going wrong? Thanks so much. Aaron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Inventory Management for ecommerce store
Hi All, I'm looking for some advise/login on developing an Inventory Management system for an ecommerce store and what pitfalls one needs to be on the lookout for. Anything anyone would like to contribute would be greatly appreciated! Thanks in advance! Aaron
RE: [PHP-DB] Inventory Management for ecommerce store
No problem on the piggy-back. I do actually have an Inventory Management component in place but it seems to be acting up a little bit here any there. This is what I do: 1) For each product; create an Inventory Record for the product SKU, product_id AND attributes 2) I have 2 inventory fields that hold the stock info - quantity and approvedQuantity 3) When an item is added to the cart; I subtract the item quantity from the inventory quantity that is available 4) If an item(s) is removed from the cart; the quantity of the item(s) is returned back to its' Inventory record(s) 5) If an order is canceled; the quantity of the item(s) is returned back to its' Inventory record(s) 6) If the customer processes their order; the approvedQuantity for each items' Inventory Record is subtracted by the quantity being ordered In the end, both the quantity and approvedQuantity for an Inventory record should match. This is where I am having a problem and I don't know how to track/fix it. I HAVE Inventory Records where the approvedQuantity and the quantity are NOT matching. I asked the question to see what others might be doing because it seems how I have it setup is obviously not working :( Can ANYONE see where my logic is flawed? Thanks! Aaron -Original Message- From: Hutchins, Richard [mailto:[EMAIL PROTECTED] Sent: May 21, 2004 11:49 AM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Inventory Management for ecommerce store I have an e-commerce project coming up in the next quarter and I want to just piggyback (not hijack the thread) one question onto this thread. And that is, don't e-commerce packages come with the functionality to track inventory? I mean, most times when I shop online, I see whether an item is in stock or how many pieces a retailer has in stock. I am concerned that there is more work than meets the eye with an e- commerce implementation in regards to constructing a DBMS to handle the inventory issues in addition to implementing the shopping cart and the catalog. Sorry if this is off topic, but this issue just raised a red flag for me and I need to understand it a bit better before I put together an estimate. I have a catalog component and a credit card processing component at my disposal, but need to know if it is common practice to hand-build the inventory management end of it. Consequently, this could help with Aaron's original question if there are inventory management components out there already by allowing him (and I) to simply use an existing one rather than reinventing the wheel, so to speak. Thanks, Rich -Original Message- From: Matt [mailto:[EMAIL PROTECTED] Sent: Friday, May 21, 2004 11:42 AM To: Aaron Wolski; [EMAIL PROTECTED] Subject: Re: [PHP-DB] Inventory Management for ecommerce store From: Aaron Wolski [EMAIL PROTECTED] Friday, May 21, 2004 10:52 AM Subject: [PHP-DB] Inventory Management for ecommerce store I'm looking for some advise/login on developing an Inventory Management system for an ecommerce store and what pitfalls one needs to be on the lookout for. You should have at least two ways to indentify each stock item, a unique item number (auto increment) and a displayed value (catalog number). All of the inventory records are always keyed by the unique item number. This allows one to change catalog numbers easily without effecting keys. You may want more fields such as manufacturers item number, and UPC code. As for inventory counts, here's what I do. I have 3 fields: quantity-on-hand, quantity-committed-to-orders, quantity-sold quantity available is calculated: quantity-available = quantity-on-hand - quantity-committed-to-orders When an order is created, the quantity-committed-to-orders is incremented by the order-quantity. When an order shipped, the quantity-committed-to-orders, and the quantity-on-hand are decremented by the order quantity. The quantity sold is incremented. If an order is canceled, decrement the quanity-committed-to-orders. In this way, you always know what the quantity in stock is, and you know how much of that stock is allocated to orders. I also recommend an item ledger table that includes item number (unique), catalog number, trans type, quantity, order number, selling $, cost, who, when, why. Each transaction (order detail at ship, receipt of stock) is logged to the item ledger. The item ledger provides an audit trail for accounting and for you to answer question on what happened to inventory. Inventory adjustments (losses/gains) from physical inventory go there too. Order Lines should have the unique id, catalog number, qty, sale price, cost, actual tax (if taxed at this level). --- The future will be better tomorrow --- http://www.spiceplace.com/ -- PHP Database Mailing List (http
RE: [PHP-DB] Inventory Management for ecommerce store
-Original Message- From: Matt Schroebel [mailto:[EMAIL PROTECTED] What if I abandon my cart? Are you using transactions to make sure all updates are atomic? All cart records are stored to the database with a timestamp. On each call to the cart_script, I check to see if any records are older than 24 hours and if they are, I dump the quantity back into inventory and remove the entry from the DB. A -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] how to reuse DB results
Hi All, Got this logic problem I don't know how to solve. Is there any way I can make a call to the DB for some records. Display some info from a column or two say at the top of the page and then display the full result set in a while() loop? Right now, I am making two calls to the Db to get the data I need to display at the top of the page and then a second query to retrieve the full result set. I'm confused! Thanks for any help! Aaron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP based telco billing/accounting software
[OT] Hi all, I have a client who needs to implement telephone billing/account software for their clients. They're looking to have us develop a customize solution for them. However, I thought I'd check here and see if anyone knows of software (opensource or paid) that they could recommend me checking out to present to them as an alternative option. Any ideas? Thanks and my apologies for the OT post. Although, they would like it to be PHP based ;) Aaron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Dynamic Form?
Hi All, I've been given the task of developing a dynamic form for a client. When I say dynamic, I mean dynamic in that the client can use an administrative interface (back-end) to create the various form fields (and types) that get displayed on the front-end. Before I start brainstorming the DB and programming requirements, I'd take a stab to see if anyone knows of open source software that might do what I am looking for? Wheel reinvention is not high on my task list. Thanks so much! Aaron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Receiving a warning... no clue how to resolve it and need help badly :(
Hi Guys, I need help with this code I am about to paste. It works on a testing server running PHP 4.2.2 but not 4.3.2 Here is the error: Warning: array_merge_recursive(): recursion detected in /services2/webpages/r/i/rinkrake.com/public/test.php on line 26 Here is the code: ?php echo Generating results, this could take a minutebr; // Allow the script enough time to finish (lots of data, lots of loops) set_time_limit(999); // db connection $link = mysql_connect(xxx, xxx, xxx); mysql_select_db(xxx); // We need these queries to do our job $we_ordered_1 = mysql_query(select OrderTable.cart_id, CartTable.cart_id, CartTable.product_index from OrderTable, CartTable where CartTable.product_index = 1 and OrderTable.cart_id = CartTable.cart_id); $we_ordered_14 = mysql_query(select OrderTable.cart_id, CartTable.cart_id, CartTable.product_index from OrderTable, CartTable where CartTable.product_index = 14 and OrderTable.cart_id = CartTable.cart_id); $customers = mysql_query(select cart_id, first, last, email from OrderTable); // Compare cart_id's between customers who ordered product #1 and #14. If the customer // ordered #1 and not #14, put their cart_id in the $good_customers array and move on // to the next. while ($row1 = mysql_fetch_row($we_ordered_1)) { while ($row2 = mysql_fetch_row($we_ordered_14)) { if ($row1[0] != $row2[0]) { $temp[cust_id] = $row1[1]; $good_customers = array_merge_recursive($good_customers,$temp); } } mysql_data_seek($we_ordered_14,0); } // Free up some memory, reset things back to square one (just to be on the safe side) // and get rid of any duplicate items in our newly created array. mysql_free_result($we_ordered_1); mysql_free_result($we_ordered_14); unset ($temp); reset ($good_customers); $good_customers = array_unique($good_customers[cust_id]); // Fetch a customer, step through the $good_customers array and // compare the cart_id stored in $good_customers, if they match, // kick out a 'record' with the necessary data. while ($row3 = mysql_fetch_row($customers)) { foreach ($good_customers as $value) { if ($row3[0] == $value) { echo $row3[0]. | .$row3[1]. | .$row3[2]. | .$row3[3].br\n; } } } mysql_close($link); echo script language=JavaScriptalert(\Done!\);/script; ? CAN anyone help me resolve the problem? I know it has to do with a bug being fixed for array_merge_recursive but I don't know how to resolve the problem and get the results I need :-( Please help? Thanks so much!!! Aaron
RE: [PHP-DB] Unsure of how to perform query and results..
Hi John, Thanks for taking the time to respond. What am I trying to do? Well...I am trying to build a mailing list of previous customers WHO purchased product_id 1 but not product_id 14. I have the product items (id's) stored in the CartTable and I have customer info stored in the OrderTable. Using the same column of cart_id in both CartTable and OrderTable I am able to reference which cart items (id's) belong to each record in the OrderTable. What I did originally (that didn't work) was to select all records in the CartTable that matched product_id=1 and product_id!=14 then I used that information to reference against the OrderTable to grab the customer information I needed. The problem with my logic is that I did not take into account those who purchased one of the product_id's on ONE purchase and then came back the next day, week, year, etc and made another purchase for the other product_id which. I NEED to make sure that a customer HAS purchased product_id=1 and NOT product_id=14 at ANY time, regardless of a single or multiple orders. Does this make any sense? *sigh* Thanks again. Aaron -Original Message- From: CPT John W. Holmes [mailto:[EMAIL PROTECTED] Sent: November 20, 2003 4:34 PM To: Aaron Wolski; [EMAIL PROTECTED] Subject: Re: [PHP-DB] Unsure of how to perform query and results.. From: Aaron Wolski [EMAIL PROTECTED] I have data in a Db that looks something like: 14,[EMAIL PROTECTED],Andrew,Smith 1,[EMAIL PROTECTED],Andrew,Smith 14,[EMAIL PROTECTED],Barbara,Richardson 1,[EMAIL PROTECTED],Barbara,Richardson The number represents a product_id that was purchased by the customer in question. As you can see from this example.. I have a two customers who purchased two different products. What I NEED to do is have one entry for each customer but with both their product_id in the same result. For example: 14,1,[EMAIL PROTECTED],Andrew,Smith ANY clue how I could go about getting this to work? I'm very desperate and running out of time :-( Sorry, it's not going to happen and besides, there isn't any reason you should need to return a row like that. How about you tell us what you're actually trying to do and someone can help you clean up your method... ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Unsure of how to perform query and results..
Hi Guys, I have data in a Db that looks something like: 14,[EMAIL PROTECTED],Andrew,Smith 1,[EMAIL PROTECTED],Andrew,Smith 14,[EMAIL PROTECTED],Barbara,Richardson 1,[EMAIL PROTECTED],Barbara,Richardson The number represents a product_id that was purchased by the customer in question. As you can see from this example.. I have a two customers who purchased two different products. What I NEED to do is have one entry for each customer but with both their product_id in the same result. For example: 14,1,[EMAIL PROTECTED],Andrew,Smith ANY clue how I could go about getting this to work? I'm very desperate and running out of time :-( Thanks so much! Aaron
RE: [PHP-DB] Current page url
$_SERVER['PHP_SELF'] http://ca.php.net/reserved.variables There are many others you could use as well. HTH Aaron -Original Message- From: Hugh Dickinson [mailto:[EMAIL PROTECTED] Sent: November 19, 2003 7:34 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Current page url is there any way to determine the url of the current page. The idea is to make a generic 'quickpoll' which posts to the page from which it was activated Regards Hugh Dickinson -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Upload multiple files?
Well... Having never done this I would assume it's the same with and form field you want to use as an array (multiple selections). Create a few different fileselect fields all with the same name but adding in [] to make it an array. Then just loop through the array.. copying the file to the server and the filename info to the DB. Rather simplistic I know but it's a solution. HTH Aaron -Original Message- From: Chris Payne [mailto:[EMAIL PROTECTED] Sent: August 29, 2003 5:38 PM To: php Subject: [PHP-DB] Upload multiple files? Hi there everyone, I have created a newsletter system where you can do lots of nice things, one of the things is to be able to upload your images for the newsletter via the interface, unfortunately you have to do them 1 at a time. Is it possible to be able to select multiple images in 1 go? The image info is stored in a DB and the images themselves are on the server, this way I can do lots of nice things to manage the images that have been uploaded without having to access the filesystem too much (I love PHP and MySQL, makes it so easy). Thanks everyone. Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Upload multiple files?
The other option is... You create a pop-up menu system. That have the file form field to select from a location. When you upload the image it populates a HTML display table so you can see it and also allows you to select another image. When you are done.. you close the pop-up menu and that's that! You got options. Just a matter of how much time you wanna invest ;) Aaron -Original Message- From: Chris Payne [mailto:[EMAIL PROTECTED] Sent: August 29, 2003 5:45 PM To: php Subject: Re: [PHP-DB] Upload multiple files? Hi there, U you know what they say, keep it simple and you're probably right you know, I was thinking it would be more complex but i'll have a play with that idea (Isn't it amazing how sometime we try to make things harder for ourselves than they need be?). Thanks for pointing that solution out, it SHOULD work :-) Chris Well... Having never done this I would assume it's the same with and form field you want to use as an array (multiple selections). Create a few different fileselect fields all with the same name but adding in [] to make it an array. Then just loop through the array.. copying the file to the server and the filename info to the DB. Rather simplistic I know but it's a solution. HTH Aaron -Original Message- From: Chris Payne [mailto:[EMAIL PROTECTED] Sent: August 29, 2003 5:38 PM To: php Subject: [PHP-DB] Upload multiple files? Hi there everyone, I have created a newsletter system where you can do lots of nice things, one of the things is to be able to upload your images for the newsletter via the interface, unfortunately you have to do them 1 at a time. Is it possible to be able to select multiple images in 1 go? The image info is stored in a DB and the images themselves are on the server, this way I can do lots of nice things to manage the images that have been uploaded without having to access the filesystem too much (I love PHP and MySQL, makes it so easy). Thanks everyone. Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Heop someone can help with this.. involves sessions.
Hi Guys, I really hope you don't mind the OT post but I've looked everywhere and can't seem to find a solution to my problem. I am passing a var in a session (not in the URL) to my secure checkout area and it's not capturing the variable. I know there is a problem with using sessions across non-SSL and SSL but I was hoping someone would have an idea as to how to accomplish this? Both domains are setup on the same box.. the secure SSL area is secure.mydomain.com Any ideas? Thanks! Aaron
[PHP-DB] timestamp formatting on display?
Hi All, Having a brain laps and not sure where in the manual to look and sadly I need a QUICK solution. I have a date formatted in a table like: 20030826132457 Now.. I went to MySQL timestamp from UNIX timestamps because I like the readability of them when just looking at the Tables. How would I format the date something like: August 26, 2003?? I could easily do this with a UNIX timestamp.. not sure if the same is possible with this type of timestamp. Also.. I can't use the MYSQL functions to format the data into a UNIX TimeStamp. not int his query. Any ideas? Thanks! Aaron
RE: [PHP-DB] Returning Results
Hi Richard, When you submit the form, why not have a hidden field in the form like: input type=hidden name=backtopage value=?php echo $_SERVER['PHP_SELF']; ? Then use that 'backtopage' variable in your script where you direct the results to. Or.. if you don't want to use a hidden field.. parse the URL to get the referrer? HTH Aaron -Original Message- From: Hutchins, Richard [mailto:[EMAIL PROTECTED] Sent: August 19, 2003 1:54 PM To: PHP-DB Subject: [PHP-DB] Returning Results OK, I'll apologize in advance if this is a little off topic, but I think it'll be close enough. I have a form (searchform.php) that collects data for a search (e.g., firstname, lastname). That form submits to a separate PHP script (search.php) that queries a database to find matching rows and returns the information in an array ($results). All pretty standard stuff and it all works. I know I while() the information in the resulting array ($results) to draw a table showing all of the results. But what that would require is the form (searchform.php) to collect the data and submit to the search.php script where HTML and PHP code combine in one file to perform the query and draw the results. I know how to do this and have done it in the past. However, this instance has a wrinkle to it. When the searchform.php form submits to search.php, I want to perform the query, but return the user (and the $results array) to searchform.php to display the results. I want to stress that I can get the information from the database with no problem. I'm just stuck on how to get the results back to the page that called the search.php script in the first place. Is turning search.php into a function and return-ing the results the only way to accomplish this? Because the only other idea I can come up with is using a header(Location:http://searchform.php?rs=$results;); statement and that doesn't seem to work (and logically, I can see why). I'm not asking for a total solution here because I can handle the whole solution myself. However I would appreciate a bump in the right direction in regards to how to architect the application logic. Thanks in advance, Rich Rich Hutchins -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] array issue
First, are you sure there is data in $my_array? Add this after you set the array: echo pre.print_r($my_array)./pre; You'll need to loop through the array , writing each line in the file at a time. Something like: //open the file stuff here foreach ($my_array AS $values) { fputs($fp, $value); } //close the file stuff here HTH Aaron -Original Message- From: OpenSource [mailto:[EMAIL PROTECTED] Sent: August 17, 2003 11:31 AM To: PHP-DB Subject: [PHP-DB] array issue Importance: High hi ya'll I am having a nightmare on this issue of mine. I've got this array that I need to write to a file... sample code below while (something); { query data base $r_ul=ifx_fetch_row($sideQuery4); $type1 = array($rotation.\n); switch ($r_ul['number']) { case '4'; $linea = $type1; break; } $final = $linea[0]; $my_array = array(); array_push ($my_array, $final); } $file = 'db_dump.dat'; $fp = fopen($file, w); fputs($fp, $my_array); --- I would like to write the complete array into the file fclose($fp); kindly assist with this issue.. Thanks in advance -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] array issue
Good point and nice find, Jeff! I wasn't sure where he was going with the data.. was he trying to save the actual array, intact, for say a chaching exercise or did he want to insert the contents of that array into a file? Could go either way I suppose :) Aaron P.S. Working on a Sunday too? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: August 17, 2003 11:48 AM To: Aaron Wolski Cc: 'PHP-DB'; 'OpenSource' Subject: RE: [PHP-DB] array issue This may or may not make sense for your issue. but if you have the whole array in memory you can serialize() it and write the string that the function returns to the file. $fp = fopen(yourfilename.txt, w); $my_array_s = serialize($my_array); if (isset($fp)) { fwrite($fp, $my_array_s); } //to get it back into the same array as it was written, use $fp_cache = fopen(yourfilename.txt, r) or die(can't open file); $fp_readc = fread($fp_cache, filesize(yourfilename.txt); $my_array_new = unserialize($fp_readc); the data is exactly as it was returned from the db after you looped through the record set. another idea. --http://www.php.net/manual/en/function.serialize.php hth jeff Aaron Wolski [EMAIL PROTECTED]To: 'OpenSource' [EMAIL PROTECTED], 'PHP-DB' [EMAIL PROTECTED] z.com cc: Subject: RE: [PHP-DB] array issue 08/17/2003 11:33 AM First, are you sure there is data in $my_array? Add this after you set the array: echo pre.print_r($my_array)./pre; You'll need to loop through the array , writing each line in the file at a time. Something like: //open the file stuff here foreach ($my_array AS $values) { fputs($fp, $value); } //close the file stuff here HTH Aaron -Original Message- From: OpenSource [mailto:[EMAIL PROTECTED] Sent: August 17, 2003 11:31 AM To: PHP-DB Subject: [PHP-DB] array issue Importance: High hi ya'll I am having a nightmare on this issue of mine. I've got this array that I need to write to a file... sample code below while (something); { query data base $r_ul=ifx_fetch_row($sideQuery4); $type1 = array($rotation.\n); switch ($r_ul['number']) { case '4'; $linea = $type1; break; } $final = $linea[0]; $my_array = array(); array_push ($my_array, $final); } $file = 'db_dump.dat'; $fp = fopen($file, w); fputs($fp, $my_array); --- I would like to write the complete array into the file fclose($fp); kindly assist with this issue.. Thanks in advance -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] array issue
Hey, That's what we're here for :) As for serialize? It's a great function if you need to preserve an array in its original form. Useful for sending back and forth between pages in the URL. Though, I'd never use on an open URL for the general public. Maybe in an Administration system not seen by many users. Aaron -Original Message- From: OpenSource [mailto:[EMAIL PROTECTED] Sent: August 17, 2003 12:28 PM To: Aaron Wolski Cc: PHP-DB; [EMAIL PROTECTED] Subject: Re: [PHP-DB] array issue Importance: High Hey guys thanks a lot your method worked perfect Aaron, thanks and that serialize() function, hummm i got to go do some reading and testing. thanks for enlightenment and the assistance guys. RedHat.OpenSource.bz - Original Message - From: Aaron Wolski [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: 'PHP-DB' [EMAIL PROTECTED]; 'OpenSource' [EMAIL PROTECTED] Sent: Sunday, August 17, 2003 10:04 AM Subject: RE: [PHP-DB] array issue Good point and nice find, Jeff! I wasn't sure where he was going with the data.. was he trying to save the actual array, intact, for say a chaching exercise or did he want to insert the contents of that array into a file? Could go either way I suppose :) Aaron P.S. Working on a Sunday too? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: August 17, 2003 11:48 AM To: Aaron Wolski Cc: 'PHP-DB'; 'OpenSource' Subject: RE: [PHP-DB] array issue This may or may not make sense for your issue. but if you have the whole array in memory you can serialize() it and write the string that the function returns to the file. $fp = fopen(yourfilename.txt, w); $my_array_s = serialize($my_array); if (isset($fp)) { fwrite($fp, $my_array_s); } //to get it back into the same array as it was written, use $fp_cache = fopen(yourfilename.txt, r) or die(can't open file); $fp_readc = fread($fp_cache, filesize(yourfilename.txt); $my_array_new = unserialize($fp_readc); the data is exactly as it was returned from the db after you looped through the record set. another idea. --http://www.php.net/manual/en/function.serialize.php hth jeff Aaron Wolski [EMAIL PROTECTED]To: 'OpenSource' [EMAIL PROTECTED], 'PHP-DB' [EMAIL PROTECTED] z.com cc: Subject: RE: [PHP-DB] array issue 08/17/2003 11:33 AM First, are you sure there is data in $my_array? Add this after you set the array: echo pre.print_r($my_array)./pre; You'll need to loop through the array , writing each line in the file at a time. Something like: //open the file stuff here foreach ($my_array AS $values) { fputs($fp, $value); } //close the file stuff here HTH Aaron -Original Message- From: OpenSource [mailto:[EMAIL PROTECTED] Sent: August 17, 2003 11:31 AM To: PHP-DB Subject: [PHP-DB] array issue Importance: High hi ya'll I am having a nightmare on this issue of mine. I've got this array that I need to write to a file... sample code below while (something); { query data base $r_ul=ifx_fetch_row($sideQuery4); $type1 = array($rotation.\n); switch ($r_ul['number']) { case '4'; $linea = $type1; break; } $final = $linea[0]; $my_array = array(); array_push ($my_array, $final); } $file = 'db_dump.dat'; $fp = fopen($file, w); fputs($fp, $my_array); --- I would like to write the complete array into the file fclose($fp); kindly assist with this issue.. Thanks in advance -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Don't know why query works this way
Here's some functions I use in my development which save on connect and query calls for me. //General Purpose Utilities. //db_connect connects to the database server and selects the proper database. //Arguments: None //Returns: Nothing function db_connect() { mysql_pconnect(localhost,username,password); mysql_select_db(Database); } //db_query queries the database server and returns the results. //Arguments: SQL query string //Returns: Query results function db_query($query) { return mysql_query($query); } //db_fetch returns the next set of results from a db_query. //Arguments: db_query results variable //Returns: Next set of query results as an array or 0 if no further results are present function db_fetch($results) { return mysql_fetch_array($results); } //db_numrows returns the number of rows selected from a query. //Arguments: query result //Returns: number of rows in the query result function db_numrows($result) { return mysql_num_rows($result); } //Always connect to the database! db_connect(); Keep these in an include file. The db_connect(); goes at the bottom and keep the connection open during the routines. To call db_query you would use it like: $someQuery = db_query(SELECT * from someTable ); to get the results out of the query you would call db_fetch and use it like: $someResult = db_fetch($someQuery); If you needed to return an array you would use it with a while or for statement like: While ($someResult = db_fetch($someQuery)) { } If you needed to get the number of rows from the query you'd use like: numRows = db_numrows($someQuery); or if (db_numrows($someQuery) ...) These are just some thing I use to make my life easier. Hope it helps -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: August 6, 2003 7:49 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Don't know why query works this way there are many ways to approach this. one is, select the db before any of this activity with mysql_select_db (dbname) then you can run as many queries against this database as you want. Until you call that function again with another db name, mysql with _always_ run against that database. hth jd Michael Cortes [EMAIL PROTECTED]To: [EMAIL PROTECTED] euf.net cc: Subject: [PHP-DB] Don't know why query works this way 08/05/2003 11:35 PM Please respond to cortesm I have been writing my queries like this... $link = mysql_connect ($host, $username, $password); $query = insert into $table ('joe', 15); if ( mysql_db_query($dbname, $query, $link)) { } But then I was reading that I should use mysl_query instead of mysql_db_query. But I was having a problem with where do i put the $dbname. When I used: mysql_query ($dbname, $query, $link) I got an error message saying i had too many arguments. So I changed it to: mysql_query ($query, $link) I then got an error message saying it didn't know what database I was connected to. I finally got around the problem by including the database name in the query, like so: $query = insert into $dbname.$table ('joe', 15); I shouldn't have to say, but this is a simplified example. I didn't want to include all the fields, tables, values that the true example has. The question is, am I doing this right? Do I have no choice but to retype the $dbname all over the place if I want to use mysql_query? Thank in advance for any help. -- Michael Cortes Fort LeBoeuf School District 34 East Ninth Street PO Box 810 Waterford PA 16441-0810 814.796.4795 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] incrementor in loop is not incrementing.. any thoughts?
Hi There, Yeah.. it was a copy paste Trying again: $threadQuery = db_query(SELECT id,type,colourID FROM kcs_threads WHERE id=.escapeValue($typeResult[id])); for ($i=0;$threadResult = db_fetch($threadQuery);$i++) { echo $threadResult[colourID]. .$i; } Output: 223 0 225 0 301 0 304 0 326 0 333 0 211 0 223 0 224 0 225 0 356 0 95 0 100HL 0 102 0 0 is equal to $i.. in other words - it is not incrementing. Sorry for the bad copy/paste. Hope this one is better. Aaron -Original Message- From: Matt Schroebel [mailto:[EMAIL PROTECTED] Sent: August 5, 2003 10:02 AM To: Aaron Wolski Subject: RE: [PHP-DB] incrementor in loop is not incrementing.. any thoughts? Is that a copy/paste? You're showing newlines which I don't see in the pasted code ... -Original Message- From: Aaron Wolski [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 05, 2003 9:58 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] incrementor in loop is not incrementing.. any thoughts? I have this: $threadQuery = db_query(SELECT id,type,colourID FROM kcs_threads WHERE id=.escapeValue($threadsResult[id])); for ($z=0;$threadResult = db_fetch($threadQuery);$z++) { echo $threadResult[colour]. .$z; } which is producing: 223 0 225 0 301 0 304 0 326 0 333 0 211 0 223 0 224 0 225 0 356 0 95 0 100HL 0 102 0 Obviously $z is not incrementing. ANY clue why? Thanks! Aaron Aaron Wolski, Project Manager Martek Business Solutions Inc. www.martekbiz.com http://www.martekbiz.com/ 905-780-9574 [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Don't know why query works this way
there are many ways to approach this. one is, select the db before any of this activity with mysql_select_db (dbname) then you can run as many queries against this database as you want. Until you call that function again with another db name, mysql with _always_ run against that database. hth jd Since Jeff was telling him there were many ways to accomplish what he wanted I figured I'd expand on what Jeff was saying and actually ILLUSTRATE with working code/examples of what the 'many way's are. Sorry if you found this to be Offtopic. Aaron -Original Message- From: Adam Alkins [mailto:[EMAIL PROTECTED] Sent: August 6, 2003 8:16 AM To: Aaron Wolski Cc: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Don't know why query works this way Quoting Aaron Wolski [EMAIL PROTECTED]: Here's some functions I use in my development which save on connect and query calls for me. //General Purpose Utilities. //db_connect connects to the database server and selects the proper database. //Arguments: None //Returns: Nothing function db_connect() { mysql_pconnect(localhost,username,password); mysql_select_db(Database); } //db_query queries the database server and returns the results. //Arguments: SQL query string //Returns: Query results function db_query($query) { return mysql_query($query); } //db_fetch returns the next set of results from a db_query. //Arguments: db_query results variable //Returns: Next set of query results as an array or 0 if no further results are present function db_fetch($results) { return mysql_fetch_array($results); } //db_numrows returns the number of rows selected from a query. //Arguments: query result //Returns: number of rows in the query result function db_numrows($result) { return mysql_num_rows($result); } //Always connect to the database! db_connect(); Keep these in an include file. The db_connect(); goes at the bottom and keep the connection open during the routines. To call db_query you would use it like: $someQuery = db_query(SELECT * from someTable ); to get the results out of the query you would call db_fetch and use it like: $someResult = db_fetch($someQuery); If you needed to return an array you would use it with a while or for statement like: While ($someResult = db_fetch($someQuery)) { } If you needed to get the number of rows from the query you'd use like: numRows = db_numrows($someQuery); or if (db_numrows($someQuery) ...) These are just some thing I use to make my life easier. Hope it helps Not to be rude... but what does that have to do with his question? -- Adam Alkins http://www.rasadam.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] incrementor in loop is not incrementing.. any thoughts?
I have this: $threadQuery = db_query(SELECT id,type,colourID FROM kcs_threads WHERE id=.escapeValue($threadsResult[id])); for ($z=0;$threadResult = db_fetch($threadQuery);$z++) { echo $threadResult[colour]. .$z; } which is producing: 223 0 225 0 301 0 304 0 326 0 333 0 211 0 223 0 224 0 225 0 356 0 95 0 100HL 0 102 0 Obviously $z is not incrementing. ANY clue why? Thanks! Aaron Aaron Wolski, Project Manager Martek Business Solutions Inc. www.martekbiz.com http://www.martekbiz.com/ 905-780-9574 [EMAIL PROTECTED]
RE: [PHP-DB] Sorting issue
Seeing code might help us. Aaron -Original Message- From: Jeff [mailto:[EMAIL PROTECTED] Sent: August 8, 2003 10:44 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Sorting issue Why would a mysql db think that 55 was greater than 14000. I have several headings that display sql data under them, when you click on the heading, it sorts that section (descending/ascending), but it only seems to be looking at the first two numbers in the one heading. Is there a command that forces it to look at the entire record before sorting it? Thanks Jeff -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] displaying result across 3 cells - where did I go wrong?
Hi All, I'm trying to display results across 3 cells - for example: #5 Perle Cotton 223 | 225 | 301 304 | 326 | 333 #12 Perle Cotton 211 | 223 | 224 225 | 356 | #4 Braid 95 | 100HL | 102 Right NOW it is displaying like: #5 Perle Cotton 223 | 225 301 | 304| 326 #12 Perle Cotton 211 | 223 224 | 225| 356 #4 Braid 95 | 100HL 102 This is the code I am working with: $z =0; while ($thread = db_fetch($tresult)) { // if z is divisible by 3 echo ($z %3 == 0) ? 'tr' : ''; if ($thread_type != $thread['type']) { echo td colspan=\3\{$thread[type]}/td\n; while($z++ %3 !==0) { // if not enough tds - add empty tds until end of tr echo 'tdnbsp;/td'; } // everytime we get here - we have just filled a tr with tds, // so start new tr and output type, then start another new tr echo '/trtrtd colspan=3 type /td/trtr'; $thread_type = $thread[type]; } echo 'td '.$thread[colourID].' /td'; // end the tr on every third cycle echo (++$z %3 == 0) ? '/tr' : ''; } The HTML looks like: tr /tr tr td colspan=3 #5 Perle Cotton /td /tr tr td 223 /td td 225 /td /tr tr td 301 /td td 304 /td td 326 /td /tr tr td 333 /td tdnbsp;/td tdnbsp;/td /tr tr td colspan=3 #12 Perle Cotton /td /tr tr td 211 /td td 223 /td /tr tr td 224 /td td 225 /td td 356 /td /tr tr /tr tr td colspan=3 #4 Braid /td /tr tr td 95 /td td 100HL /td /tr tr td 102 /td can ANYONE see where I have gone wrong? Any guidance is appreciated. Thanks! Aaron
RE: [PHP-DB] MySQL Returns Error
UNIQUE gradient (gradient) This is causing your issue. You have stated that new records cannot match an already established record with the same name under gradient. HTH Aaron -Original Message- From: Jeff [mailto:[EMAIL PROTECTED] Sent: August 5, 2003 1:44 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] MySQL Returns Error Ok, that worked, Now the error I'm getting is Duplicate entry ' ' for key 1 Is this a SQL table error? Here's my Table as entered: CREATE TABLE gradients ( gradient MEDIUMINT(10) DEFAULT '0' NOT NULL AUTO_INCREMENT, kwo VARCHAR(10) NOT NULL, lsd VARCHAR(10) NOT NULL, date DATE DEFAULT '-00-00' NOT NULL, well VARCHAR(50) NOT NULL, field VARCHAR(25) NOT NULL, uni VARCHAR(30) NOT NULL, license VARCHAR(10) BINARY NOT NULL, formation VARCHAR(20) NOT NULL, perfs VARCHAR(20) NOT NULL, event VARCHAR(1) NOT NULL, fluid VARCHAR(2) NOT NULL, mode VARCHAR(2) NOT NULL, type VARCHAR(2) NOT NULL, vhd VARCHAR(10) NOT NULL, file VARCHAR(15) NOT NULL, kb VARCHAR(6) NOT NULL, grd VARCHAR(10) NOT NULL, open VARCHAR(1) NOT NULL, sour VARCHAR(1) NOT NULL, tube VARCHAR(10) NOT NULL, landed VARCHAR(6) NOT NULL, casing VARCHAR(6) NOT NULL, landed2 VARCHAR(6) NOT NULL, shut_date VARCHAR(10) NOT NULL, shut_time DATE DEFAULT '-00-00' NOT NULL, pres VARCHAR(15) NOT NULL, tag VARCHAR(15) NOT NULL, PRIMARY KEY (lsd), UNIQUE gradient (gradient) ); Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Wednesday 06 August 2003 01:14, Jeff wrote: Well I did what you said, and now I get Parse error: parse error, unexpected T_ECHO in C:\FoxServ\www\encana_db.php on line 44 Try: $result = mysql_query($query, $link_id) OR die(mysql_error()); -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Byte your tongue. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] RE: query is returning over 74,000 results and taking 30 seconds - HELP!
Ok.. I echo'd out the queries AND the num_rows returned for each loop and this is what I got: Manufacturer Query is: SELECT DISTINCT manufacturer FROM kcs_threads ORDER BY manufacturer Manufacturer Rows Returned Are: 5 Left Join Query is: select t.type, t.newUrlType, g.threadType, g.groupName, g.groupNameUrl FROM kcs_threads t LEFT JOIN kcs_threadgroups g ON t.type = g.threadType WHERE t.manufacturer = 'DMC' ORDER BY t.type, g.groupName Left Join Rows Returned Are: 77022 Left Join Query is: select t.type, t.newUrlType, g.threadType, g.groupName, g.groupNameUrl FROM kcs_threads t LEFT JOIN kcs_threadgroups g ON t.type = g.threadType WHERE t.manufacturer = 'Gentle Arts Sampler Threads' ORDER BY t.type, g.groupName Left Join Rows Returned Are: 94 Left Join Query is: select t.type, t.newUrlType, g.threadType, g.groupName, g.groupNameUrl FROM kcs_threads t LEFT JOIN kcs_threadgroups g ON t.type = g.threadType WHERE t.manufacturer = 'Kreinik' ORDER BY t.type, g.groupName Left Join Rows Returned Are: 309 Left Join Query is: select t.type, t.newUrlType, g.threadType, g.groupName, g.groupNameUrl FROM kcs_threads t LEFT JOIN kcs_threadgroups g ON t.type = g.threadType WHERE t.manufacturer = 'Rainbow Gallery' ORDER BY t.type, g.groupName Left Join Rows Returned Are: 23 Left Join Query is: select t.type, t.newUrlType, g.threadType, g.groupName, g.groupNameUrl FROM kcs_threads t LEFT JOIN kcs_threadgroups g ON t.type = g.threadType WHERE t.manufacturer = 'The Caron Collection' ORDER BY t.type, g.groupName Left Join Rows Returned Are: 495 Total elapsed time = 21.905001 seconds. Total results: 77943 What do I make of this? I see where the bottle neck is.. but how to I refine the LEFT JOIN query to prevent this? For the DMC Left Join.. is should have returned: 2067 rows in set (1.63 sec) ANY idea's? Aaron -Original Message- From: Nelson Goforth [mailto:[EMAIL PROTECTED] Sent: August 4, 2003 2:16 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] RE: query is returning over 74,000 results and taking 30 seconds - HELP! Have you tried the MySQL EXPLAIN command to look at your statement? That can provide some insight when nothing else works. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] query works fine on console but not with PHP - why?
Hi guys, I have the following query which returns FINE through the console but not in PHP select t.id, t.colour, t.colourID, t.price, t.type, g.thread_index, g.groupNameUrl FROM kcs_threads t LEFT JOIN kcs_threadgroups g ON t.id = g.thread_index WHERE g.groupNameUrl = '0-500' The error I am getting on the browser is: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in http://www.martekbiz.com/KCS/utils.inc on line 52 Anyone have an idea as to what it up? Thanks! Aaron
RE: [PHP-DB] query works fine on console but not with PHP - why? SOLVED
Hi and thanks, Actually.. there was a typo in an if() statement just prior to it that checked to see if a variable was set before proceeding with the query. What a dumb-ass I am. You know you've been working way to long when you can't do simple things. Thanks for your comments! Aaron -Original Message- From: Matt [mailto:[EMAIL PROTECTED] Sent: August 3, 2003 10:11 AM To: Aaron Wolski; [EMAIL PROTECTED] Subject: Re: [PHP-DB] query works fine on console but not with PHP - why? - Original Message - From: Aaron Wolski [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, August 03, 2003 9:59 AM Subject: [PHP-DB] query works fine on console but not with PHP - why? The error I am getting on the browser is: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in http://www.martekbiz.com/KCS/utils.inc on line 52 Anyone have an idea as to what it up? Try: echo mysql_error(); and see what mysql says. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] ***SOLVED *** query works fine on console but not with PHP ***SOLVED***
Hi, Seem to still be getting responses to this question. I don't want people to take time out from what their doing to answer a question that is now solved. Just trying to help save some people the time and effort from their own development. Much appreciated answers though. They'll help me in future debugging. Thanks again to all. Aaron -Original Message- From: Aaron Wolski [mailto:[EMAIL PROTECTED] Sent: August 3, 2003 10:08 AM To: 'Matt'; '[EMAIL PROTECTED]' Subject: RE: [PHP-DB] query works fine on console but not with PHP - why? SOLVED Hi and thanks, Actually.. there was a typo in an if() statement just prior to it that checked to see if a variable was set before proceeding with the query. What a dumb-ass I am. You know you've been working way to long when you can't do simple things. Thanks for your comments! Aaron -Original Message- From: Matt [mailto:[EMAIL PROTECTED] Sent: August 3, 2003 10:11 AM To: Aaron Wolski; [EMAIL PROTECTED] Subject: Re: [PHP-DB] query works fine on console but not with PHP - why? - Original Message - From: Aaron Wolski [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, August 03, 2003 9:59 AM Subject: [PHP-DB] query works fine on console but not with PHP - why? The error I am getting on the browser is: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in http://www.martekbiz.com/KCS/utils.inc on line 52 Anyone have an idea as to what it up? Try: echo mysql_error(); and see what mysql says. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] make 2 queries into one?
Hi All, Been trying to come up with a way to make the following queries into one which would speed up the processing I think. Code: $mQuery = db_query(SELECT manufacturer FROM kcs_threads GROUP BY manufacturer ORDER BY manufacturer); while ($mResult = db_fetch($mQuery)) { $query = select t.type, t.newUrlType, g.threadType, g.groupName, g.groupNameUrl FROM kcs_threads t LEFT JOIN kcs_threadgroups g ON t.type = g.threadType WHERE t.manufacturer = .escapeQuote($mResult['manufacturer']). ORDER BY t.type, g.groupName; $result = db_query($query); while($thread = db_fetch($result)) { } } In the first query I am grabbing the Manufacturer from the threads table. Then in the second query I am making a LEFT JOIN to match up some stuff based on the t.manufactuer equalling the manufacturer of the first query. ANY possibilities here or is this it? Thanks! Aaron
[PHP-DB] Regular Expressions? URGENT
Hi All, Sorry for OT post but need some info. Does anyone know a good tutorial that explains regular expressions in DUMMY terms? I have a list of characters that I need to check to see if they are in a string. I tried creating an array of the characters but some of them are like ' and ` which seem to cause some problems. Any good turotials for regular expressions? Thanks a bunch! Aaron
RE: [PHP-DB] updating a column based on info from another coluimn? Desperate!
Hey hey, Works like a charm. I have have my urls looking like The+Man+on+The+Moon Seems weird, however, PHP automatically strips out the +'s? cause when I echo the variable I get The Man On The Moon. Idea's? Also.. ANYWAY to make the +'s into -'s (hyphens)??? Thanks!! Aaron -Original Message- From: Hutchins, Richard [mailto:[EMAIL PROTECTED] Sent: July 31, 2003 3:21 PM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] updating a column based on info from another coluimn? Desperate! Will urldecode() work for you on the PHP side or do you have to convert everything in the database? http://us4.php.net/manual/en/function.urldecode.php -Original Message- From: Aaron Wolski [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2003 3:14 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] updating a column based on info from another coluimn? Desperate! Hi All, This is OT but I am in need of serious help. I am rewriting URL's for a site and came across an issue with spaces in URLS having %20 applied to them. I can't seem to find a solution with mod_rewrite to get rid of the %20 and replace with - (hyphen) so I am hoping someone can help me here with an MySQL solution. I have over 4000 records in a table. I've added a new column in that table called newUrl Is it possible with a QUERY to take from the 'designers' column and write into the 'newUrl' column and replace spaces with - at the same time? I'm probably talking out my a$$ here but I am a little desperate for a solutions. Thanks in advance and again my apologies for the OT message. Aaron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] alphabetical sorting... limiting and paginating onnext set of letter group
Alrighty.. Working with your code and some others I've come up with this: ?php if ($sort) { $list = explode(-, $sort); } $test = Array('A-D', 'D-G', 'G-J', 'J-M', 'M-P', 'P-S', 'S-V', 'V-Y', 'Y-Z'); foreach ($test as $group) { if (strtolower ($group) != $sort) { $lgroup = strtolower ($group); echo a href=\patterns.php?sort={$lgroup}\{$group}/abr /; } } $designerQuery = db_query(SELECT designer FROM kcs_patterns WHERE designer BETWEEN '.$list[0].' and '.$list[1].' GROUP BY designer ORDER BY designer); while ($designerResult = db_fetch($designerQuery)) { ? img src=Graphics/spacer.gif width=10 height=1a href=font class=catalogueSubCatLink?php echo $designerResult['designer']; ? Designers/font/abr ?php } ? This works as I need it to.. shifting from one set of results to another. My problem is how do I format it like the following(assuming A-D was selected): A-D Designers Artists Collection The Barrick Samplers Bent Creek Brown House Studio Butternut Road Calico Crossroads Canterbury Cross My Heart Crossed Wing Collection D-G G-J J-M M-P P-S S-V V-Y Y-Z Or if D-G was selected: A-D D-G Designers Datta Bonnie Design Connection Design Connection The DMC Donna Gallagher Creative Needlearts Dragon Dreams Family Tree The Fanci That Full Circle Designs G-J J-M M-P P-S S-V V-Y Y-Z I've tried a few placements of the foreach loop but nothing seems to work. Any ideas? Thanks! -Original Message- From: Ramil G. Sagum [mailto:[EMAIL PROTECTED] Sent: July 29, 2003 11:38 PM To: [EMAIL PROTECTED] Cc: Aaron Wolski Subject: RE: [PHP-DB] alphabetical sorting... limiting and paginating onnext set of letter group On Wed, 2003-07-30 at 11:17, Aaron Wolski wrote: Hey, Thanks. Is there anyway this can be performed one function/loop? yes of course. =) just create a function that takes in two letters as a parameter, then build the query string from it. function($char_begin, $char_end) { $q_begin = strtolower($char_begin); $q_end = chr(ord(strtolower($char_begin))+1); $query = SELECT designer_name FROM designer WHERE designer_name BETWEEN '.$q_begin.' AND '.$q_end.' ORDER BY designer_name; //do your query here. } I knew it was possible with several queries.. I guess I was just looking for a all_in_one solution. Thanks for your help! Aaron -Original Message- From: Ramil G. Sagum [mailto:[EMAIL PROTECTED] Sent: July 29, 2003 11:07 PM To: Aaron Wolski Subject: Re: [PHP-DB] alphabetical sorting... limiting and paginating onnext set of letter group On Wed, 2003-07-30 at 10:36, Aaron Wolski wrote: Hi Guys, What I would like to do is: Pattern Designers: A/B/C Artists Collection The Barrick Samplers Bent Creek Bobbie G. Designs Calico Crossroads Charland Designs Country Cross Stitch Click for D/E/F Click for G/H/I Click for J/K/L When the user clicks on one of the another Letter Groupings... the A/B/C changes to whatever they selected as does the displayed results for their selection. Is this even possible? Aaron yes it is. =) try for a/b/c SELECT designer_name FROM designer WHERE designer_name BETWEEN 'a' AND 'd' ORDER BY designer_name; for d/e/f : SELECT designer_name FROM designer WHERE designer_name BETWEEN 'd' AND 'g' ORDER BY designer_name; for j/k/l: SELECT designer_name FROM designer WHERE designer_name BETWEEN 'j' AND 'm' ORDER BY designer_name; hope this helps. ramil -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] alphabetical sorting... limiting and paginating onnext set of letter group
Sorry all but getting kinda desparate here :( Trying a few different things and still nothing seems to work. Does anyone have a kick in the right direction that I could explore here? Sorry for the repost. Thanks Aaron -Original Message- From: Aaron Wolski [mailto:[EMAIL PROTECTED] Sent: July 30, 2003 9:47 AM To: '[EMAIL PROTECTED]'; '[EMAIL PROTECTED]' Subject: RE: [PHP-DB] alphabetical sorting... limiting and paginating onnext set of letter group Alrighty.. Working with your code and some others I've come up with this: ?php if ($sort) { $list = explode(-, $sort); } $test = Array('A-D', 'D-G', 'G-J', 'J-M', 'M-P', 'P-S', 'S-V', 'V-Y', 'Y-Z'); foreach ($test as $group) { if (strtolower ($group) != $sort) { $lgroup = strtolower ($group); echo a href=\patterns.php?sort={$lgroup}\{$group}/abr /; } } $designerQuery = db_query(SELECT designer FROM kcs_patterns WHERE designer BETWEEN '.$list[0].' and '.$list[1].' GROUP BY designer ORDER BY designer); while ($designerResult = db_fetch($designerQuery)) { ? img src=Graphics/spacer.gif width=10 height=1a href=font class=catalogueSubCatLink?php echo $designerResult['designer']; ? Designers/font/abr ?php } ? This works as I need it to.. shifting from one set of results to another. My problem is how do I format it like the following(assuming A-D was selected): A-D Designers Artists Collection The Barrick Samplers Bent Creek Brown House Studio Butternut Road Calico Crossroads Canterbury Cross My Heart Crossed Wing Collection D-G G-J J-M M-P P-S S-V V-Y Y-Z Or if D-G was selected: A-D D-G Designers Datta Bonnie Design Connection Design Connection The DMC Donna Gallagher Creative Needlearts Dragon Dreams Family Tree The Fanci That Full Circle Designs G-J J-M M-P P-S S-V V-Y Y-Z I've tried a few placements of the foreach loop but nothing seems to work. Any ideas? Thanks! -Original Message- From: Ramil G. Sagum [mailto:[EMAIL PROTECTED] Sent: July 29, 2003 11:38 PM To: [EMAIL PROTECTED] Cc: Aaron Wolski Subject: RE: [PHP-DB] alphabetical sorting... limiting and paginating onnext set of letter group On Wed, 2003-07-30 at 11:17, Aaron Wolski wrote: Hey, Thanks. Is there anyway this can be performed one function/loop? yes of course. =) just create a function that takes in two letters as a parameter, then build the query string from it. function($char_begin, $char_end) { $q_begin = strtolower($char_begin); $q_end = chr(ord(strtolower($char_begin))+1); $query = SELECT designer_name FROM designer WHERE designer_name BETWEEN '.$q_begin.' AND '.$q_end.' ORDER BY designer_name; //do your query here. } I knew it was possible with several queries.. I guess I was just looking for a all_in_one solution. Thanks for your help! Aaron -Original Message- From: Ramil G. Sagum [mailto:[EMAIL PROTECTED] Sent: July 29, 2003 11:07 PM To: Aaron Wolski Subject: Re: [PHP-DB] alphabetical sorting... limiting and paginating onnext set of letter group On Wed, 2003-07-30 at 10:36, Aaron Wolski wrote: Hi Guys, What I would like to do is: Pattern Designers: A/B/C Artists Collection The Barrick Samplers Bent Creek Bobbie G. Designs Calico Crossroads Charland Designs Country Cross Stitch Click for D/E/F Click for G/H/I Click for J/K/L When the user clicks on one of the another Letter Groupings... the A/B/C changes to whatever they selected as does the displayed results for their selection. Is this even possible? Aaron yes it is. =) try for a/b/c SELECT designer_name FROM designer WHERE designer_name BETWEEN 'a' AND 'd' ORDER BY designer_name; for d/e/f : SELECT designer_name FROM designer WHERE designer_name BETWEEN 'd' AND 'g' ORDER BY designer_name; for j/k/l: SELECT designer_name FROM designer WHERE designer_name BETWEEN 'j' AND 'm' ORDER BY designer_name; hope this helps. ramil -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] alphabetical sorting... limiting and paginating on next set of letter group
Hi Guys, Rather long topic I know. Sorry if it annoyed anyone. Hopefully someone can help here with the logic on this. I have a query where I am getting one column (designers) in a Table, ordered alphabetically. Right now.. this query is displaying EVERY distinct result (45 in total). This result is used for a subcategory menu on a page. I need to shorten this up considerably. What I would like to do is: Pattern Designers: A/B/C Artists Collection The Barrick Samplers Bent Creek Bobbie G. Designs Calico Crossroads Charland Designs Country Cross Stitch Click for D/E/F Click for G/H/I Click for J/K/L When the user clicks on one of the another Letter Groupings... the A/B/C changes to whatever they selected as does the displayed results for their selection. Is this even possible? Thanks! Aaron
RE: [PHP-DB] how to get records from one table that are not in another table
I'd suggest you pick up an SQL book or do some more reading if you don't understand that. -- ---John Holmes... John, Do you have a good book recommendation for MySQL.. I'm looking for more knowledge on improving my queries, etc. LEFT JOINS were completely unfamiliar (still are) until you helped me with my 3 query into 1 problem I had last week. Any thoughts? Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ PHP|Architect: A magazine for PHP Professionals - www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] query and display acting weird...
Hi Guys, Code: echo select name=\patternThreads[]\ size=\10\ multiple style=\font-family:monospace;\\n; $query = select t.manufacturer, t.id, t.colour, t.colourID, t.type, p.thread_index FROM kcs_threads t LEFT JOIN kcs_patternthreads p ON t.id = p.thread_index WHERE p.pattern_index = '$id' OR p.pattern_index IS NULL ORDER BY t.colourID; $thread_manufacturer = ''; $result = db_query($query); while($thread = db_fetch($result)) { if($thread_manufacturer != $thread['manufacturer']) { echo option value=\\ class=\adminEditLink\{$thread['manufacturer']}/option\n; $thread_manufacturer = $thread['manufacturer']; } } echo /select\n; In my select box I am getting results like: Canterbury Cross Fabrics Zweigart Permin Zweigart I SHOULD be getting: Canterbury Cross Fabrics Zweigart Permin This was once working.. as it should have but today more data was dumped into the table which is causing the second Zweigart to be displayed. If I group the manufacturer in the query then I only one record displayed for the corresponding manufacturers. Any clue how I can make it so that everything is sorted under grouped manufacturers but still get ALL the results for the manufacturer at the same time? Have over 4000 records which was causing a LONG loading time in the browser so John Holmes gave me the above query to replace where I had 3 queries doing the same thing. ANY thoughts would be greatly welcomed! Thanks Aaron
[PHP-DB] dynamic radio buttons.. checked or not?
Hi Guys.. hopefully someone can help with this. Code: $query = select t.id, t.thread_index, t.pattern_index, t.avail, p.id, p.type, p.colour, p.colourID, p.manufacturer FROM kcs_patternthreads t LEFT JOIN kcs_threads p ON t.thread_index = p.id WHERE t.pattern_index = $id; $thread_manufacturer = ''; $result = db_query($query); while($thread = db_fetch($result)) { if($thread_manufacturer != $thread['manufacturer']) { echo tr valign=\top\\n; echo td colspan=\2\font class=\adminHeader\Threads:/font font class=\adminSelectBox\{$thread['manufacturer']}/font/td\n; echo /tr\n; $thread_manufacturer = $thread['manufacturer']; } $thread_colourID = str_pad($thread['colourID'], 8, , STR_PAD_RIGHT); $thread_type = str_pad($thread['type'], 20, , STR_PAD_RIGHT); $thread_colour = str_pad($thread['colour'], 20, , STR_PAD_RIGHT); $thread_colourID = str_replace( ,nbsp;, $thread_colourID); $thread_type = str_replace( ,nbsp;, $thread_type); $thread_colour = str_replace( ,nbsp;, $thread_colour); echo tr valign=\middle\\n; echo td colspan=\2\ style=\font-family:monospace;color: #696565;font-size: 9pt;\{$thread_colourID}{$thread_type}{$thread_colour}Available to Order: nbsp;Yesinput type=\radio\ name=\avail\ value=\1\; if ($thread[avail] == 1) echo checked; //is this record available? echo nbsp;nbsp;nbsp;Noinput type=\radio\ name=\avail\ value=\0\; if ($thread[avail] == 0) echo checked; //is this record not available? echo /td\n; echo/tr\n; } END CODE Everything on this script works except the radio button checked part. What's supposed to happen is if $thread[avail] == 1 then display the YES radio as checked for that record and if $thread[avail] == 0 then display the NO radio as checked for that record. I did an echo on $thread[avail] and I get the correct values: 0 1 0 Does anyone have a clue as to my problem here? Thanks in advance! Aaron
RE: [PHP-DB] Line of code should work...but doesn't
if (strftime(%H) == 03) { header( Location: maintainence.php ); exit; } Note the exit; line. Aaron -Original Message- From: J. Michael Roberts [mailto:[EMAIL PROTECTED] Sent: July 24, 2003 10:09 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Line of code should work...but doesn't I've been going a little crazy here with a single line of code that should work, but doesn't. It's probably has something to do with the fact that I've been staring at pages of code for months on end. In order to make user that nobody is screwing with the database while the daily backups and maintainence are running, I decided to make a little thing that would keep people from logging in, etc. Here's the line: if (strftime(%H) == 03) { header( Location: maintainence.php ); } In theory, if it's any time between 03:00:00 and 03:59:59 the user should be redirected to the page maintainence.php, but when testing it passes over this line without a blip. Any ideas? Feeling fried, --JMR -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Line of code should work...but doesn't
Hmm.. interesting. I never use a full URI unless I am directing to a secure server and things always work on my end. Works either way I guess? Aaron -Original Message- From: Hutchins, Richard [mailto:[EMAIL PROTECTED] Sent: July 24, 2003 10:34 AM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Line of code should work...but doesn't I'll admit right up front that this is an educated guess, but I think you need to provide an absolute path for the location. header(Location: http://yoursite/yourdir/maintenance.php;); Quoted from the online docs: Note: HTTP/1.1 requires an absolute URI as argument to Location: including the scheme, hostname and absolute path, but some clients accept relative URIs. You can usually use $_SERVER['HTTP_HOST'], $_SERVER['PHP_SELF'] and dirname() to make an absolute URI from a relative one yourself. I use header() for redirects all the time as well and have always made a habit of using a fully qualified URI just because the docs said so. Never tried any other way so I've never had any problems with it. Hope this helps. Rich -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, July 24, 2003 10:29 AM To: Aaron Wolski Cc: 'J. Michael Roberts'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Line of code should work...but doesn't this may work, but i hesitate, i've _never_ had to use exit to get my code to excecute a redirect. and i'm heavily reliant on this function. did aarons fix work for you? i think you're problem lies elsewhere. as i've just mocked the same thing on my server, but using 10 instead of 03...i'm on EST and its excecutes perfectly. don't mean to cause waves...just curious. Jeff Aaron Wolski [EMAIL PROTECTED]To: 'J. Michael Roberts' [EMAIL PROTECTED], [EMAIL PROTECTED] z.com cc: Subject: RE: [PHP-DB] Line of code should work...but doesn't 07/24/2003 10:12 AM if (strftime(%H) == 03) { header( Location: maintainence.php ); exit; } Note the exit; line. Aaron -Original Message- From: J. Michael Roberts [mailto:[EMAIL PROTECTED] Sent: July 24, 2003 10:09 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Line of code should work...but doesn't I've been going a little crazy here with a single line of code that should work, but doesn't. It's probably has something to do with the fact that I've been staring at pages of code for months on end. In order to make user that nobody is screwing with the database while the daily backups and maintainence are running, I decided to make a little thing that would keep people from logging in, etc. Here's the line: if (strftime(%H) == 03) { header( Location: maintainence.php ); } In theory, if it's any time between 03:00:00 and 03:59:59 the user should be redirected to the page maintainence.php, but when testing it passes over this line without a blip. Any ideas? Feeling fried, --JMR -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] why script only updating one table?
Hi All, I have a form that passes to select box array to my script. Select boxes are named: patternThreads[] and patternFabrics[] My Script: //Check to see if Threads were selected for this pattern if ($patternThreads) { if (is_array($patternThreads)) { $str_threads = implode(,,$patternThreads); } else { $str_threads = $patternThreads; } $threadsArray = explode(,,$str_threads); for ($i=0;$isizeof($threadsArray);$i++) { //Grab a listing of all threads currently in the DB //associated with the pattern $allthreadsQuery = db_query(SELECT id FROM kcs_patternthreads WHERE pattern_index='$id' AND thread_index=.escapeValue($threadsArray[$i])); //Does a record already exist? if (db_numrows($allthreadsQuery) 1) { //No? Insert a new record for each new keyword selected db_query(INSERT INTO kcs_patternthreads (id,pattern_index,thread_index,avail) VALUES ('','$id',.escapeValue($threadsArray[$i]).,'0')); } } //Check to see if a thread was unchecked. //If so, delete entry from DB $db_threads1 = db_query(SELECT * FROM kcs_patternthreads WHERE pattern_index='$id'); while($db_threads2 = db_fetch($db_threads1)) $db_threads[] = $db_threads2[thread_index]; foreach($db_threads AS $thread) { if(!in_array($thread, $threadsArray)) db_query(DELETE FROM kcs_patternthreads WHERE pattern_index='$id' AND thread_index='$thread'); } } //Check to see if fabrics were selected for this pattern if ($patternFabrics) { if (is_array($patternFabrics)) { $str_fabrics = implode(,,$patternFabrics); } else { $str_fabrics = $patternFabrics; } $fabricsArray = explode(,,$str_fabrics); for ($i=0;$isizeof($fabricsArray);$i++) { //Grab a listing of all fabrics currently in the DB //associated with the pattern $allfabricsQuery = db_query(SELECT id FROM kcs_patternfabrics WHERE pattern_index='$id' AND fabric_index=.escapeValue($fabricsArray[$i])); //Does a record already exist? if (db_numrows($allfabricsQuery) 1) { //No? Insert a new record for each new keyword selected db_query(INSERT INTO kcs_patternfabrics (id,pattern_index,fabric_index,avail) VALUES ('','$id',.escapeValue($fabricsArray[$i]).,'0')); } } //Check to see if a fabric was unchecked. //If so, delete entry from DB $db_fabrics1 = db_query(SELECT * FROM kcs_patternfabrics WHERE pattern_index='$id'); while($db_fabrics2 = db_fetch($db_fabrics1)) $db_fabrics[] = $db_fabrics2[fabric_index]; foreach($db_fabrics AS $fabric) { if(!in_array($fabric, $fabricsArray)) db_query(DELETE FROM kcs_patternfabrics WHERE pattern_index='$id' AND fabric_index='$fabric'); } } The scrip is supposed to see if either select box contains data and then process the data. Does anyone understand why it would be updating only one table at a time and not both at the same time? It should be updating both at the same time! NOTE: if I remove the processing code for either select box it works without problem. They just don't seem to work together. Thanks! Aaron
RE: [PHP-DB] why script only updating one table? SOLVED
Hi Guys, No need to think about this. I solved the problem by putting both scripts under one check If ($patternThreads || $patternFabrics) { //DO STUFF HERE } Aaron -Original Message- From: Aaron Wolski [mailto:[EMAIL PROTECTED] Sent: July 22, 2003 10:34 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] why script only updating one table? Hi All, I have a form that passes to select box array to my script. Select boxes are named: patternThreads[] and patternFabrics[] My Script: //Check to see if Threads were selected for this pattern if ($patternThreads) { if (is_array($patternThreads)) { $str_threads = implode(,,$patternThreads); } else { $str_threads = $patternThreads; } $threadsArray = explode(,,$str_threads); for ($i=0;$isizeof($threadsArray);$i++) { //Grab a listing of all threads currently in the DB //associated with the pattern $allthreadsQuery = db_query(SELECT id FROM kcs_patternthreads WHERE pattern_index='$id' AND thread_index=.escapeValue($threadsArray[$i])); //Does a record already exist? if (db_numrows($allthreadsQuery) 1) { //No? Insert a new record for each new keyword selected db_query(INSERT INTO kcs_patternthreads (id,pattern_index,thread_index,avail) VALUES ('','$id',.escapeValue($threadsArray[$i]).,'0')); } } //Check to see if a thread was unchecked. //If so, delete entry from DB $db_threads1 = db_query(SELECT * FROM kcs_patternthreads WHERE pattern_index='$id'); while($db_threads2 = db_fetch($db_threads1)) $db_threads[] = $db_threads2[thread_index]; foreach($db_threads AS $thread) { if(!in_array($thread, $threadsArray)) db_query(DELETE FROM kcs_patternthreads WHERE pattern_index='$id' AND thread_index='$thread'); } } //Check to see if fabrics were selected for this pattern if ($patternFabrics) { if (is_array($patternFabrics)) { $str_fabrics = implode(,,$patternFabrics); } else { $str_fabrics = $patternFabrics; } $fabricsArray = explode(,,$str_fabrics); for ($i=0;$isizeof($fabricsArray);$i++) { //Grab a listing of all fabrics currently in the DB //associated with the pattern $allfabricsQuery = db_query(SELECT id FROM kcs_patternfabrics WHERE pattern_index='$id' AND fabric_index=.escapeValue($fabricsArray[$i])); //Does a record already exist? if (db_numrows($allfabricsQuery) 1) { //No? Insert a new record for each new keyword selected db_query(INSERT INTO kcs_patternfabrics (id,pattern_index,fabric_index,avail) VALUES ('','$id',.escapeValue($fabricsArray[$i]).,'0')); } } //Check to see if a fabric was unchecked. //If so, delete entry from DB $db_fabrics1 = db_query(SELECT * FROM kcs_patternfabrics WHERE pattern_index='$id'); while($db_fabrics2 = db_fetch($db_fabrics1)) $db_fabrics[] = $db_fabrics2[fabric_index]; foreach($db_fabrics AS $fabric) { if(!in_array($fabric, $fabricsArray)) db_query(DELETE FROM kcs_patternfabrics WHERE pattern_index='$id' AND fabric_index='$fabric'); } } The scrip is supposed to see if either select box contains data and then process the data. Does anyone understand why it would be updating only one table at a time and not both at the same time? It should be updating both at the same time! NOTE: if I remove the processing code for either select box it works without problem. They just don't seem to work together. Thanks! Aaron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] passing array data back to form in header?
Hi Guys, the topic pretty much covers it. I have a script and if it errors out.. I send a bunch of values back to the form. I'm having difficulity figuring out how to pass array data that is/was selected back to the form. I can send the non array values no problem - eg: header(Location: patternsedit.php?error=1id=.rawurlencode($id). designer=.rawurlencode($designer). name=.rawurlencode($name). overallDesc=.rawurlencode($overallDesc). patternsColumn=.rawurlencode($patternsColumn). patternsName=.rawurlencode($patternsName). price=.rawurlencode($price). alt1Title=.rawurlencode($alt1Title). alt1Desc=.rawurlencode($alt1Desc). alt2Title=.rawurlencode($alt2Title). alt2Desc=.rawurlencode($alt2Desc). alt3Title=.rawurlencode($alt3Title). alt3Desc=.rawurlencode($alt3Desc). alt4Title=.rawurlencode($alt4Title). alt4Desc=.rawurlencode($alt4Desc). alt5Title=.rawurlencode($alt5Title). alt5Desc=.rawurlencode($alt5Desc)); exit; No clue how to add array data to the above and then integrated it back with a form? Any thoughts? Thanks! Aaron
RE: [PHP-DB] speeing up query and display...
John, I got it and it seems to work wonderfully. When you mentioned doing the whole process in one query I was sure a LEFT JOIN was going to be involved but to be honest.. I do not understand LEFT JOINS in the least.. where to apply them and why. Thanks so much for taking your valuable time to help. I am sure I'll be able to learn from what you've provided to take my developments that much further. Thanks once again. Aaron -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED] Sent: July 20, 2003 4:48 PM To: Aaron Wolski Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] speeing up query and display... Aaron Wolski wrote: Hi Guys, I have the following query which unfortunately has to grab all records in a table (well over 3000) to display in a multiple select box. Code: ?php $manufQuery = db_query(SELECT manufacturer FROM kcs_threads); while ($manufResults = db_fetch($manufQuery)) { ? option value=?php echo $manufResults[manufacturer]; ?/option ?php $threadQuery = db_query(SELECT id,colour,colourID FROM kcs_threads LIMIT 10); while ($threadResults = db_fetch($threadQuery)) { $threadselectQuery = db_query(SELECT * FROM kcs_patternthreads WHERE pattern_index='$id'); while ($threadselectResult = db_fetch($threadselectQuery)) { ? option value=?php echo $threadResults[id]; ? ?php if ($threadselectResult[thread_index] == $threadResults[id]) echo checked; ??php echo $threadResults[colour]; ?/option ?php } } } ? Can ANYONE see a way to speed up the query and displaying of the results? Take a while on High Speed and WY to long on Dialup. Like someone else said, your nested queries approach is horrible. Here's the way to do it with one query. $query = select t.manufacturer, t.id, t.colour, t.colourID, p.thread_index from kcs_threads t LEFT JOIN kcs_patternthreads p ON t.id = p.thread_index where p.pattern_index = $id OR p.pattern_index IS NULL; $old_manufacturer = ''; $result = db_query($query); while($row = db_fetch($result)) { if($old_manufacturer != $row['manufacturer']) { echo option value=\\{$row['manufacturer']}/option\n; $old_manufacturer = $row['manufacturer']; } echo option value=\{$row['id']}\; echo empty($row['thread_index']) ? '' : ' selected'; echo {$row['colourID']}/option\n; } -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ PHP|Architect: A magazine for PHP Professionals - www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] getting MySQL column header?
Hey all, I have a query (thanks John!)... $query = select t.manufacturer, t.id, t.colour, t.colourID, t.type, p.thread_index FROM kcs_threads t LEFT JOIN kcs_patternthreads p ON t.id = p.thread_index WHERE p.pattern_index = $id OR p.pattern_index IS NULL ORDER BY t.colourID; $thread_manufacturer = ''; $result = db_query($query); while($thread = db_fetch($result)) { //DO STUFF HERE } How would one get the column name/header out of this query so that I could display it as the header for my columns? Is this even possible? Thanks! Aaron
RE: [PHP-DB] getting MySQL column header?
Honestly, did you read the manual after I told you last time?? Umm.. am I missing something? I don't believe I've ever asked this question before? If so... my bad. I did have a gander at the manual and was unsure how I could grab the header info and not add an additional query to get this info. *shrugs* Thanks for the info, though! Aaron -Original Message- From: CPT John W. Holmes [mailto:[EMAIL PROTECTED] Sent: July 21, 2003 4:24 PM To: Aaron Wolski; [EMAIL PROTECTED] Subject: Re: [PHP-DB] getting MySQL column header? How would one get the column name/header out of this query so that I could display it as the header for my columns? Honestly, did you read the manual after I told you last time?? $num_fields = mysql_num_fields($result) for($x=0;$x$num_fields;$x++) { echo mysql_field_name($result,$x); } ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] speeing up query and display...
Hi Guys, I have the following query which unfortunately has to grab all records in a table (well over 3000) to display in a multiple select box. Code: ?php $manufQuery = db_query(SELECT manufacturer FROM kcs_threads); while ($manufResults = db_fetch($manufQuery)) { ? option value=?php echo $manufResults[manufacturer]; ?/option ?php $threadQuery = db_query(SELECT id,colour,colourID FROM kcs_threads LIMIT 10); while ($threadResults = db_fetch($threadQuery)) { $threadselectQuery = db_query(SELECT * FROM kcs_patternthreads WHERE pattern_index='$id'); while ($threadselectResult = db_fetch($threadselectQuery)) { ? option value=?php echo $threadResults[id]; ? ?php if ($threadselectResult[thread_index] == $threadResults[id]) echo checked; ??php echo $threadResults[colour]; ?/option ?php } } } ? Can ANYONE see a way to speed up the query and displaying of the results? Take a while on High Speed and WY to long on Dialup. Thanks a lot Aaron
[PHP-DB] how to do this processing....
Hi all, Would anyone have some logic ideas on how to do this processing given the following HTML? form action=insert_threads_patterns.php method=POST tr td class=adminthreadsDisplayHeader align=centerSelected?/td td class=adminthreadsDisplayHeader align=leftManufacturer/td td class=adminthreadsDisplayHeader align=leftColour #/td td class=adminthreadsDisplayHeader align=leftColour/td td class=adminthreadsDisplayHeader align=centerCan Order?/td /tr input type=hidden name=thread_index value=1 input type=hidden name=pattern_index value=2 tr valign=top td class=adminthreadsDisplayText align=centerinput type=checkbox name=select[] value=1 /td td class=adminThreadsDisplayText align=leftDMC/td td class=adminthreadsDisplayText align=leftB5200/td td class=adminthreadsDisplayText align=leftSnow white/td td class=adminthreadsDisplayText align=centerinput type=checkbox name=avail[] value=1 /td /tr input type=hidden name=thread_index value=2 input type=hidden name=pattern_index value=2 tr valign=top td class=adminthreadsDisplayText align=centerinput type=checkbox name=select[] value=1 checked/td td class=adminThreadsDisplayText align=leftDMC/td td class=adminthreadsDisplayText align=left001/td td class=adminthreadsDisplayText align=leftwhite/td td class=adminthreadsDisplayText align=centerinput type=checkbox name=avail[] value=1 checked/td /tr input type=hidden name=thread_index value=3 input type=hidden name=pattern_index value=2 tr valign=top td class=adminthreadsDisplayText align=centerinput type=checkbox name=select[] value=1 /td td class=adminThreadsDisplayText align=leftDMC/td td class=adminthreadsDisplayText align=leftecru/td td class=adminthreadsDisplayText align=leftecru/td td class=adminthreadsDisplayText align=centerinput type=checkbox name=avail[] value=1 /td /tr input type=hidden name=thread_index value=4 input type=hidden name=pattern_index value=2 tr valign=top td class=adminthreadsDisplayText align=centerinput type=checkbox name=select[] value=1 /td td class=adminThreadsDisplayText align=leftDMC/td td class=adminthreadsDisplayText align=left150/td td class=adminthreadsDisplayText align=leftultra very dark .../td td class=adminthreadsDisplayText align=centerinput type=checkbox name=avail[] value=1 /td /tr tr valign=top td colspan=5input type=submit value=Save name=addIt class=adminInputBox/td /tr /form If a displayed record was selected (select[]) then store the corresponding pattern_index and thread_index into a table. Additionally, if the avail{} checkbox was selected for the corresponding records then store the value of 1 in the table as well. Sample table output would look like: ++---+--+---+ | id | pattern_index | thread_index | avail | ++---+--+---+ | 1 | 2 |2 | 1 | | 2 | 2 |5 | 0 | | 3 | 2 | 14 | 1 | ++---+--+---+ Any ideas? *begging here* Thanks! Aaron
[PHP-DB] Logic Advice?
Hi Guys, Here's the deal: I have a page the lists patterns. In this page is a link that opens up a window that displays ALL the threads available in the database. Threads need to be related to patterns. What I mean by this is that I need the ability to select (with a checkbox) the thread listing for when I process the form, the patternID and the threadID are saved in a table. In addition to.. I need to be able to select ( from a checkbox) whether or not this thread is available for direct ordering or not. Here's some code: (opener link): a href=JavaScript:windowOpener('openthreads.php?patternID=?php echo $id; ?', 500, 370) (popup): ?php $threadQuery = db_query(SELECT * FROM kcs_threads); for ($i=0;$threadResults = db_fetch($threadQuery);$i++) { $threadselectQuery = db_query(SELECT * FROM kcs_patternthreads WHERE pattern_index='$patternID'); while ($threadselectResult = db_fetch($threadselectQuery)) { ? input type=hidden name=threadPattern_index[?php echo $i; ?] value=?php echo $threadselectResult[id]; ? input type=hidden name=thread_index value=?php echo $threadResults[id]; ? input type=hidden name=pattern_index value=?php echo $patternID; ? tr valign=top td class=adminthreadsDisplayText align=centerinput type=checkbox name=select[?php echo $i; ?] value=1 ?php if ($threadselectResult[thread_index] == $threadResults[id]) echo checked; ?/td td class=adminThreadsDisplayText align=left?php echo trimString($threadResults[manufacturer],19); ?/td td class=adminthreadsDisplayText align=left?php echo $threadResults[colourID]; ?/td td class=adminthreadsDisplayText align=left?php echo trimString($threadResults[colour],19); ?/td td class=adminthreadsDisplayText align=centerinput type=checkbox name=avail[?php echo $i; ?] value=1 ?php if ($threadselectResult[thread_index] == $threadResults[id] $threadselectResult[avail] == 1) echo checked; ?/td /tr tr tdimg src=../Graphics/spacer.gif width=80 height=1/td tdimg src=../Graphics/spacer.gif width=110 height=1/td tdimg src=../Graphics/spacer.gif width=80 height=1/td tdimg src=../Graphics/spacer.gif width=110 height=1/td tdimg src=../Graphics/spacer.gif width=80 height=1/td /tr ?php } } ? If this were split into an add and an edit page I could easily do what I'm asking but I'm trying to save some steps. Does anyone have any logic advice for processing? Thanks in advance! Aaron
[PHP-DB] formating results in seperate tables?
Hi All, Having some issues with the code below: ?php } ? tr valign=top ?php $col = explode(,,$threadsColumn); $col_search = (; for ($i=0;$icount($col);$i++) { $col_search .= $col[$i]. LIKE '%$threadsName%'; if ($i != (count($col) - 1)) { $col_search .= OR ; } } $col_search .= ); $threadQuery = db_query(SELECT * FROM kcs_threads WHERE $col_search GROUP BY id); if (db_numrows($threadQuery) 0) { for ($i=0;$threadResults = db_fetch($threadQuery);$i++) { ? td table width=340 border=0 cellspacing=0 cellpadding=0 tr td class=adminThreadsDisplayText align=left?php echo trimString($threadResults[manufacturer],13); ?brimg src=../Graphics/spacer.gif width=85 height=2/td td class=adminthreadsDisplayText align=center?php echo $threadResults[colourID]; ?brimg src=../Graphics/spacer.gif width=85 height=2/td td class=adminthreadsDisplayText align=center?php echo $threadResults[type]; ?brimg src=../Graphics/spacer.gif width=85 height=2/td td class=adminthreadsDisplayText align=centera href=threadsedit.php?id=?php echo $threadResults[id]; if ($threadsColumn != ) echo threadsColumn=$threadsColumn; if ($threadsName != ) echo threadsName=$threadsName; ?font class=adminEditLinkEdit/font/anbsp;nbsp;a href=threadsdelete.php?id=?php echo $threadResults[id]; if ($threadsColumn != ) echo threadsColumn=$threadsColumn; if ($threadsName != ) echo threadsName=$threadsName; ?font class=adminEditLinkDelete/font/abrimg src=../Graphics/spacer.gif width=85 height=2/td /tr /table /td tdimg src=../Graphics/spacer.gif width=20 height=1/td ?php if ($i%2) { ? /tr tr valign=top ?php } } } else { ? td class=adminNoResultsText colspan=3 align=centerbrbrThere Are No Results Matching Your Search Criteria./td ?php } ? /tr This is producing an additional tdimg src=../Graphics/spacer.gif width=20 height=1/td within the tr/tr tags. Any clues what's up? Thanks! Aaron
[PHP-DB] csv upload script?
Hey all, Does anyone know a simple.. out of the box ready go csv upload script to import values into a table? I've looked at hotscripts and couldn't find anything. Any help is appreciated. Thanks! Aaron
RE: [PHP-DB] csv upload script?
Hey Jeff! Thanks for the info. Unfortunately I don't have permissions setup for this command. Our host has disabled it because of security reasons. This was done some time ago and they weren't willing to change then nor now. Any other thoughts? Oh.. one more thing.. does ANYONE know how to encapsulate ('' - single quotes) around the values in Excel? To import data I need to do this obviously and using a upload script I could add this into its functionality. Thoughts? Thanks! Aaron -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: July 7, 2003 2:27 PM To: Aaron Wolski Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] csv upload script? if it is truley csv, then use MYSQL's LOAD DATA INFILE syntax. granted you've got to have ahold of the text file.its not out of the box, but pretty close. Woudl that work for you? http://www.mysql.com/doc/en/LOAD_DATA.html hth Jeff Aaron Wolski [EMAIL PROTECTED]To: [EMAIL PROTECTED] z.com cc: Subject: [PHP-DB] csv upload script? 07/07/2003 02:17 PM Hey all, Does anyone know a simple.. out of the box ready go csv upload script to import values into a table? I've looked at hotscripts and couldn't find anything. Any help is appreciated. Thanks! Aaron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] moving though an array..
Hi All, Hopefully someone here can point me in the right direction. I need to create a SELECT statement based on some criteria select and entered into a form. Form variables: $threadsColumn = manufactuer,colour; $string = n; Code: $columns[] = explode(,,$threadsColumn); $test = (; for ($i=0;$isizeof($columns);$i++) { $test .= $columns[$i]. %$string%; } $test .= ); echo $test; What I am attempting to do is create a select statement that would look like (based on form variables): SELECT * FROM tablename WHERE (manufacturer LIKE %n% OR colour LIKE %n%) The information between ( and ) needs to be written in such a manner that it scales up or down in options.. depending on what was selected in the form. ANYONE have some thoughts? Oh.. when I echo the above code I get this: (Array %h%) Thanks! Aaron
RE: [PHP-DB] moving though an array..SOLVED
Hi All, Solved my problem! Here's the code in case anyone really cares :P $col = explode(,,$threadsColumn); $col_search = (; for ($i=0;$icount($col);$i++) { $col_search .= $col[$i]. LIKE '%$threadsName%'; if ($i != (count($col) - 1)) { $col_search .= OR ; } } $col_search .= ); Thanks again Adam for your spelling error notice! Aaron -Original Message- From: Adam Voigt [mailto:[EMAIL PROTECTED] Sent: June 26, 2003 10:26 AM To: Aaron Wolski Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] moving though an array.. One Thing: Change $columns[] to $colums, example: $columns = explode(',',$threadsColumn); On Thu, 2003-06-26 at 10:23, Aaron Wolski wrote: Hi All, Hopefully someone here can point me in the right direction. I need to create a SELECT statement based on some criteria select and entered into a form. Form variables: $threadsColumn = manufactuer,colour; $string = n; Code: $columns[] = explode(,,$threadsColumn); $test = (; for ($i=0;$isizeof($columns);$i++) { $test .= $columns[$i]. %$string%; } $test .= ); echo $test; What I am attempting to do is create a select statement that would look like (based on form variables): SELECT * FROM tablename WHERE (manufacturer LIKE %n% OR colour LIKE %n%) The information between ( and ) needs to be written in such a manner that it scales up or down in options.. depending on what was selected in the form. ANYONE have some thoughts? Oh.. when I echo the above code I get this: (Array %h%) Thanks! Aaron -- Adam Voigt ([EMAIL PROTECTED]) Linux/Unix Network Administrator The Cryptocomm Group -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP DB Interaction with Javascript?
Hi All, Trying to get my head around something and want to know if it's possible first. Can PHP and Javascript interact to the point of PHP querying a DB to find out what records are in use as a variable for another record and then using JS to A) prevent the user from clicking a delete button; or B) pop-up a notice telling the user they can delete that particular record. Hope that makes sense.. any ideas? Thanks! Aaron
RE: [PHP-DB] Cropped Text
Strlen : -Original Message- From: Dallas Freeman [mailto:[EMAIL PROTECTED] Sent: March 12, 2003 4:22 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Cropped Text I dunno what it is called so that is why I am asking, so that I can search the web about it. What do you call the method of cropping text back, so that there are a limited number of characters shown, the rest is cut off. Thanking You, Dallas Freeman -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Store
Mine :) Aaron -Original Message- From: Marie Osypian [mailto:[EMAIL PROTECTED] Sent: March 6, 2003 2:53 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Store I was wondering if anyone was using a good store that was open sourced in php. Marie O -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] What wrong in this SQL
Try escaping the $catid like: WHERE cat_id='$catid' Aaron -Original Message- From: Alawi shekh albaity [mailto:[EMAIL PROTECTED] Sent: March 1, 2003 1:04 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] What wrong in this SQL What wrong with this code in sql : $SQLSTATEMENT[DeleteCategory] = DELETE FROM cats, articles WHERE cat_id = $catid ; Error no: 1064 Details : You have an error in your SQL syntax near 'WHERE cat_id = 1 ' at line 4 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] help with loop and query
Hi guys, Hopefully last time I need to call of you people for this report I am creating. In this report there is a multiple select box like: select name=province[] class=selectcontent size=3 multiple   option value=  class=selectcontentProvince/State/option   option value=AK selected class=selectcontentAlaska/option   option value=AB selected class=selectcontentAlberta/option   option value=BC  class=selectcontentBritish Columbia/option   option value=CA  class=selectcontentCalifornia/option   option value=CO  class=selectcontentColorado/option   option value=CT  class=selectcontentConnecticut/option /select Using this select box comparison data for each of the selected provinces where an order was placed is supposed to be displayed. For example if Alaska, Alberta and British Columbia were selected 1) Grab all cart_idÂs from the OrderTable for each province 2) Reference the cart_id from the OrderTable to the cart_id in the CartTable 3) Display results and products order totals for each province individually. Illustration: Product | Total Orders | Total Sold | Dollar Total Pronvince Name: Alaska Product 1 | 12 | 350 | $3215.45 Product 2 | 8 | 123 | $2143.23 Product 3 | 14 | 113 | $6412.43 Pronvince Name: Alberta Product 1 | 5 | 87 | $1215.45 Product 2 | 3 | 23 | $143.23 Product 3 | 7 | 101 | $5412.43 Pronvince Name: British Columbia Product 1 | 6 | 71 | $1015.45 Product 2 | 25 | 66 | $643.23 Product 3 | 3 | 23 | $412.43 Hopefully you can see what I am trying to do here. Here is the code I have been working this thus far.. ** CODE ** ?php foreach ($province as $value) { $provinceQuery = db_query(SELECT cart_id FROM OrderTable WHERE submitted=1 AND province='$value'); while ($provinceResult = db_fetch($provinceQuery)) { $cartid[] = $provinceResult[cart_id]; } ? tr valign=middle td class=cartlink colspan=5?php echo $value; ?/td /tr ?php $province_search = in(; for ($i=0;$icount($cartid);$i++) { $province_search .= escapeQuote($cartid[$i]); if ($i != (count($cartid) - 1)) { $province_search .= ,; } } $province_search .= ); $provinceCart = AND cart_id $province_search; $query = SELECT name, COUNT(*) AS orders, SUM(quantity) AS sold, SUM(quantity * price ) AS value FROM CartTable WHERE $query $provinceCart GROUP BY name ORDER BY $orderby DESC; $result = mysql_query($query); $total_items = 0; $total_orders = 0; $total = 0.0; while($cartResult = mysql_fetch_array($result)) { $allrows[] = $cartResult; $total_items += $cartResult['sold']; $total_orders += $cartResult['orders']; $total += $cartResult['value']; } foreach($allrows as $cartResult) { ? tr valign=middle td class=cartlink?php echo $cartResult[name]; ?/td td class=cartlink?php echo $cartResult[orders]; ?/td td class=cartlink align=right?php echo $cartResult[sold]; ?/td td class=cartlink align=right?php echo number_format($cartResult[value],2); ?/td td class=cartlink align=right?php echo number_format($cartResult[sold]*100/$total_items,1); ?%/td /tr ?php } } ? IÂve been able to get the cart_idÂs associated with each province selected but I am having lots of trouble displaying the result FOR the selected $provinces. Can anyone help me with where I am erroring? Thanks a ton! Aaron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Help with select box - multiple...
Hi All, Sorry to be a pain on this one as it is sorta off topic.. but any help would be awesome. I'm creating a report for Product Popularity in which the Admin is present with a form and they have the ability to select A product or multiple products from a drop down combo box. The form is submitted to itself.. and all works.. meaning I can select multiple products from the drop down box and the results displayed fine. However, I want to SHOW to the user (in the drop down box) which products were selected. Things work fine if I am selecting on product - meaning it show the product name being sleected.. however, if multiple products are selected it doesn't show any as being selected. The select box code is below as is the script to iterate through the products array. Thanks all. *** product select box *** select name=products[] class=selectcontent size=3 multiple option value= class=selectcontentProduct/option ?php $productQuery = db_query(SELECT name, SUM(quantity) as mostSold FROM CartTable WHERE submitted=1 GROUP BY name ORDER BY mostSold DESC); while ($productResult = db_fetch($productQuery)) { ? option value=?php echo $productResult['name']; ? ?php if ($productResult['name'] == $str_products) echo selected; ? class=selectcontent?php echo $productResult['name']; ?/option ?php } ? /select *** array iteration code ** if ($products) { if (is_array($products)) { $str_products = implode(,,$products); } else { $str_products = $products; } echo $str_products; } Aaron
[PHP-DB] Argh ! array help required :(
Hi All, Again.. a little off topic - sorry (again!). Have a form that allows me to select a bunch of product names from a drop down combo box. I'm trying to create code like in ('Product name1','Product Name2) to be inserted into an SQL statement. I figured that since $products was ALREADY in an array format the code below would work.. but it doesn't: $prod_search = in(; for ($i=0;$icount($products);$i++) { $prod_search .= escapeValue($products[$i]); if ($i != (count($products) - 1)) { $prod_search .= ,; } } $prod_search .= ); Can anyone see where I am going wrong? Thanks! Aaron
[PHP-DB] checking for empty array from a form field? grrrrrrrrrrr!
Argh HOW does one check for an array being empty from a form field?? Tried a billion different things and NOTHING works I've tried: if ($products == \n) { echo hello; } else { echo bye; } if ($products == ) { echo hello; } else { echo bye; } if (empty($products)) { echo hello; } else { echo bye; } if (!isset($products)) { echo hello; } else { echo bye; } if (count($products) == 0) { echo hello; } else { echo bye; } NOTHING works!!! Any help.. puuulease? Aaron
RE: [PHP-DB] checking for empty array from a form field? grrrrrrrrrrr!
Ok... well When I select the select product which has a option value= it tells me the count is one (1). If I select an ACTUAL product it tells me one(1) was select.. if I select two ACTUAL products it tells me two (2) products were selected. For SOME reason it doesn't seem to be recognizing that the option value= is empty! Any more ideas?? *sigh* Aaron -Original Message- From: Hutchins, Richard [mailto:[EMAIL PROTECTED]] Sent: February 5, 2003 4:03 PM To: 'Aaron Wolski'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] checking for empty array from a form field? grrr! What about: count($arrayname) Should tell you how many items are in an array. -Original Message- From: Aaron Wolski [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 05, 2003 4:04 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] checking for empty array from a form field? grrr! Argh HOW does one check for an array being empty from a form field?? Tried a billion different things and NOTHING works I've tried: if ($products == \n) { echo hello; } else { echo bye; } if ($products == ) { echo hello; } else { echo bye; } if (empty($products)) { echo hello; } else { echo bye; } if (!isset($products)) { echo hello; } else { echo bye; } if (count($products) == 0) { echo hello; } else { echo bye; } NOTHING works!!! Any help.. puuulease? Aaron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] checking for empty array from a form field? grrrrrrrrrrr!
Well well well.. with the help of someone else pointing me in a different direction altogether here's what we came up with that totally works! $PRODUCT_SELECTED = TRUE; foreach($products as $value) { if(empty($value)) { $PRODUCT_SELECTED = FALSE; } last; } if(!$PRODUCT_SELECTED) { $productQuery = db_query(SELECT name FROM CartTable WHERE submitted=1 GROUP BY name); while ($productResult = db_fetch($productQuery)) { $products[] = $productResult[name]; } $prod_search = in(; for ($i=0;$icount($products);$i++) { $prod_search .= escapeQuote($products[$i]); if ($i != (count($products) - 1)) { $prod_search .= ,; } } $prod_search .= ); $product = AND name $prod_search; } else { $prod_search = in(; for ($i=0;$icount($products);$i++) { $prod_search .= escapeQuote($products[$i]); if ($i != (count($products) - 1)) { $prod_search .= ,; } } $prod_search .= ); $product = AND name $prod_search; } Thanks to all for their support and help on this. Longest 4 hours of my life :( Aaron -Original Message- From: Hutchins, Richard [mailto:[EMAIL PROTECTED]] Sent: February 5, 2003 4:53 PM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] checking for empty array from a form field? grrr! Somebody else replied with isset($varname). Try that. The count() function is working as expected (see http://www.php.net/manual/en/function.count.php). So maybe it's not the best choice for trying to find out what you want. -Original Message- From: Aaron Wolski [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 05, 2003 4:53 PM To: 'Hutchins, Richard'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] checking for empty array from a form field? grrr! Ok... well When I select the select product which has a option value= it tells me the count is one (1). If I select an ACTUAL product it tells me one(1) was select.. if I select two ACTUAL products it tells me two (2) products were selected. For SOME reason it doesn't seem to be recognizing that the option value= is empty! Any more ideas?? *sigh* Aaron -Original Message- From: Hutchins, Richard [mailto:[EMAIL PROTECTED]] Sent: February 5, 2003 4:03 PM To: 'Aaron Wolski'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] checking for empty array from a form field? grrr! What about: count($arrayname) Should tell you how many items are in an array. -Original Message- From: Aaron Wolski [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 05, 2003 4:04 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] checking for empty array from a form field? grrr! Argh HOW does one check for an array being empty from a form field?? Tried a billion different things and NOTHING works I've tried: if ($products == \n) { echo hello; } else { echo bye; } if ($products == ) { echo hello; } else { echo bye; } if (empty($products)) { echo hello; } else { echo bye; } if (!isset($products)) { echo hello; } else { echo bye; } if (count($products) == 0) { echo hello; } else { echo bye; } NOTHING works!!! Any help.. puuulease? Aaron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] matching data from one table with another and displaying results?
Hi All, Having a problem figuring out the logic of something here and hoping someone can point me in the right direction. I have 2 tables. First table holds a listing of all Provinces and States. Here a brief of what it looks like: value label AB Alberta BC British Columbia MB Manitobia NF Newfoundland NT Northwest Territories NS Nova Scotia Second Table is an OrderTable which holds all order and customer info including the province/state. The province/state is dumped from the value column of the ProvinceTable. Meaning.. an order record would show the province as AB or NS instead of Alberta or Nova Scotia. I am creating an order report and in this report I want to display the LABEL name of the Province/State that relates to an the province column in the OrderTable. I could simply just display all provinces/states from the ProvinceTable but then there would be entries for selection that had NO orders. Any idea on this? Thanks guys! Aaron
RE: [PHP-DB] matching data from one table with another and displaying results? SOLVED
Solved the issue... Just thought I'd post the query that did it. $provinceQuery = db_query(SELECT * FROM ProvinceSelectTable AS t1, OrderTable AS t2 WHERE t1.value=t2.province GROUP BY t2.province); Thanks for any help thought to provide me :) Aaron -Original Message- From: SELPH,JASON (HP-Richardson,ex1) [mailto:[EMAIL PROTECTED]] Sent: February 4, 2003 11:59 AM To: Aaron Wolski; [EMAIL PROTECTED] Subject: RE: [PHP-DB] matching data from one table with another and displaying results? Seek out LEFT JOIN on mysql web site, thats what you want. Cheers Jason -Original Message- From: Aaron Wolski [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 04, 2003 10:43 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] matching data from one table with another and displaying results? Hi All, Having a problem figuring out the logic of something here and hoping someone can point me in the right direction. I have 2 tables. First table holds a listing of all Provinces and States. Here a brief of what it looks like: value label AB Alberta BC British Columbia MB Manitobia NF Newfoundland NT Northwest Territories NS Nova Scotia Second Table is an OrderTable which holds all order and customer info including the province/state. The province/state is dumped from the value column of the ProvinceTable. Meaning.. an order record would show the province as AB or NS instead of Alberta or Nova Scotia. I am creating an order report and in this report I want to display the LABEL name of the Province/State that relates to an the province column in the OrderTable. I could simply just display all provinces/states from the ProvinceTable but then there would be entries for selection that had NO orders. Any idea on this? Thanks guys! Aaron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] SUM(colname)
Select SUM(colname) as newColName FROM SomeTable WHERE value='value'; Reference the 'newColName' as your variable. Aaron -Original Message- From: Cesar Aracena [mailto:[EMAIL PROTECTED]] Sent: January 17, 2003 2:17 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] SUM(colname) Hi all, I'm trying to add all the values from the same column in MySQL with a query like this: SELECT SUM(colname) WHERE value = 'value' But then I can't output it on the screen correctly. I've tried to put all the results into an array and then make an array_sum($arrayname) and it gives me exactly the double of what it should... any suggestions? By the way, the column I'm trying to add is a DOUBLE 6,2. Thanks in advance, Cesar L. Aracena [EMAIL PROTECTED] [EMAIL PROTECTED] (0299) 156-356688 Neuquén (8300) Capital Argentina -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Slashed being added..
Hi All.. Quick q here as I cannot remember how to prevent this. Customer is entering their name in a form that get submitted. Their name is: Mike O'Neill But their name is being entered like: Mike O\\\'Neill This is causing his info not to be saved. How do I prevent this? Any thoughts? Thanks! Aaron
RE: [PHP-DB] [mysql - php] Newline to BR problem
You want to look at nl2br() function. It takes newlines from a text like: Hello My name is Aaron Which when outputted normally would look like: Hello my name is aaron Using echo nl2br($dbquery); would produce: Hellobrbr My name isbrbr Aaronbrbr In your HTML code which then would output in a browse like the above. Aaron -Original Message- From: Ro Stonemountain [mailto:[EMAIL PROTECTED]] Sent: January 9, 2003 10:53 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] [mysql - php] Newline to BR problem I'm trying to place a text from a textfield into a database and displaying it on another page. All works fine and well but my problem is: If i place newline characters (press enter) in the forms textfield they don't show up on my display page. This is logical because newlines are not br codes. So i must replace the newline thingies with br code. Should this be done BEFORE i put the text in the database or AFTER i put the text in the database and what functions can i use Maybe it's a newbie question but it's on my mind for a few days now and i haven't found an answer yet, thanx! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Upload Images...
Write your own. You'll spend more time trying to find something than it will take you to create your own. Plus.. anything that you do find will need modifications anyway so may as well write your own. Define the scope/parameters Write out the logic Program the script :) Aaron -Original Message- From: Doug Coning [mailto:[EMAIL PROTECTED]] Sent: December 27, 2002 3:29 PM To: Boaz Yahav; [EMAIL PROTECTED] Subject: Re: [PHP-DB] Upload Images... Yes, but do you know where I can find a sample of merging the upload script with the Update script? Thanks!!! Doug - Original Message - From: Boaz Yahav [EMAIL PROTECTED] To: Doug Coning [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, December 27, 2002 1:09 PM Subject: RE: [PHP-DB] Upload Images... I'm guessing it's better for the people that will use this page to have it all in one page but less convenient for you to develop it like that :) Sincerely berber Visit http://www.weberdev.com/ Today!!! To see where PHP might take you tomorrow. -Original Message- From: Doug Coning [mailto:[EMAIL PROTECTED]] Sent: Friday, December 27, 2002 9:09 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Upload Images... Hi All, I've got a question about creating an Update page. I have an update page that has a form with about 15 fields in it that update records in my MySQL database. One of the fields is an IMAGE field that stores an image name. I want to this PHP page to do several things: 1) edit and update the fields. 2) allow the user to upload new images to replace current images and then update the image name in the image column. Is this best served as 1 page or is it better to break this down into a page to upload images and a separate page to edit the content? Thank you. Doug -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Listing A Certain # Range
LIMIT 5,10 LIMIT 10,15 Something like that should work. Aaron -Original Message- From: conbud [mailto:[EMAIL PROTECTED]] Sent: December 16, 2002 3:10 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Listing A Certain # Range Hello, Im using MySQL and PHP 4.2.3 on Apache and Mandrake Linux, I was wondering how to get PHP to list let says row 5 - 10 from a database, I read the MySQL manual and all I could find is LIMIT 0,5 to list just the first 5, but I dont know how to make that list 5 - 10 or 10 - 15. Any help would be appreciated. -- Conbud Graphic Web Design Using Open Source Technology -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Enlarging tables
What's your table structure looks like? Aaron -Original Message- From: mike karthauser [mailto:[EMAIL PROTECTED]] Sent: December 9, 2002 9:48 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Enlarging tables We have been entering data into a mysql table and it has got to id=127 and then stopped us from entering anymore data. When i built the table i must have specified the size wrong. Can anyone recommend how to fix this? regards mikek -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Data not entering DB
Sure thing, Give it a whirl. Aaron -Original Message- From: John [mailto:[EMAIL PROTECTED]] Sent: December 6, 2002 3:41 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Data not entering DB Questions: Is this the right email addy to post help questions, and may I post the php code within the email html? Thanks, John --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.426 / Virus Database: 239 - Release Date: 12/2/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Here goes!
First off, Have you tried echoing the values upon submission to ensure they are being set in the form? Secondly, I would place all data code in another file for script processing - processRegistration.php would work well. If all values are being set... maybe look at: $sql=INSERT INTO models (first, last, age, email, location, eye, hair, experience, aspirations, mtype) VALUES ($first, $last, $age, $email, $location, $eye, $hair, $experience, $aspirations, $mtype); Try: INSERT INTO models (first, last, age, email, location, eye, hair, experience, aspirations, mtype) VALUES ('$first','$last','$age','$email', '$location','$eye','$hair','$experience','$aspirations','$mtype'); Just a few thoughts here. Aaron -Original Message- From: John [mailto:[EMAIL PROTECTED]] Sent: December 6, 2002 3:50 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Here goes! Thanks all! Brand spanking new here to PHP so I will paste all the code below. I am using MySQL as my DB and i can modify the information with the same username and password that is in this code using a proprietary GUI administrator (navicat). Unfortunately it will not enter the info via this submission written below: html head titlePortfolio Entry /title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /head body bgcolor=#FFEBEB ?php if ($submit) { $db=mysql_connect(66.220.69.20,*,**); mysql_select_db(sammies models,$db); $sql=INSERT INTO models (first, last, age, email, location, eye, hair, experience, aspirations, mtype) VALUES ($first, $last, $age, $email, $location, $eye, $hair, $experience, $aspirations, $mtype); die (Error in Query: $sql. BR. mysql_error()); echo bcenterThank you for registering,nbsp; $first /b/centerp; ? pcenter/p center a href=http://www.sammiesmodels.com; target=_selfReturn to Sammies Models Home/a ? } else { ? /center center font face=Georgia, Times New Roman, Times, serifstrongSubmit Your Portfolio Here:/strong/font /center form name=entry method=GET action=?php echo $PHP_SELF? nbsp; table width=95% border=0 cellspacing=0 cellpadding=0 tr td width=14%strongFirst Name:/strong/td td width=43%input name=first type=text size=30 maxlength=45/td td width=43%font size=2 face=Arial, Helvetica, sans-serifnbsp;/font/td /tr tr tdstrongLast Name: /strong/td tdinput name=last type=text size=30 maxlength=45/td tdfont size=2 face=Arial, Helvetica, sans-serifstrong*Last name shall not be used on the website, but/strong/font/td /tr tr tdstrongAge:/strong/td tdinput name=age type=text size=30 maxlength=3/td tdfont size=2 face=Arial, Helvetica, sans-serifstrongfor internal use only./strong/font/td /tr tr tdstrongEmail:/strong/td tdinput name=email type=text size=30 maxlength=45/td tdfont size=2 face=Arial, Helvetica, sans-serifnbsp;/font/td /tr tr tdstrongLocation:/strong/td tdinput name=location type=text id=location size=30 maxlength=60/td tdfont size=2 face=Arial, Helvetica, sans-serifstrong*Location- please do not be specific, but only/strong/font/td /tr tr tdstrongEye Color/strong/td tdinput name=eye type=text id=eye size=30 maxlength=45/td tdfont size=2 face=Arial, Helvetica, sans-serifstrongstate or region./strong/font/td /tr tr tdstrongHair Color:/strong/td tdinput name=hair type=text id=hair size=30 maxlength=45/td tdfont size=2 face=Arial, Helvetica, sans-serifnbsp;/font/td /tr tr td valign=topstrongExperience:/strong/td tdtextarea name=experience cols=60 rows=10 id=experience/textarea/td td valign=topfont size=2 face=Arial, Helvetica, sans-serifstrong* Any experience pertaining to your talent aspirations- school plays, photoshoots, etc../strong/font/td /tr tr td valign=topstrongAspirations:/strong/td tdtextarea name=aspirations cols=60 rows=10 id=aspirations/textarea/td td valign=topfont size=2 face=Arial, Helvetica, sans-serifnbsp;/font/td /tr tr td valign=topstrongMedia Type:/strong/td tdtextarea name=mtype cols=60 rows=10 id=mtype/textarea/td td valign=topfont size=2 face=Arial, Helvetica, sans-serifstrong*Media type includes specific types of jobs/ offers you are interested in. /strong/font/td /tr /table table width=95% border=0 cellspacing=0 cellpadding=0 tr td width=57% div align=right pnbsp;/p p input name=submit type=submit value=Submit /p /div/td td width=43%nbsp;/td /tr /table p align=leftnbsp; /p /form ? } ? /body /html --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.426 / Virus Database: 239 - Release Date: 12/2/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Here goes!
Or that too hehe -Original Message- From: Hutchins, Richard [mailto:[EMAIL PROTECTED]] Sent: December 6, 2002 3:51 PM To: 'John'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Here goes! You're missing the mysql_query($sql) or die(mysql_error()); to actually fire the data into the db. Hope this helps. -Original Message- From: John [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 3:50 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Here goes! Thanks all! Brand spanking new here to PHP so I will paste all the code below. I am using MySQL as my DB and i can modify the information with the same username and password that is in this code using a proprietary GUI administrator (navicat). Unfortunately it will not enter the info via this submission written below: html head titlePortfolio Entry /title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /head body bgcolor=#FFEBEB ?php if ($submit) { $db=mysql_connect(66.220.69.20,*,**); mysql_select_db(sammies models,$db); $sql=INSERT INTO models (first, last, age, email, location, eye, hair, experience, aspirations, mtype) VALUES ($first, $last, $age, $email, $location, $eye, $hair, $experience, $aspirations, $mtype); die (Error in Query: $sql. BR. mysql_error()); echo bcenterThank you for registering,nbsp; $first /b/centerp; ? pcenter/p center a href=http://www.sammiesmodels.com; target=_selfReturn to Sammies Models Home/a ? } else { ? /center center font face=Georgia, Times New Roman, Times, serifstrongSubmit Your Portfolio Here:/strong/font /center form name=entry method=GET action=?php echo $PHP_SELF? nbsp; table width=95% border=0 cellspacing=0 cellpadding=0 tr td width=14%strongFirst Name:/strong/td td width=43%input name=first type=text size=30 maxlength=45/td td width=43%font size=2 face=Arial, Helvetica, sans-serifnbsp;/font/td /tr tr tdstrongLast Name: /strong/td tdinput name=last type=text size=30 maxlength=45/td tdfont size=2 face=Arial, Helvetica, sans-serifstrong*Last name shall not be used on the website, but/strong/font/td /tr tr tdstrongAge:/strong/td tdinput name=age type=text size=30 maxlength=3/td tdfont size=2 face=Arial, Helvetica, sans-serifstrongfor internal use only./strong/font/td /tr tr tdstrongEmail:/strong/td tdinput name=email type=text size=30 maxlength=45/td tdfont size=2 face=Arial, Helvetica, sans-serifnbsp;/font/td /tr tr tdstrongLocation:/strong/td tdinput name=location type=text id=location size=30 maxlength=60/td tdfont size=2 face=Arial, Helvetica, sans-serifstrong*Location- please do not be specific, but only/strong/font/td /tr tr tdstrongEye Color/strong/td tdinput name=eye type=text id=eye size=30 maxlength=45/td tdfont size=2 face=Arial, Helvetica, sans-serifstrongstate or region./strong/font/td /tr tr tdstrongHair Color:/strong/td tdinput name=hair type=text id=hair size=30 maxlength=45/td tdfont size=2 face=Arial, Helvetica, sans-serifnbsp;/font/td /tr tr td valign=topstrongExperience:/strong/td tdtextarea name=experience cols=60 rows=10 id=experience/textarea/td td valign=topfont size=2 face=Arial, Helvetica, sans-serifstrong* Any experience pertaining to your talent aspirations- school plays, photoshoots, etc../strong/font/td /tr tr td valign=topstrongAspirations:/strong/td tdtextarea name=aspirations cols=60 rows=10 id=aspirations/textarea/td td valign=topfont size=2 face=Arial, Helvetica, sans-serifnbsp;/font/td /tr tr td valign=topstrongMedia Type:/strong/td tdtextarea name=mtype cols=60 rows=10 id=mtype/textarea/td td valign=topfont size=2 face=Arial, Helvetica, sans-serifstrong*Media type includes specific types of jobs/ offers you are interested in. /strong/font/td /tr /table table width=95% border=0 cellspacing=0 cellpadding=0 tr td width=57% div align=right pnbsp;/p p input name=submit type=submit value=Submit /p /div/td td width=43%nbsp;/td /tr /table p align=leftnbsp; /p /form ? } ? /body /html --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.426 / Virus Database: 239 - Release Date: 12/2/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MySQL Array
Why don't you post the actual data you are pulling FROM the Db.. then show HOW you want it formatted. Might be better for us to give you a solution or something. Aaron -Original Message- From: Art Chevalier [mailto:[EMAIL PROTECTED]] Sent: December 5, 2002 3:21 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] MySQL Array Yes that makes sense, but it is pretty much the same thing I was doing and it's producing the same results. Its basically putting the first element in all 4 table cells. The thing is...I am only selecting from one field. Im trying to get the 4 elements of the column with each pass. So in essence I am trying to get the pointer to move down the array 4 positions within one pass through the loop. If I had any kind of logicl skills I probably could get it:) Art Ryan Jameson [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... while ($ar = mysql_fetch_array($rs)) echo trtd. $ar['field1']./tdtd.$ar['field2']./td/tr; Make sense? -Original Message- From: Art Chevalier [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 05, 2002 12:44 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] MySQL Array Hello, I am pulling one column out of a MySQL table in an array. I want to place each element into a HTML table 4 rows across. I am currently doing this with the mysql_fetch_array() function. How can I pull out 4 array elements in one pass through a while loop? Thanks Art Chevalier -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Help with date
Well... 1 day = 60*60*24 = 86400 You figure it out from there :) Just one example. Aaron -Original Message- From: Dankshit [mailto:[EMAIL PROTECTED]] Sent: November 28, 2002 12:06 PM To: PHP; PHP1 Subject: [PHP-DB] Help with date How can i add days to a date?? Equipe Pratic Sistemas Rodrigo CorrĂȘa Fone: (14) 441-1700 [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] multiple foreach loop?
Hi All, Trying to create a refer a friend script. User enters 10 names and email address of a friend to refer to a site. The following code SORT of works in that it will send the email, etc.. but problem is it duplicates - sends the email out twice to the same email address. **CODE*** foreach($nameRefered as $referedName) { foreach($emailRefered as $referedEmail) { if ($referedEmail != $referedName != ) { message body here /* To send HTML mail, you can set the Content-type header. */ $headers = Return-Path: $support_email\r\n; $headers .= MIME-Version: 1.0\r\n; $headers .= Content-type: text/html; charset=iso-8859-1\r\n; $headers .= From: $nameReferer .$emailReferer.\r\n; mail ($referedEmail,Your Order on Rinkrake.com, $message, $headers); } } } Any thoughts on why I get the email twice? Thanks all. Much appreciated! Aaron
RE: [PHP-DB] INSERT question...
Try... $query = INSERT INTO accounts (accnts,timestamp) VALUES(''.$accnts[0].'','TIMESTAMP(10)'); Might work? Aaron -Original Message- From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]] Sent: November 20, 2002 2:16 PM To: '[EMAIL PROTECTED]' Subject: [PHP-DB] INSERT question... I have an INSERT statement that I cannot quiet get working. The table that this data is being put into has 7 columns, but I only care about putting in the data from the first two columns at this time. The first column is an array element, and the second column needs to be a timestamp. Here is the INSERT statement: $query = INSERT INTO accounts VALUES('.$accnts[0].', 'TIMESTAMP(10)', , , , ,); Here is the error being displayed on the web page: You have an error in your SQL syntax near ' , , ,)' at line 1 Thanks in advance for the help. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] INSERT question...
Hmm You learn something new everyday :) Aaron -Original Message- From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: November 20, 2002 2:27 PM To: Aaron Wolski; 'NIPP, SCOTT V (SBCSI)'; [EMAIL PROTECTED] Subject: Re: [PHP-DB] INSERT question... Try... $query = INSERT INTO accounts (accnts,timestamp) VALUES(''.$accnts[0].'','TIMESTAMP(10)'); Might work? Aaron For the OP, you don't really want to insert the text TIMESTAMP(10) into a column, do you? If you want the current 10-digit timestamp, then you can just use NOW() or CURRENT_DATE, so long as your column is declared with a width of 10. In fact, if it's a timestamp, you don't need to do anything, it'll be updated with the current time upon insert. so you could probably just do this: $query = INSERT INTO accounts (accnts) VALUES (.$accnts[0].); ---John Holmes... -Original Message- From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]] Sent: November 20, 2002 2:16 PM To: '[EMAIL PROTECTED]' Subject: [PHP-DB] INSERT question... I have an INSERT statement that I cannot quiet get working. The table that this data is being put into has 7 columns, but I only care about putting in the data from the first two columns at this time. The first column is an array element, and the second column needs to be a timestamp. Here is the INSERT statement: $query = INSERT INTO accounts VALUES('.$accnts[0].', 'TIMESTAMP(10)', , , , ,); Here is the error being displayed on the web page: You have an error in your SQL syntax near ' , , ,)' at line 1 Thanks in advance for the help. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Email Encryption?
Hi All, I want to thank everyone for their suggestion. A short term solution we're simply going to remove the username from the email. This way if a hacker does obtain the email they don't have the complete details to gain access to the users account. I would like to know more about the code supplied below though. How does this work? As long as they HAVE a string that gets compared in the DB then what good is this? They can still gain access to the users account. Thanks again. Aaron -Original Message- From: Jeremy Wilson [mailto:[EMAIL PROTECTED]] Sent: November 16, 2002 1:08 PM To: 'Aaron Wolski'; 'Jason Vincent'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Email Encryption? $encrypted_string = md5(base64_encode($var.'secret key')); Pass the user name or password to $var and place text in to replace the words 'secret key'. -Original Message- From: Aaron Wolski [mailto:[EMAIL PROTECTED]] Sent: Friday, November 15, 2002 8:45 AM To: 'Jason Vincent'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Email Encryption? Well. Its not what they want.. it what one of their clients want (very big corporation with very unrealistic security standards - you'd think they were NASA or something *grumble*) Their thought is that someone could hack the received email, login to the store using the publically displayed logins details and reek havoc on the store, etc. *shrugs* Sadly this isn't open for debate as a solutions IS required. Any thoughts? Aaron -Original Message- From: Jason Vincent [mailto:[EMAIL PROTECTED]] Sent: November 15, 2002 11:42 AM To: Aaron Wolski; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Email Encryption? Why email? If the Admin tool uses SSL, that is all you need. Regards, J -Original Message- From: Aaron Wolski [mailto:[EMAIL PROTECTED]] Sent: Friday, November 15, 2002 11:39 AM To: 'Aaron Wolski'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Email Encryption? Just thinking here.. PGP is not an option as it would mean EACH user being setup would need the company's public key to decrypt. Not possible as they setup a few hundred accounts each month. Hmm.. anything else? Argh :( Aaron -Original Message- From: Aaron Wolski [mailto:[EMAIL PROTECTED]] Sent: November 15, 2002 11:36 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Email Encryption? OFFTOPIC Sorry for the off topic guys.. But I've just been informed that an application we developed for a client whereby they use an Admin tool to setup user accounts into their store needs to have the login (username and password) encrypted. I am thinking PGP for this but to be honest I've never really worked with PGP and wouldn't have the first clue. Does anyone have any experience with this or can offer and advise at all? Again, sorry for the OT discussion. Aaron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] date()
Ok.. I guess it depends on how your date is stored. I always use unix_timestamps. If you are too.. then the format I supplied should work as indicated. Aaron -Original Message- From: Edward Peloke [mailto:[EMAIL PROTECTED]] Sent: November 18, 2002 2:19 PM To: 'Php-Db' Subject: RE: [PHP-DB] date() When I use this, I get 12/31/69 as my date. -Original Message- From: Aaron Wolski [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 13, 2002 4:04 PM To: 'Edward Peloke'; 'Php-Db' Subject: RE: [PHP-DB] date() $date = date(m:d:y, $myrow[datefield]); Will produce: 11:13:02 http://www.php.net/manual/en/function.date.php Aaron -Original Message- From: Edward Peloke [mailto:[EMAIL PROTECTED]] Sent: November 13, 2002 4:27 PM To: Php-Db Subject: [PHP-DB] date() I have a date field in my mysql db, when I output the data to the screen, I don't want to see the minutes, just the mmddyy. I can format a date but can't seem to get it to work passing in the value from $myrow[datefield]any ideas? I don't want to have to worry about just pulling what I want in the select clause, I just want to format it when I diplay it. Thanks, Eddie -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] date()
Hmm.. I would get it into a unix_timestamp (unless someone can suggest a reasoning for now doing so). Select unix_timestamp(storedDate) as date FROM SomeTable where blah blah Should work like that? Aaron -Original Message- From: Edward Peloke [mailto:[EMAIL PROTECTED]] Sent: November 18, 2002 2:50 PM To: 'Php-Db' Subject: RE: [PHP-DB] date() it is just a datetime field and the clients use a javascript calander to pick the date, here is the exact date as it appears in the db. 2002-11-08 00:00:00 Eddie -Original Message- From: Aaron Wolski [mailto:[EMAIL PROTECTED]] Sent: Monday, November 18, 2002 2:05 PM To: 'Edward Peloke'; 'Php-Db' Subject: RE: [PHP-DB] date() Ok.. I guess it depends on how your date is stored. I always use unix_timestamps. If you are too.. then the format I supplied should work as indicated. Aaron -Original Message- From: Edward Peloke [mailto:[EMAIL PROTECTED]] Sent: November 18, 2002 2:19 PM To: 'Php-Db' Subject: RE: [PHP-DB] date() When I use this, I get 12/31/69 as my date. -Original Message- From: Aaron Wolski [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 13, 2002 4:04 PM To: 'Edward Peloke'; 'Php-Db' Subject: RE: [PHP-DB] date() $date = date(m:d:y, $myrow[datefield]); Will produce: 11:13:02 http://www.php.net/manual/en/function.date.php Aaron -Original Message- From: Edward Peloke [mailto:[EMAIL PROTECTED]] Sent: November 13, 2002 4:27 PM To: Php-Db Subject: [PHP-DB] date() I have a date field in my mysql db, when I output the data to the screen, I don't want to see the minutes, just the mmddyy. I can format a date but can't seem to get it to work passing in the value from $myrow[datefield]any ideas? I don't want to have to worry about just pulling what I want in the select clause, I just want to format it when I diplay it. Thanks, Eddie -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] checking for 0 results?
Or you can skip a step like: $sql = select * from ietsfuckingfriday; if (mysql_num_rows($result) == 0) { do_something(); } else { do_anotherthing(); } Aaron -Original Message- From: Snijders, Mark [mailto:Mark.Snijders;atosorigin.com] Sent: November 15, 2002 8:26 AM To: 'Jonathan Narong'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] checking for 0 results? $sql = select * from ietsfuckingfriday; $result = mysql_query($sql); $num_rows=mysql_num_rows($result); if ($num_rows==0)echo yesss we did it; (sorry it's friday :-) almost can go home :--) -Original Message- From: Jonathan Narong [mailto:jon;binaryillusions.com] Sent: vrijdag 15 november 2002 14:23 To: [EMAIL PROTECTED] Subject: [PHP-DB] checking for 0 results? maybe i'm totally not thinking straight right now, but is there a way in php to check if 0 results are returned in a mysql query? for example, i have a definition database, that has a list of letters the user clicks on (click on the letter, and all the terms for that letter pop up).. but for some letters there are no terms. so i just wanted to echo out a simple no terms message or something. in any case, i need to check if there are no results from a mysql query (an error won't be returned). thanks .. -jon -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] checking for 0 results? edit
Doh! Edit: if (mysql_num_rows($sql) == 0) { Aaron -Original Message- From: Aaron Wolski [mailto:aaronjw;martekbiz.com] Sent: November 15, 2002 8:42 AM To: 'Snijders, Mark'; 'Jonathan Narong'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] checking for 0 results? Or you can skip a step like: $sql = select * from ietsfuckingfriday; if (mysql_num_rows($result) == 0) { do_something(); } else { do_anotherthing(); } Aaron -Original Message- From: Snijders, Mark [mailto:Mark.Snijders;atosorigin.com] Sent: November 15, 2002 8:26 AM To: 'Jonathan Narong'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] checking for 0 results? $sql = select * from ietsfuckingfriday; $result = mysql_query($sql); $num_rows=mysql_num_rows($result); if ($num_rows==0)echo yesss we did it; (sorry it's friday :-) almost can go home :--) -Original Message- From: Jonathan Narong [mailto:jon;binaryillusions.com] Sent: vrijdag 15 november 2002 14:23 To: [EMAIL PROTECTED] Subject: [PHP-DB] checking for 0 results? maybe i'm totally not thinking straight right now, but is there a way in php to check if 0 results are returned in a mysql query? for example, i have a definition database, that has a list of letters the user clicks on (click on the letter, and all the terms for that letter pop up).. but for some letters there are no terms. so i just wanted to echo out a simple no terms message or something. in any case, i need to check if there are no results from a mysql query (an error won't be returned). thanks .. -jon -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] serious help with linking data together...
Hi all, Sorry about not posting the problem that I was having. Was hard to explain without showing an example page and figure there was a problem with the code SQL itself that someone would spot off the bat. Anyway.. here's a link: http://www.rinkrake.com/blah.php You'll see what I am trying to do but here are the problems: I want to order the keywords from MOST to least (so I guess I need a count on the keyword grouping then ORDER by it. Some of the keywords aren't showing ANY Search Engine info. Each keyword DOES have a Search Engine associated with it. All seems very confusing to me and I don't know how to trouble shoot this :( Here's the code again and thanks very much for your time. HTML HEAD /HEAD link rel=stylesheet href=styles.css type=text/css BODY table border=0 cellpadding=0 cellspacing=0 width=600 tr valign=top tdimg src=Graphics/spacer.gif width=350 height=1/td tdimg src=Graphics/spacer.gif width=150 height=1/td tdimg src=Graphics/spacer.gif width=100 height=1/td /tr tr valign=top td class=content_boldKeyword/td td class=content_boldSearch Engine/td td class=content_bold align=centerCount/td /tr ?php $keyQuery = db_query(SELECT * FROM SiteTrackingTable WHERE keyword' ' GROUP BY keyword); while ($keyResult = db_fetch($keyQuery)) { $refQuery = db_query(SELECT referer, COUNT(referer) as refTotal FROM SiteTrackingTable WHERE keyword=.$keyResult[keyword]. GROUP BY referer); $nrows = db_numrows($refQuery); ? tr valign=top td class=content2?php echo $keyResult[keyword]; ?/td td colspan=2 table border=0 cellpadding=0 cellspacing=0 width=250 tr valign=top tdimg src=Graphics/spacer.gif width=150 height=1/td tdimg src=Graphics/spacer.gif width=100 height=1/td /tr ?php while ($refResult = db_fetch($refQuery)) { ? tr valign=top td class=content2?php echo $refResult[referer]; ?/td td class=content2 align=center?php echo $refResult[refTotal]; ?/td /tr ?php } ? /table /td /tr tr valign=top td colspan=3img src=Graphics/spacer.gif width=600 height=10/td /tr ?php } ? /table /BODY /HTML -Original Message- From: Jason Vincent [mailto:jayv;nortelnetworks.com] Sent: November 15, 2002 8:51 AM To: Aaron Wolski; [EMAIL PROTECTED] Subject: RE: [PHP-DB] serious help with linking data together... you haven't really said what the problem is - but this is what I can see... Functions like COUNT, MAX and MIN etc. are group functions (or aggregate functions). For example, select count(*) actually only returns 1 record - the total count. When you mix aggregate functions with regular selects (that return many rows - like select keyword) you are going to get strange results. What are you seeing Regards, J -Original Message- From: Aaron Wolski [mailto:aaronjw;martekbiz.com] Sent: Thursday, November 14, 2002 5:17 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] serious help with linking data together... Hey all, Been trying too figure this out all day. First off I'll explain what I am TRYING to do. I am creating a Search Engine Tracking Report that lists keywords and the Search Engines used on that keyword along with the count total for that search Engine - example: Keyword Search Engine Count Web hosting Yahoo 27 Google 20 MSN 12 Web Design Overture 30 MSN 17 So on and so forth. Seems simple right? But no not for me! CODE: ?php $keyQuery = db_query(SELECT keyword, COUNT(keyword) as kTotal FROM SiteTrackingTable WHERE $query GROUP BY keyword); while ($keyResult = db_fetch($keyQuery)) { if (strlen($keyResult[keyword]) 2) { $refQuery = db_query(SELECT *, COUNT(referer) as refTotal FROM SiteTrackingTable WHERE keyword=.$keyResult[keyword]. GROUP BY referer ORDER BY refTotal DESC); $nrows = db_numrows($refQuery); ? tr valign=top td class=content2?php echo $keyResult
RE: [PHP-DB] serious help with linking data together...
By George I think I may have got it! Code: HTML HEAD /HEAD link rel=stylesheet href=styles.css type=text/css BODY table border=0 cellpadding=0 cellspacing=0 width=600 tr valign=top tdimg src=Graphics/spacer.gif width=350 height=1/td tdimg src=Graphics/spacer.gif width=150 height=1/td tdimg src=Graphics/spacer.gif width=100 height=1/td /tr tr valign=top td class=content_boldKeyword/td td class=content_boldSearch Engine/td td class=content_bold align=centerCount/td /tr ?php $keyQuery = db_query(SELECT *, COUNT(keyword) as kTotal FROM SiteTrackingTable WHERE keyword' ' GROUP BY keyword ORDER BY kTotal DESC); while ($keyResult = db_fetch($keyQuery)) { $refQuery = db_query(select referer, COUNT(referer) as refTotal FROM SiteTrackingTable WHERE keyword=.escapeQuote($keyResult[keyword]). GROUP BY referer ORDER BY refTotal DESC); $nrows = db_numrows($refQuery); ? tr valign=top td class=content2?php echo $keyResult[keyword]; ?/td td colspan=2 table border=0 cellpadding=0 cellspacing=0 width=250 tr valign=top tdimg src=Graphics/spacer.gif width=150 height=1/td tdimg src=Graphics/spacer.gif width=100 height=1/td /tr ?php while ($refResult = db_fetch($refQuery)) { ? tr valign=top td class=content2?php echo $refResult[referer]; ?/td td class=content2 align=center?php echo $refResult[refTotal]; ?/td /tr ?php } ? /table /td /tr tr valign=top td colspan=3img src=Graphics/spacer.gif width=600 height=10/td /tr ?php } ? /table /BODY /HTML Link: http://www.rinkrake.com/blah.php Wacha think? Aaron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Email Encryption?
OFFTOPIC Sorry for the off topic guys.. But I've just been informed that an application we developed for a client whereby they use an Admin tool to setup user accounts into their store needs to have the login (username and password) encrypted. I am thinking PGP for this but to be honest I've never really worked with PGP and wouldn't have the first clue. Does anyone have any experience with this or can offer and advise at all? Again, sorry for the OT discussion. Aaron
RE: [PHP-DB] Email Encryption?
Just thinking here.. PGP is not an option as it would mean EACH user being setup would need the company's public key to decrypt. Not possible as they setup a few hundred accounts each month. Hmm.. anything else? Argh :( Aaron -Original Message- From: Aaron Wolski [mailto:aaronjw;martekbiz.com] Sent: November 15, 2002 11:36 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Email Encryption? OFFTOPIC Sorry for the off topic guys.. But I've just been informed that an application we developed for a client whereby they use an Admin tool to setup user accounts into their store needs to have the login (username and password) encrypted. I am thinking PGP for this but to be honest I've never really worked with PGP and wouldn't have the first clue. Does anyone have any experience with this or can offer and advise at all? Again, sorry for the OT discussion. Aaron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Email Encryption?
Well. Its not what they want.. it what one of their clients want (very big corporation with very unrealistic security standards - you'd think they were NASA or something *grumble*) Their thought is that someone could hack the received email, login to the store using the publically displayed logins details and reek havoc on the store, etc. *shrugs* Sadly this isn't open for debate as a solutions IS required. Any thoughts? Aaron -Original Message- From: Jason Vincent [mailto:jayv;nortelnetworks.com] Sent: November 15, 2002 11:42 AM To: Aaron Wolski; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Email Encryption? Why email? If the Admin tool uses SSL, that is all you need. Regards, J -Original Message- From: Aaron Wolski [mailto:aaronjw;martekbiz.com] Sent: Friday, November 15, 2002 11:39 AM To: 'Aaron Wolski'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Email Encryption? Just thinking here.. PGP is not an option as it would mean EACH user being setup would need the company's public key to decrypt. Not possible as they setup a few hundred accounts each month. Hmm.. anything else? Argh :( Aaron -Original Message- From: Aaron Wolski [mailto:aaronjw;martekbiz.com] Sent: November 15, 2002 11:36 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Email Encryption? OFFTOPIC Sorry for the off topic guys.. But I've just been informed that an application we developed for a client whereby they use an Admin tool to setup user accounts into their store needs to have the login (username and password) encrypted. I am thinking PGP for this but to be honest I've never really worked with PGP and wouldn't have the first clue. Does anyone have any experience with this or can offer and advise at all? Again, sorry for the OT discussion. Aaron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Email Encryption?
Hmm... Could you provide more info on the fax gateway? Have not used this before and would appreciate the info you could provide so I can consider the development and implementation costs, etc. Note: this all has to be automatically done as to not create anymore work for my client. This system is supposed to simplify their lives not complicate :( Aaron -Original Message- From: Cal Evans [mailto:cal;calevans.com] Sent: November 15, 2002 11:54 AM To: Aaron Wolski; 'Hutchins, Richard'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Email Encryption? Instead of emailing them the login and password info, setup a fax gateway and fax it to them. I used this in a situation that needed to be HIPA compliant. (If security is still an issue, fold the fax before sending it.) :) HTH, =C= * * Cal Evans * The Virtual CIO * http://www.calevans.com * -Original Message- From: Aaron Wolski [mailto:aaronjw;martekbiz.com] Sent: Friday, November 15, 2002 10:47 AM To: 'Hutchins, Richard'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Email Encryption? The user account is setup via the Admin util. The details are emailed to the account holder. Profile and Login information are contained within. Aaron -Original Message- From: Hutchins, Richard [mailto:Richard.Hutchins;GetingeCastle.com] Sent: November 15, 2002 11:43 AM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Email Encryption? Can you explain how e-mail fits into the Admin solution? What is the e-mail used for? Setting up the accounts/passwords or sending the account/password to the user? -Original Message- From: Aaron Wolski [mailto:aaronjw;martekbiz.com] Sent: Friday, November 15, 2002 11:39 AM To: 'Aaron Wolski'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Email Encryption? Just thinking here.. PGP is not an option as it would mean EACH user being setup would need the company's public key to decrypt. Not possible as they setup a few hundred accounts each month. Hmm.. anything else? Argh :( Aaron -Original Message- From: Aaron Wolski [mailto:aaronjw;martekbiz.com] Sent: November 15, 2002 11:36 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Email Encryption? OFFTOPIC Sorry for the off topic guys.. But I've just been informed that an application we developed for a client whereby they use an Admin tool to setup user accounts into their store needs to have the login (username and password) encrypted. I am thinking PGP for this but to be honest I've never really worked with PGP and wouldn't have the first clue. Does anyone have any experience with this or can offer and advise at all? Again, sorry for the OT discussion. Aaron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Email Encryption?
Yeah, This is one solutions I thought of. Problem is. the whole premise of the application is that it is hassle free for my client as well as their clients. By adding in this step (if last resort I will have to) we get rid of the hassle free concept and perhaps diminish the effectiveness () of the app. Thanks again. Aaron -Original Message- From: Jason Vincent [mailto:jayv;nortelnetworks.com] Sent: November 15, 2002 12:05 PM To: Aaron Wolski; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Email Encryption? What I was getting it is, have the 'users' log into a secure web page and create their own user names and passwords (and enter their email address). Then just have the admin 'approve' the request and this sends them an email saying that their access has been granted - that way no information is ever passed via email. Regards, Jason Vincent Voice Architecture, Nortel Networks (905) 863-7480 (ESN 333) [EMAIL PROTECTED] -Original Message- From: Aaron Wolski [mailto:aaronjw;martekbiz.com] Sent: Friday, November 15, 2002 11:47 AM To: 'Hutchins, Richard'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Email Encryption? The user account is setup via the Admin util. The details are emailed to the account holder. Profile and Login information are contained within. Aaron -Original Message- From: Hutchins, Richard [mailto:Richard.Hutchins;GetingeCastle.com] Sent: November 15, 2002 11:43 AM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Email Encryption? Can you explain how e-mail fits into the Admin solution? What is the e-mail used for? Setting up the accounts/passwords or sending the account/password to the user? -Original Message- From: Aaron Wolski [mailto:aaronjw;martekbiz.com] Sent: Friday, November 15, 2002 11:39 AM To: 'Aaron Wolski'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Email Encryption? Just thinking here.. PGP is not an option as it would mean EACH user being setup would need the company's public key to decrypt. Not possible as they setup a few hundred accounts each month. Hmm.. anything else? Argh :( Aaron -Original Message- From: Aaron Wolski [mailto:aaronjw;martekbiz.com] Sent: November 15, 2002 11:36 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Email Encryption? OFFTOPIC Sorry for the off topic guys.. But I've just been informed that an application we developed for a client whereby they use an Admin tool to setup user accounts into their store needs to have the login (username and password) encrypted. I am thinking PGP for this but to be honest I've never really worked with PGP and wouldn't have the first clue. Does anyone have any experience with this or can offer and advise at all? Again, sorry for the OT discussion. Aaron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Email Encryption?
My client is the one doing the setup of accounts. How would the account holder know of his password before it got encrypted? Hense the email. Aaron -Original Message- From: Peter Beckman [mailto:beckman;purplecow.com] Sent: November 15, 2002 12:35 PM To: Aaron Wolski Cc: 'Jason Vincent'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Email Encryption? Why not encrypt the password in the DB? If they lose their password, it cannot be sent to them. They chose it, so it doesn't need to be sent to them in their email. If they lose it, it is changed, and they have to change it again. That way, only if they are stupid do they have an extra step. The passwords in the DB are encrypted, so only if someone gets a hold of the DB can the passwords be cracked by brute force. md5 would work fine for this. It is the same security that FreeBSD uses in their password file. Peter On Fri, 15 Nov 2002, Aaron Wolski wrote: Well. Its not what they want.. it what one of their clients want (very big corporation with very unrealistic security standards - you'd think they were NASA or something *grumble*) Their thought is that someone could hack the received email, login to the store using the publically displayed logins details and reek havoc on the store, etc. *shrugs* Sadly this isn't open for debate as a solutions IS required. Any thoughts? Aaron -Original Message- From: Jason Vincent [mailto:jayv;nortelnetworks.com] Sent: November 15, 2002 11:42 AM To: Aaron Wolski; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Email Encryption? Why email? If the Admin tool uses SSL, that is all you need. Regards, J -Original Message- From: Aaron Wolski [mailto:aaronjw;martekbiz.com] Sent: Friday, November 15, 2002 11:39 AM To: 'Aaron Wolski'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Email Encryption? Just thinking here.. PGP is not an option as it would mean EACH user being setup would need the company's public key to decrypt. Not possible as they setup a few hundred accounts each month. Hmm.. anything else? Argh :( Aaron -Original Message- From: Aaron Wolski [mailto:aaronjw;martekbiz.com] Sent: November 15, 2002 11:36 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Email Encryption? OFFTOPIC Sorry for the off topic guys.. But I've just been informed that an application we developed for a client whereby they use an Admin tool to setup user accounts into their store needs to have the login (username and password) encrypted. I am thinking PGP for this but to be honest I've never really worked with PGP and wouldn't have the first clue. Does anyone have any experience with this or can offer and advise at all? Again, sorry for the OT discussion. Aaron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] I just wanna say...
Yes indeed! We often forget cause we're so busy with our own projects. However, so are the people who helped us out originally. Thanks to you - you know who you are! *sings* Lets drink to the hard working people Lets drink to the good (PHP) and the evil (ASP/VB) haha :) Aaron -Original Message- From: Chris Payne [mailto:chris;planetoxygene.com] Sent: November 15, 2002 2:36 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] I just wanna say... Here here, couldn't agree more. Sometimes I get the answers I need but am too tired to reply then the next day I get so caught up in everyday life sometimes forget to say thanks myself but this list is a lifesaver and is a godsend to many of us either just learning PHP/MySQL or who want to get into it alittle deeper. Thanks everyone. Chris I see people post questions here, get answers, and never even acknowledge anyone responded. Well I just wanna say, Thanks guys. I've posted questions here twice now...my last a couple of days ago. Both times I received numerous, almost instantaneous, knowledgeable, and extremely helpful responses. Thanks! Brett -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Best reporting Tool
I have to agree on the PDF. Currently my host does not provide for PDF capabilities as of yet but I believe they are going to be compiling with support for PDF soon. When they do, look out. The success of some of our commercial apps will rise for sure as this reporting options becomes available. A lot of our apps/tools are for customers of our clients... meaning our clients (marketing and Ad firms) utilize our tools to sell to their clients therefore a lot of the reports need to be made available to their clients as well. PDF files will really enhance the client-relationship thus making it that much stronger and a longer lasting business relationship (more$). Just my thoughts. Aaron -Original Message- From: John KRewson [mailto:krewsonj;sworps.utk.edu] Sent: November 14, 2002 10:47 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Best reporting Tool I have recently been creating reports using PHP's pdf libraries. Somewhat time consuming to develop them from scratch and the client has to have the acrobat reader, but they look slick, I must say. Another option is to create RTF or PDF templates and simply replace certain areas with your data. This might not be what you are looking for, but a couple of places to start: http://zope1.devshed.com/zope.devshed.com/Server_Side/PHP/PDF/page1.html http://www.phpbuilder.com/columns/perugini20001026.php3 One nice thing about this is that quite a few people seem to be developing classes for this kind of reporting. Mohammad Saad wrote: Hi, I wanted to ask a question, Whats the best way of developing reports in PHP. I mean in case of ASP, developers use Crystal Reports but apparently PHP doesn't support Crystal Reports. so is there any other tool for me? or should I use conventional method of writing database queries, PHP paging and HTML table formatting to generate reports. The reason I am asking is this, that for a particular project I need to come up with around 175 reports, Although am sure some of the reports formats will be the same so I can just switch queries in those. but still is there any other better way out, are Oracle Reports supported in PHP? Thanks in Advance Saad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] serious help with linking data together...
Hey all, Been trying too figure this out all day. First off I'll explain what I am TRYING to do. I am creating a Search Engine Tracking Report that lists keywords and the Search Engines used on that keyword along with the count total for that search Engine - example: Keyword Search Engine Count Web hosting Yahoo 27 Google 20 MSN 12 Web Design Overture 30 MSN 17 So on and so forth. Seems simple right? But no not for me! CODE: ?php $keyQuery = db_query(SELECT keyword, COUNT(keyword) as kTotal FROM SiteTrackingTable WHERE $query GROUP BY keyword); while ($keyResult = db_fetch($keyQuery)) { if (strlen($keyResult[keyword]) 2) { $refQuery = db_query(SELECT *, COUNT(referer) as refTotal FROM SiteTrackingTable WHERE keyword=.$keyResult[keyword]. GROUP BY referer ORDER BY refTotal DESC); $nrows = db_numrows($refQuery); ? tr valign=top td class=content2?php echo $keyResult[keyword]; ?/td td colspan=2 table border=0 cellpadding=0 cellspacing=0 width=250 tr valign=top tdimg src=../Graphics/spacer.gif width=150 height=1/td tdimg src=../Graphics/spacer.gif width=100 height=1/td /tr ?php while ($refResult = db_fetch($refQuery)) { ? tr valign=top td class=content2?php echo $refResult[referer]; ?/td td class=content2 align=center?php echo $refResult[refTotal]; ?/td /tr ?php } ? /table /td /tr ?php } } ? If this is too messed up let me know and I'll reformat. Sorry guy the annoying question guys. Aaron
[PHP-DB] Difference between 2 dates.. thoughts?
Hi All, First off I have a query like this: SELECT dateinserted FROM SiteTrackingTable; Now. in this query any number of results could be returned 10 or 1000, etc. Is it possible to take the dateinserted value from the first record and then from the last record and perform some calculation to get the number of days the record spans? Haven't done something like this before and don't have a clue where to start. Date sorting,etc I can do just don't know about this one. Thanks for your help! Aaron
RE: [PHP-DB] Difference between 2 dates.. thoughts?
Hi There, Well the first and last record of the results. So if 1000 records were found... then record #1 and then record #1000 - perform data calculation between those 2 records (how many days does this query span). Know what I am trying to say? Sorry if its not clear. Aaron -Original Message- From: Jason Vincent [mailto:jayv;nortelnetworks.com] Sent: November 13, 2002 12:24 PM To: Aaron Wolski; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Difference between 2 dates.. thoughts? You should be able to do this at the database level - of course you never said what database that is. Regardless, check your database documentation for the max() and min() functions - never used these on date but they might work - do you always want the first record and the last record in the database? Or do you mean the first and last record of the record set? If you always want the first record inserted and the last record inserted, than use max() and min() in the unique database key (the unique record number) assuming you have one and that they are sequential. Then check for any date functions that might be able to tell the days elapsed between to dates (in mySQL you might look at the interval function). Regards, J -Original Message- From: Aaron Wolski [mailto:aaronjw;martekbiz.com] Sent: Wednesday, November 13, 2002 11:33 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Difference between 2 dates.. thoughts? Hi All, First off I have a query like this: SELECT dateinserted FROM SiteTrackingTable; Now. in this query any number of results could be returned 10 or 1000, etc. Is it possible to take the dateinserted value from the first record and then from the last record and perform some calculation to get the number of days the record spans? Haven't done something like this before and don't have a clue where to start. Date sorting,etc I can do just don't know about this one. Thanks for your help! Aaron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Difference between 2 dates.. thoughts?
Ok, Thanks for your input. I know very little about how to manipulate MySQL so this out to be fun and very slow going :-( Thanks! Aaron -Original Message- From: Jason Vincent [mailto:jayv;nortelnetworks.com] Sent: November 13, 2002 12:34 PM To: Aaron Wolski; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Difference between 2 dates.. thoughts? Test whether min() and max() work on date fields - never tried it. Or check the documentation on date and time functions for your database - they may have something that does this. If not, you could just do an order by date ascending and grab only the first record, then an order by date descending and grab the first record of that. Then you would need to use some date function (or php date module) to find the span. If you are using mysql, check out the INTERVAL function. Regards, J -Original Message- From: Aaron Wolski [mailto:aaronjw;martekbiz.com] Sent: Wednesday, November 13, 2002 12:27 PM To: Vincent, Jason [BRAM:1334:EXCH]; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Difference between 2 dates.. thoughts? Hi There, Well the first and last record of the results. So if 1000 records were found... then record #1 and then record #1000 - perform data calculation between those 2 records (how many days does this query span). Know what I am trying to say? Sorry if its not clear. Aaron -Original Message- From: Jason Vincent [mailto:jayv;nortelnetworks.com] Sent: November 13, 2002 12:24 PM To: Aaron Wolski; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Difference between 2 dates.. thoughts? You should be able to do this at the database level - of course you never said what database that is. Regardless, check your database documentation for the max() and min() functions - never used these on date but they might work - do you always want the first record and the last record in the database? Or do you mean the first and last record of the record set? If you always want the first record inserted and the last record inserted, than use max() and min() in the unique database key (the unique record number) assuming you have one and that they are sequential. Then check for any date functions that might be able to tell the days elapsed between to dates (in mySQL you might look at the interval function). Regards, J -Original Message- From: Aaron Wolski [mailto:aaronjw;martekbiz.com] Sent: Wednesday, November 13, 2002 11:33 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Difference between 2 dates.. thoughts? Hi All, First off I have a query like this: SELECT dateinserted FROM SiteTrackingTable; Now. in this query any number of results could be returned 10 or 1000, etc. Is it possible to take the dateinserted value from the first record and then from the last record and perform some calculation to get the number of days the record spans? Haven't done something like this before and don't have a clue where to start. Date sorting,etc I can do just don't know about this one. Thanks for your help! Aaron