RE: [PHP] Weight function.
Thanks. I have just this minute got it working. Basically the same function I used for determining price of the cart items could be used for determining weight. All I needed to do was assign my DB with a field called weight and call that instead of price from the DB so my calculate weight function looks like this. function calculate_weight($cart) { // sum total weight for all items in shopping cart global $weight; $weight = 0.0; if(is_array($cart)) { $conn = db_connect(); foreach($cart as $ItemCode => $qty) { $query = "select weight from products where ItemCode='$ItemCode'"; $result = mysql_query($query); if ($result) { $item_weight = mysql_result($result, 0, "weight"); $weight +=$item_weight*$qty; } } } return $weight; } By making $weight a global variable I then call that in my shipping function and set it's parameters: function calculate_shipping_cost($weight) { //shipping costs calc. less than 10KG is 15 more than 10KG currently 20. global $shipping; if ($weight <= "1") $shipping = "15"; else $shipping = "20"; return $shipping; } I still don't fully understand why this works but am happy it does! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] People who searched this also searched this!
> Hi guys, > Does anybody have a working example of doing the lists of 'People who > searched this also searched this!' that I see on Amazon and other > websites. That is a very complex problem. It is not for PHP. PHP may only insert queries and get results and another system computers all data. Such system is based on statistic or artificial neuron nets. For example the company "Net Perceptions" makes such systems as NetP based on statistic but they are not very fast. If you would like to buy their system you would have to sell some good cars. -- Krzysztof Dziekiewicz -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] weird IE cookie problem
> Is the time set properly on your machine? Double check both the time AND > the timezone. I went nuts trying to fix a similar problem once just to > find out that someone had changed the timezone on the PC for a test and > then forgot to put it back. It is very easy to check. Set $expires = 0; It makes a session cookie independed from time set. If you set a session cookie you will know you have problem with time set. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] xml parsing
Hi! I understand that it's easily possible to parse xml documents with php. But what about changing them? With other xml parsers, I have the xml document in a structure (usually a tree or an array) and when I change something in the structure I can later "write out" the structure again into a xml file and get a changed xml file that way. Is this possible easily with PHP too? Thanks Mike --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.394 / Virus Database: 224 - Release Date: 03.10.2002 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Weight function.
On Thursday 17 October 2002 15:52, Steve Jackson wrote: > Thanks. > I have just this minute got it working. > Basically the same function I used for determining price of the cart > items could be used for determining weight. All I needed to do was > assign my DB with a field called weight and call that instead of price > from the DB so my calculate weight function looks like this. > > function calculate_weight($cart) > { > // sum total weight for all items in shopping cart > global $weight; > $weight = 0.0; > if(is_array($cart)) > { > $conn = db_connect(); > foreach($cart as $ItemCode => $qty) > { > $query = "select weight from products where ItemCode='$ItemCode'"; > $result = mysql_query($query); > if ($result) > { > $item_weight = mysql_result($result, 0, "weight"); > $weight +=$item_weight*$qty; > } > } > } > return $weight; See below > } > > By making $weight a global variable I then call that in my shipping > function and set it's parameters: By making $weight a global variable there is no need for "return $weight;" inside your function. And same for "return $shipping;" below. > function calculate_shipping_cost($weight) > { > //shipping costs calc. less than 10KG is 15 more than 10KG currently > 20. > > global $shipping; > if ($weight <= "1") > $shipping = "15"; > else > $shipping = "20"; > return $shipping; > > } > > I still don't fully understand why this works but am happy it does! -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* The solution of problems is the most characteristic and peculiar sort of voluntary thinking. -- William James */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Is this a bad thing to do? (Unix permissions)
As part of my new site I have created a php-driven guestbook. The guestbook entries are stored in a file called guestbook.txt. I found that in order to get the script to write to the file, I had to set the directory permissions for the guestbook directory and the guestbook.txt file to -rw-rw-rw- ... is that a bad thing to do? Does it expose me to any hacking problems? If so, what should I have done? Bear in mind I'm using a 3rd-party host and I work in Windows, so please don't blind me with science ;) Thanks, Gwydion -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: how to setup mysql logging from php scripts
In article <1034836283.1253.23.camel@dell>, [EMAIL PROTECTED] says... > Hi > I need to be able to see logs of all mysql queries from php scripts on > my server. > I have a multitude of virtual hosts on my RedHat server, with many mysql > db's, and would like to be able to see what queries are done against the > db's from which scripts. The reason being is that I suspect that some of > the scripts on some domains are causing problems, for example infinite > loop db queries etc. Yesterday again I had mysql freeze up completely on > the server, and the only "interaction" with mysql are from php scripts > on the various domains, so looking at the mysql.log file gives no help. > > Ideally I would like to see something like the following logged: > > time || path/to/script.php || sql_query || mysql_error > > or ANYthing that will help me to determine what went wrong. > At the moment I can merely blame the gremlins, and I don't know if it is > a poorly written script causing this or not, so I can't do anything > about the situation... > ANY suggestions or methods being used by ppl out there are also welcome. > > Thanks alot. Mysql has its own logging procedure - search the mysql site for any of the following topics: The MySQL Log Files MySQL has several different log files that can help you find out what's going on inside mysqld: Log fileDescription The error log Problems encountering starting, running or stopping mysqld. The isam logLogs all changes to the ISAM tables. Used only for debugging the isam code. The query log Established connections and executed queries. The update log Deprecated: Stores all statements that changes data The binary log Stores all statements that changes something. Used also for replication The slow logStores all queries that took more than long_query_time to execute or didn't use indexes. All logs can be found in the mysqld data directory. You can force mysqld to reopen the log files (or in some cases switch to a new log) by executing FLUSH LOGS. See FLUSH. Error log The Error Log Query log The General Query Log Update log The Update Log Binary log The Binary Update Log Slow query log The Slow Query Log Log file maintenanceLog File Maintenance Sorry about the crappy copy/paste, but that's what comes out of the .hlp file. -- David Robley Temporary Kiwi! Quod subigo farinam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fopen error
if allow_url_fopen is not on, you can still use fsockopen(), and no it doesn't affect security, if you don't open files based on unchecked user input. Alfonso Ballesteros wrote: >Hello > >I'm a newcomer to PHP and I wish to know how to get the contents of a file >located in an URL if the parameter allow_url_fopen is "no value" in the >php.ini file. > >Does this parameter, if is "on", affect the security of the server? > >Thanks in advance > >Alfonso > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Weight function.
I'm using both variables called in another page. Taking globals off causes weight not to be calculated in the shipping cost? Steve Jackson Web Developer Viola Systems Ltd. http://www.violasystems.com [EMAIL PROTECTED] Mobile +358 50 343 5159 > -Original Message- > From: Jason Wong [mailto:[EMAIL PROTECTED]] > Sent: 17. lokakuuta 2002 12:39 > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Weight function. > > > On Thursday 17 October 2002 15:52, Steve Jackson wrote: > > Thanks. > > I have just this minute got it working. > > Basically the same function I used for determining price of > the cart > > items could be used for determining weight. All I needed to do was > > assign my DB with a field called weight and call that > instead of price > > from the DB so my calculate weight function looks like this. > > > > function calculate_weight($cart) > > { > > // sum total weight for all items in shopping cart > > global $weight; > > $weight = 0.0; > > if(is_array($cart)) > > { > > $conn = db_connect(); > > foreach($cart as $ItemCode => $qty) > > { > > $query = "select weight from products where > ItemCode='$ItemCode'"; > > $result = mysql_query($query); > > if ($result) > > { > > $item_weight = mysql_result($result, 0, "weight"); > > $weight +=$item_weight*$qty; > > } > > } > > } > > return $weight; > > See below > > > } > > > > By making $weight a global variable I then call that in my shipping > > function and set it's parameters: > > By making $weight a global variable there is no need for > "return $weight;" > inside your function. And same for "return $shipping;" below. > > > > function calculate_shipping_cost($weight) > > { > > //shipping costs calc. less than 10KG is 15 more than > 10KG currently > > 20. > > > > global $shipping; > > if ($weight <= "1") > > $shipping = "15"; > > else > > $shipping = "20"; > > return $shipping; > > > > } > > > > I still don't fully understand why this works but am happy it does! > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications > Development * > > /* > The solution of problems is the most characteristic and > peculiar sort of voluntary thinking. > -- William James > */ > > > -- > 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] php/frontpage
I'm not 100% sure, but I think the answer you seek lies in the server, and not php. You may have to set your webserver to reconize *.php as FP files that it needs to parse, or set it to where it parses *.htm for php. Is this running on IIS, Apache, or something else? Shaun wrote: > Hi , > > I used ms frontpage 2000 to make a website. When > i comepleted the site , i had to study php to enable database > capabilities. When i changed my login.htm file into login.php, > ms frontpage did not recognize the .php file. All the navigational > links/views were removed from the login.php file. Can i enable frontpage > to work with php. > > if not , what program would you use ? > > Thanks ,Shaun > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Get the string in between two other strings
"Cameron Cooke" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]... > Hi, > > I need a function to get a string in between two other strings. So you would > give the function the string to search and then you pass the first string > and last string, and the function will return the string in between. > > Does anyone have this, or know how to do it. I tried but could not get it to > work. will substr() - http://au.php.net/manual/en/function.substr.php suit your needs? if not check out: http://au.php.net/manual/en/ref.regex.php and http://au.php.net/manual/en/ref.pcre.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] shopping cart, inventory control, point of sale system
can anyone point me in the direction of a good system that will cover all 3 of these points (Shopping Cart, Inventory Control, and Point of Sale) ? Thank you, **DAN** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php/frontpage
Yes. Frontpage can edit php files ( albeit not very gracfully ). So, if you must ... Open Front Page Select Tools | Options Select the Configure Editors tab and add the .php extension. HTH, Randy -Original Message- From: Shaun [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 17, 2002 8:50 AM To: [EMAIL PROTECTED] Subject: [PHP] php/frontpage Hi , I used ms frontpage 2000 to make a website. When i comepleted the site , i had to study php to enable database capabilities. When i changed my login.htm file into login.php, ms frontpage did not recognize the .php file. All the navigational links/views were removed from the login.php file. Can i enable frontpage to work with php. if not , what program would you use ? Thanks ,Shaun -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Get the string in between two other strings
On Thu, 17 Oct 2002, Cameron Cooke wrote: >-I have looked at these, and they make no sense to me. I tried the substr >-function, but it all went a bit pear shaped. Try something like this, you can deal with the linewraps ;) Reference: http://au.php.net/manual/en/function.strpos.php http://au.php.net/manual/en/function.substr.php http://au.php.net/manual/en/function.strlen.php First Position = $positionFirstString"); $positionSecondString = strpos($haystackText, $secondString); print("Second Position = $positionSecondString"); if ( $positionFirstString < $positionSecondString ) { $firstLength = strlen($firstString); $diffBetweenStringPositions = $positionSecondString - $positionFirstString - $firstLength; $resultText = substr($haystackText,$positionFirstString+$firstLength,$diffBetweenStringPositions); } else { $secondLength = strlen($secondString); $diffBetweenStringPositions = $positionFirstString - $positionSecondString - $secondLength; $resultText = substr($haystackText,$positionSecondString+$secondLength,$diffBetweenStringPositions); } print("$haystackText$resultText"); ?> >- >-Cameron >- >- >-"Noodle Snacks" <[EMAIL PROTECTED]> wrote in message >-[EMAIL PROTECTED]">news:[EMAIL PROTECTED]... >-> >-> "Cameron Cooke" <[EMAIL PROTECTED]> wrote in message >-> news:[EMAIL PROTECTED]... >-> > Hi, >-> > >-> > I need a function to get a string in between two other strings. So you >-> would >-> > give the function the string to search and then you pass the first >-string >-> > and last string, and the function will return the string in between. >-> > >-> > Does anyone have this, or know how to do it. I tried but could not get >-it >-> to >-> > work. >-> >-> will substr() - http://au.php.net/manual/en/function.substr.php suit your >-> needs? >-> >-> if not check out: >-> >-> http://au.php.net/manual/en/ref.regex.php >-> >-> and >-> >-> http://au.php.net/manual/en/ref.pcre.php >-> >-> >- >- >- >--- >-PHP General Mailing List (http://www.php.net/) >-To unsubscribe, visit: http://www.php.net/unsub.php >- ** John Huggins VANet [EMAIL PROTECTED] http://www.va.net/ ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL GMT --> Local time
> My logging application is feeding a MySQL database with data records > that are time stamped with GMT time. I would like to query the database > for records matching local time(eg. all records created on oct > 17,2002 local time). I would prefer if the records could be formated > in local time when returned from MySQL. What is the best way to do this. I don't know if there is an automatic way to do it, but if you know you are 5 hours ahead of GMT for example, and you want all records for Oct 17, 2002 GMT+5, then you could do this: SELECT * FROM your_table WHERE TO_DAYS(datetime_column + INTERVAL 5 HOUR) = TO_DAYS(20021017) You can use DATE_FORMAT() in your query to reformat the MySQL timestamp, or use UNIX_TIMESTAMP() to retrieve a unix timestamp instead and format it in PHP. With the above query, the "5" and actual date "20021017" can be PHP variables, to make it more flexible. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] shopping cart, inventory control, point of sale system
A web based interface is pretty slow for POS isn't it??? phpshop.org might be a good start on the other two... justin on 17/10/02 11:56 PM, Daniel Negron/KBE ([EMAIL PROTECTED]) wrote: > can anyone point me in the direction of a good system that will cover all 3 > of these points (Shopping Cart, Inventory Control, and Point of Sale) ? > > > Thank you, > > **DAN** > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Which one? Firebird or mysql for php
> I am working on a project which has plenty Gigabytes of data. > I heard something about firebird. > Is it much better than mysql? > Can anybody compare the odds of both of them? > Is it easy to use firebird from php? > Thanx... What kind of data are you storing? Is it going to be mostly reads or writes or a mix? What are you going to do with the data? Each database is good at different things... ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Downloads
> I know that php allows uploading , but does it support downloading. > > I want users to be able to download from my site , how do i go to work. > > Please send me sample of code if possible. Yes, it does. Click here to download ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Get the string in between two other strings
I have looked at these, and they make no sense to me. I tried the substr function, but it all went a bit pear shaped. Cameron "Noodle Snacks" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > "Cameron Cooke" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED]... > > Hi, > > > > I need a function to get a string in between two other strings. So you > would > > give the function the string to search and then you pass the first string > > and last string, and the function will return the string in between. > > > > Does anyone have this, or know how to do it. I tried but could not get it > to > > work. > > will substr() - http://au.php.net/manual/en/function.substr.php suit your > needs? > > if not check out: > > http://au.php.net/manual/en/ref.regex.php > > and > > http://au.php.net/manual/en/ref.pcre.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Get the string in between two other strings
Hi, Thursday, October 17, 2002, 10:33:43 PM, you wrote: CC> I have looked at these, and they make no sense to me. I tried the substr CC> function, but it all went a bit pear shaped. Here is a way that will handle line breaks which tend to stuff up the string functions: "; echo "Str1: '$str1' "; echo "Str2: '$str2' "; echo "Extracted: '".find_string($string,$str1,$str2)."'"; -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re:[PHP] fopen error
First of all... thanks for trying to help... I'll show the full piece of code I made : $file = "http://www.ivan.ivao.org/whazzup.txt";; $fp = fsockopen($file, 80); if (!$fp) { echo "does not open"; } else { echo $fp; -> Here is what I say it does't return anything. This line is just to figure out what fsockopen() returns. while (!feof($fp)) { echo fgets ($fp,500); } fclose ($fp); } Thanks again Alfonso == What do you mean "it returns nothing?" fsockopen() returns a file handle. Was the file handle valid, i.e., not 0? If true, then you must READ from the opened file handle. Please, be more specific in your error discussion. Original Message - From: "Alfonso Ballesteros" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, October 17, 2002 6:58 AM Subject: Re: [PHP] fopen error I'm still stuck with this... Using fsockopen() I'm not able to open the remote file. I use $file = "http://www.xxx.xxx/file.txt";; $fp = fsockopen($file, 80); and $fp returns nothing... Any idea? Alfonso "Marek Kilimajer" <[EMAIL PROTECTED]> escribió en el mensaje [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > if allow_url_fopen is not on, you can still use fsockopen(), and no it > doesn't affect security, if you don't open files based on unchecked user > input. > > Alfonso Ballesteros wrote: > > >Hello > > > >I'm a newcomer to PHP and I wish to know how to get the contents of a file > >located in an URL if the parameter allow_url_fopen is "no value" in the > >php.ini file. > > > >Does this parameter, if is "on", affect the security of the server? > > > >Thanks in advance > > > >Alfonso > > > > > > > > > > > -- 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] php/frontpage
Hi , I used ms frontpage 2000 to make a website. When i comepleted the site , i had to study php to enable database capabilities. When i changed my login.htm file into login.php, ms frontpage did not recognize the .php file. All the navigational links/views were removed from the login.php file. Can i enable frontpage to work with php. if not , what program would you use ? Thanks ,Shaun -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calendar System
http://myphpcalendar.sourceforge.net/
[PHP] Re: shopping cart, inventory control, point of sale system
You may find something in www.oscommerce.com Daniel Negron/Kbe wrote: > can anyone point me in the direction of a good system that will cover all 3 > of these points (Shopping Cart, Inventory Control, and Point of Sale) ? > > > Thank you, > > **DAN** > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] xml parsing
Change xml into a different type of xml sounds like a job for the xslt functions. Works like a charm Michael Ransburg wrote: >Hi! > >I understand that it's easily possible to parse xml documents with php. >But what about changing them? With other xml parsers, I have the xml >document in a structure (usually a tree or an array) and when I change >something in the structure I can later "write out" the structure again >into a xml file and get a changed xml file that way. Is this possible >easily with PHP too? > >Thanks >Mike > >--- >Outgoing mail is certified Virus Free. >Checked by AVG anti-virus system (http://www.grisoft.com). >Version: 6.0.394 / Virus Database: 224 - Release Date: 03.10.2002 > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] E-Commerce interfacing...
What is a good service to process credit card numbers for an E-Commerce site? To be specific I mean an easy interface with a PHP based system (maybe even sample code) eg works well with curl... and second any personal recommendations... -- JJ Harrison [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL GMT --> Local time
On Thu, 17 Oct 2002, 1LT John W. Holmes wrote: > > My logging application is feeding a MySQL database with data records > > that are time stamped with GMT time. I would like to query the database > > for records matching local time(eg. all records created on oct > > 17,2002 local time). I would prefer if the records could be formated > > in local time when returned from MySQL. What is the best way to do this. > > I don't know if there is an automatic way to do it, but if you know you are > 5 hours ahead of GMT for example, and you want all records for Oct 17, 2002 > GMT+5, then you could do this: > > SELECT * FROM your_table WHERE TO_DAYS(datetime_column + INTERVAL 5 HOUR) = > TO_DAYS(20021017) > > You can use DATE_FORMAT() in your query to reformat the MySQL timestamp, or > use UNIX_TIMESTAMP() to retrieve a unix timestamp instead and format it in > PHP. With the above query, the "5" and actual date "20021017" can be PHP > variables, to make it more flexible. > > ---John Holmes... > Where it gets messy is when daylight saving kicks in. Knowing what dates are included with standard or daylight savings time offsets is a problem. It gets more complicated when I want to return a distinct date record set from the timestamp column. Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Alt tags in rollover buttons
Is there any way to create ALT tags in secondary nav bars with rollover images? (NOF 7) Thanks in advance, Brad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php