Re: [PHP] Minimizing Database Hits
> I wrote class that contains a function that retrieves users shopping > cart items from database and then returns an array with qty, item number > , item name, etc. > > So now whenever I want to retrieve the users cart I use the following: > > $cart_contents = $cart->get_cart_contents(); > > I then iterate through $cart_contents to display info. Now I am trying > to minimize the number of hits to the database so my question is, am I > querying the database every time I call on $cart_contents? One way of doing this is to store the shopping cart as session data and using a class to read the session rather than the DB. Doing it this way means that the DB is only accessed before the shopper puts the item in their cart. Once it's there, the sesion holds the data and the DB load is reduced. We use this system in many of our sites. Regards Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] states
> Does anyone know of any built in functions or options for the US states? > I want to make a drop down menu and some other things which have the 50 > states in it. Is there any shortcut for this with PHP, or do I need to > do it all manually in HTML? Please let me know. Thanks. > > Matt Hi Matt, Short answer - No. PHP Doesn't have ant short function to generate drop down lists or menus. Your best bet is to look at http://www.webreference.com/dhtml/hiermenus/ and build your HM_Arrays.js from scratch (or 'borrow' the select box from other sites.) Regards Andrew ps. as a European, I get very annoyed with the number of websites that ask for address details and then only give State/County/Area options for US states. I know the U.S.A is big - but the rest of the world is bigger. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 4.3.0/4.3.2 - Strange problem with exec / move_uploaded_file
OK. What I've started doing is use PHP's ftp functions to login and PUT the file in the right place. This allows me to move files and put em where I want, with teh right permissions. Check the manual for more info. Andrew > Hi, > > But it's already there. > > And the file is uploaded (since I can see it under > /tmp) > --- Andrew McCombe <[EMAIL PROTECTED]> wrote: > > Put enctype="multipart/form-data" in your > > tag; > > > > > > - Original Message - > > From: "Robert Mena" <[EMAIL PROTECTED]> > > To: "php mailing list" <[EMAIL PROTECTED]> > > Sent: Friday, July 04, 2003 4:00 PM > > Subject: [PHP] PHP 4.3.0/4.3.2 - Strange problem > > with exec / > > move_uploaded_file > > > > > > > Hi, > > > > > > I am faciing a strange problem. I have some php > > > script to receive images (via file upload). > > > > > > The script is failling to work because it can't > > > move/copy the file. > > > > > > I've added a sleep(x) in order to make the > > temporary > > > file stick around. > > > > > > 20 -rw---1 apache apache 19402 > > Jul 4 > > > 10:49 /tmp/phpFj6Irk > > > > > > I've added apache to an upload group > > > > > > upload:x:1098:apache > > > > > > And changed the owner of the directory. > > > > > > ls -sla /home/httpd/html/foo.com/img/news/ > > > total 24 > > >4 drwxrwxr-x6 webmaste upload 4096 > > Jul 4 > > > 10:11 . > > >4 drwxrwxr-x5 webmaste webmaste 4096 > > Jun 10 > > > 15:55 .. > > >4 drwxrwxr-x2 webmaste upload 4096 > > Jun 4 > > > 09:41 1 > > >4 drwxrwxr-x2 webmaste upload 4096 > > Jul 4 > > > 10:48 10 > > >4 drwxrwxr-x2 webmaste upload 4096 > > Jul 4 > > > 09:54 2 > > > > > > And the both commands below fail. > > > > > > move_uploaded_file($tmpfile,$destination) > > > exec("/bin/cp $tmpfile $destination",$array) > > > > > > The var_dump in array shows > > > > > > array(0) { } > > > > > > The $destination var has (checked with echo) > > > > > > /home/httpd/html/foo.com/img/news/10/xxx.jpg > > > > > > Any ideias ? > > > > > > __ > > > Do you Yahoo!? > > > SBC Yahoo! DSL - Now only $29.95 per month! > > > http://sbc.yahoo.com > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: > > http://www.php.net/unsub.php > > > > > > > > > > > > > __ > Do you Yahoo!? > SBC Yahoo! DSL - Now only $29.95 per month! > http://sbc.yahoo.com > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More on file upload
Try copy() instead of move_uploaded_file and see what you get. Andrew - Original Message - From: "Webmaster" <[EMAIL PROTECTED]> To: "Marek Kilimajer" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, July 04, 2003 5:12 PM Subject: RE: [PHP] More on file upload > Directory permissions are set to 0777 > > Right now I am just using > if ( move_uploaded_file(source,dest)) > { > echo "file moved"; > } > else > { > echo "could not move file"; > } > } > > Have not yet been able to figure out how to get a more descriptive error. I > know there has to be a better way to get exact message, but just haven't > figured it out yet. > > Mark Roberts, Roberts Computing Systems > eCommerce, yeah, we do that! > Graphics, Scripting, Databases, shopping carts > mailto:[EMAIL PROTECTED] > > -Original Message- > From: Marek Kilimajer [mailto:[EMAIL PROTECTED] > Sent: Friday, July 04, 2003 10:57 AM > To: Webmaster > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP] More on file upload > > > What is the message now? Is the file being uploaded and > move_uploaded_file() does not move the file? Then check the directory > permissions. > > Webmaster wrote: > > > First of all, thanks to all that have helped so far. > > > > I am trying to get a file upload script to work using php v4.0.3 (no > option > > here) > > > > Everything seems to be working except the move_uploaded_file() function > (the > > most critical part) > > > > Anthing else to check? Is there a way to get a more descriptive error msg? > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to insert a variable into a PHP template.
- Original Message - From: "Steve Jackson" <[EMAIL PROTECTED]> To: "PHP General" <[EMAIL PROTECTED]> Sent: Monday, July 07, 2003 1:34 PM Subject: [PHP] How to insert a variable into a PHP template. > Hi, > > I want to write a PHP template with a variable number of the last > recordset in a MySQL DB being the number referenced in the file. This is > so my file can be saved as a PHP page looking at the right content in a > database for a content management system. I am stuck on the way to do > it. The code below is the part I want to change: > > So I need to do two things: > 1) Select the last record in a database table. mysql_insert_id(); > 2) get PHP to write all the code below on the fly. > > > db_connect(); > // This is the query number which needs to be changed and written every > time as the last record in the DB > $query = "select * from crm_content where PageID='1'"; > $result = mysql_query($query) or die("Error: Query failure > with$query".mysql_error()); > while ($array = mysql_fetch_array($result)) > { > $PageTitle = "{$array["Title"]}"; > $BodyText = "{$array["BodyText"]}"; > $Picture1 = "{$array["PictureOne"]}"; > $Picture2 = "{$array["PictureTwo"]}"; > $CatID = "{$array["CatID"]}"; > } > // then write the function to call the page here > // > > Any ideas thoughts or help much appreciated. > Can't help with this bit. Apart from putting it into a string and then writing it to a file. Regards Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Please Help !
> Hi, > > I know this is really basic but i have a form for users to enter the > date of an event that i would like to store in a mysql database how do i > get the users input into the database in the right format. > > For date validation I always use a javascript calendar thingy available from http://students.infoiasi.ro/~mishoo/site/calendar.epl It really is very good. Regards Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php.ini
Hi I had this problem when i installed php on my linux box. Because I hadn't copied & renamed php.ini-dist to php.ini, PHP seems to use a default setup and lists php.ini in the path where it expects to find it. I resolved it by copying php.ini-dist from the php source dir to the new dir and renaming it to php.ini - then modifying that. HTH Andrew McCombe > Steve have you tried to search the entire drive for the php.ini file? > > > - Original Message - > From: "Steve Marquez" <[EMAIL PROTECTED]> > To: "PHP eMail List" <[EMAIL PROTECTED]> > Sent: Wednesday, June 25, 2003 8:59 AM > Subject: [PHP] php.ini > > > > I am running MacOSX and can not find my php.ini file. Does anyone know > where > > it is located on a mac? > > > > I looked at my phpinfo file, and it says /usr/lib/ but does not have the > > php.ini file in it. > > > > Can anyone help? > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [] operator not supported for strings
Hi Can anyone tell me why i'm getting this error? Fatal error: [] operator not supported for strings in c:\inetpub\wwwroot\Iweb-sites\Exp\menu2.php on line 41 [code]: $rst2=sql_call("SELECT * FROM tmenu WHERE parent=".$r['id']); // now have array of corporate, entertainment and identity for ($i=0; $i < mysql_num_rows($rst2); $i++) { $r=mysql_fetch_array($rst2); $level2[$i] = $r['name']; $rst3 = sql_call("SELECT * FROM tmenu WHERE parent=".$r['id']); while ($a=mysql_fetch_array($rst3)) { $level2[$i][] = $a['name']; // giving error here } } [/code] Regards Andrew McCombe Interactive Web Solutions (Stafford) Tel: 01785 279921 - The contents of this e-mail and any attachments are confidential and may be legally privileged. If you have received this e-mail and you are not a named addressee, please inform us as soon as possible on +44 (0) 1785 279920 and then delete the e-mail from your system. If you are not a named addressee you must not copy, use, disclose, distribute, print or rely on this e-mail. Any views expressed in this e-mail or any attachments may not necessarily reflect those of Interactive Web Solutions' management. Although we routinely screen for viruses, addressees should scan this e-mail and any attachments for viruses. Interactive Web Solutions makes no representation or warranty as to the absence of viruses in this e-mail or any attachments. Please note that for the protection of our business, we may monitor and read e-mails sent to and from our server(s).
[PHP] mysql split?
Hi I have a field in mysql that has paths to files such as: project/entertainment/andrew/job/1.jpg project/corporate/roberts/job/1.jpg project/corporate/andrew/job/1.jpg project/identity/john/job/1.jpg The first level is always 'projects'. What I want to do is get the unique name for the 3rd level for all entertainment, corporate and identity, so from the data above I would get returned: andrew john roberts What's the best way to acheive this? I remember seeing something where you can split a field in the mysql into parts (ie, split at /)? or would a regex be better ('WHERE REGEX "^projects/corporate|entertainment|identity/' (this doesnt work))? Hope someone can help. Regards Andrew McCombe Interactive Web Solutions (Stafford) Tel: 01785 279921 - The contents of this e-mail and any attachments are confidential and may be legally privileged. If you have received this e-mail and you are not a named addressee, please inform us as soon as possible on +44 (0) 1785 279920 and then delete the e-mail from your system. If you are not a named addressee you must not copy, use, disclose, distribute, print or rely on this e-mail. Any views expressed in this e-mail or any attachments may not necessarily reflect those of Interactive Web Solutions' management. Although we routinely screen for viruses, addressees should scan this e-mail and any attachments for viruses. Interactive Web Solutions makes no representation or warranty as to the absence of viruses in this e-mail or any attachments. Please note that for the protection of our business, we may monitor and read e-mails sent to and from our server(s). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql split?
Does mysql have an explode function? I suppose this is the wrong place to ask... Andrew - Original Message - From: "Jay Blanchard" <[EMAIL PROTECTED]> To: "Andrew McCombe" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, June 27, 2003 5:08 PM Subject: RE: [PHP] mysql split? > use explode() > > -----Original Message- > From: Andrew McCombe [mailto:[EMAIL PROTECTED] > Sent: Friday, June 27, 2003 11:06 AM > To: [EMAIL PROTECTED] > Subject: [PHP] mysql split? > > > Hi > > I have a field in mysql that has paths to files such as: > > project/entertainment/andrew/job/1.jpg > project/corporate/roberts/job/1.jpg > project/corporate/andrew/job/1.jpg > project/identity/john/job/1.jpg > > The first level is always 'projects'. What I want to do is get the > unique > name for the 3rd level for all entertainment, corporate and identity, so > from the data above I would get returned: > > andrew > john > roberts > > What's the best way to acheive this? I remember seeing something where > you > can split a field in the mysql into parts (ie, split at /)? or would a > regex be better ('WHERE REGEX > "^projects/corporate|entertainment|identity/' > (this doesnt work))? Hope someone can help. > > > > > Regards > Andrew McCombe > Interactive Web Solutions (Stafford) > Tel: 01785 279921 > > > > > > - > The contents of this e-mail and any attachments are confidential and may > be legally privileged. If you have received this e-mail and you are not > a named addressee, please inform us as soon as possible on > +44 (0) 1785 279920 and then delete the e-mail from your system. If you > are > not a named addressee you must not copy, use, disclose, distribute, > print or rely on this e-mail. Any views expressed in this e-mail or any > attachments may not necessarily reflect those of Interactive Web > Solutions' > management. > Although we routinely screen for viruses, addressees should scan this > e-mail and any attachments for viruses. Interactive Web Solutions makes > no > representation or > warranty as to the absence of viruses in this e-mail or any attachments. > Please note that for the protection of our business, we may monitor and > read e-mails sent to and from our server(s). > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Here we go with PATHS - again!!
On Sat, 2003-06-28 at 23:27, Beauford.2005 wrote: > I hope someone can put this to rest for good, cause this is just > bullshit. Every time I try to do something using any thing other than > the root directory of my website - I get these stupid path problems. > > Here is the problem this time. First off I am not using frames (if it > matters) and this particular site is on Windows 2000. The website > resides in d:\Apache\htdocs\supreme and in this directory I have a .js > file for my drop-down menu - there is also another file which I am > including using the php include directive called menu.inc. The graphics > for the menu are in a directory called images. When I go to the main > page of the site everything is great, but as soon as I try to get the > menu to work from another directory it can't find the graphics. > > I have tried d:\Apache\htdocs\supreme\image.gif. > > I have tried http://www.mysite.com/images/image.gif. > > I have tried ../file.js (this is to load the menu) > > I have even tried putting menu.inc in my php include directory. > > You get the picture - but no matter what I try it just doesn't work. I > mean really - is this that hard to figure out. Like this is every time I > work on a site I get these path problems. Am I just not getting > something here. > > Other than putting everything in the root directory (which I don't want > to do) I have no idea how to solve this. It just gives me a headache. > > TIA Try escaping your paths with double slashes, ie, d:\\Apache\\htdocs\\supreme\\image.gif or d://Apache//htdocs//suprem//image.gif might work. Regards Andrew McCombe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and Macromedia Flash
On Sun, 2003-06-29 at 00:00, Daniel J. Rychlik wrote: > Does anyone know if you can dynamically update a flash swf file with a PHP script ? > > For instance in menu navigation I was thinking of using a flash object to display an > interactive menu and have in my main class a way to update the links or buttons from > page to page. > > Thanks in advance, > Dan Yes you can. I'm currently writing a script that uses php to pull info in from a mysql db and passes the results back to flash as xml. Don't ask me how the flash part works though, i don't do that part. Regards Andrew McCombe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] which GD
Hi My hosting company has disabled phpinfo(). How can I find out which version of GD they have installed? Regards Andrew McCombe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php