[PHP] Advice needed - general (GPS, databases, webs etc.)

2010-05-15 Thread SED
Hi,

 

I'm in the search for resources for the next step in the information's age.
I think smartphones with GPS and the internet will be THE BIG BUSINESS next
years.

 

Because this is hard business I'm not able to get overview and resources
handly, except by selling my soul to the big companies. There is so much
information on the internet that one person can not find what out what is
real and what is not.

 

Can you send me links regarding GPS, maps, smartphones that PHP programmers
focus on? I'm asking for useful information at advanced level, even though
it links to other programming languages, graphics or big companies.

 

Regards, 

Summi

from Iceland (...where the volcano stopped the world) J



Re: [PHP] Advice needed: implementing custom fields in tables

2006-12-15 Thread Richard Lynch
On Tue, December 12, 2006 8:23 am, Denis Gerasimov wrote:
 I am in a need of implementing custom/used-defined fields mechanism.
 What I
 need is adding new fileds to a db table on-the-fly.

 There are 2 possible options I know:

 1.   Add a fixed set of text columns named custom_01, custom_02,
 etc.

 2.   Alter db tables dynamically by adding/dropping a column of
 appropriate type and creating/dropping helper tables if needed (e.g.
 values
 for select lists)

The usual answer is to create a single table of user-defined fields,
and put the field_name - field_data relationship into that.

You have an extra table to JOIN to all your queries, but it works
tolerably well for most usage.

You may want to find out if there is a Joomla approved approach or
something as well, by posting in a Joomla forum.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Advice needed: implementing custom fields in tables

2006-12-12 Thread Denis Gerasimov
Hello list members,

 

I am in a need of implementing custom/used-defined fields mechanism. What I
need is adding new fileds to a db table on-the-fly.

 

There are 2 possible options I know:

1.   Add a fixed set of text columns named custom_01, custom_02, etc.

2.   Alter db tables dynamically by adding/dropping a column of
appropriate type and creating/dropping helper tables if needed (e.g. values
for select lists)

 

1st option is not suitable for in my case because of performance issues.

2nd is relatively hard to implement from scratch.

 

Any ready-to-use libs or implementation ideas would be highly appreciated!

 

FYI I am using Joomla! CMS and actually I need to create a Joomla! component
that should also support user-defined fields.

 

Have a great day,

 

Denis S Gerasimov 
Web Developer
Team Force LLC

Web:http://www.team-force.org/ www.team-force.org

RU  Int'l:   +7 8362-213555

email:[EMAIL PROTECTED]

 



Re: [PHP] Advice needed: implementing custom fields in tables

2006-12-12 Thread Jochem Maas
Denis Gerasimov wrote:
 Hello list members,
 
  
 
 I am in a need of implementing custom/used-defined fields mechanism. What I
 need is adding new fileds to a db table on-the-fly.
 
  
 
 There are 2 possible options I know:
 
 1.   Add a fixed set of text columns named custom_01, custom_02, etc.
 
 2.   Alter db tables dynamically by adding/dropping a column of
 appropriate type and creating/dropping helper tables if needed (e.g. values
 for select lists)
 
  
 
 1st option is not suitable for in my case because of performance issues.

1 is a horrid solution but I can't see how this is such a performance issue.
(not to say the issue does'nt exist, it's just that I don't see it)

 
 2nd is relatively hard to implement from scratch.

I would suggest this is easier than you imagine (you can grok all the required 
SQL
from the output of phpmyadmin, for instance) - the tricky part is getting the
database security right (which is more PITA than hard imho)

 Any ready-to-use libs or implementation ideas would be highly appreciated!
 

3. offer an interface to define the custom fields, store the definition 
somewhere central
and use the definition to define an array (or object) which you can then 
serialize into a single
field.

4. use a 'lookup' table and a 'custom field definition' table

'lookup':

ownerid int // FK to whatever entity owns the custom fields
CFD_id  int // FK to 'custom field definition'
value   varchar 

'custom field definition':
id  int
namevarchar
typevarchar

you might want to create a set of lookup tables (1 for each *type* of custom 
data
you are offering the enduser) - this may offer more efficient storage and 
retrieval.



anything that is ready to use can be found via your favorite search engine, or 
sourceforge
or something like that.

 
 FYI I am using Joomla! CMS and actually I need to create a Joomla! component
 that should also support user-defined fields.

you mean to say joomla doesn't have a plugin for this at all??

 
  
 
 Have a great day,

too late, my Jean-Luc Picard has already been assimilated.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Advice Needed for Klorofil Open Source PHP Platform

2005-11-28 Thread Reza Iqbal
Hi,

I would like to give information about a new open source project
named as Klorofil Collaboration Project (http://www.klorofil.org).

As a new open source project, we will need many advice in order
to make it success.

Currently, in Klorofil Collaboration Project, we develop
Klorofil Platform. One of the component of Klorofil Platform
is gambArt (a GUI framework for developing PHP-based desktop application).

We have published initial release. In the initial release,
we provide Klorofil Platform installer + a desktop calculator as
sample.

This desktop calculator was made 100% with PHP (using gambArt).

For more information, you can visit http://www.klorofil.org/


In the next release, we will add more features such as:
- Distributed Computing
- MVC
- etc

We do hope this project will be useful for PHP community.
We hope many people will join the project.

Here are features available
in the initial release:

Initial Release version 0.1 (for Windows):

- Klorofil Platform Basic Structure
* Class Registration
* Application Launcher
* Collection Classes
* I/O Classes
* Network Classes
+ Socket
+ HTTP
+ Email
+ SMS
* Compression
* Byte Compiler
* XML

- gambArt (Klorofil GUI)
* Basic Structure
+ Application
+ Canvas
+ Component
+ Control
+ Form
* Component
+ Button
+ Flat Button
+ Label
+ Edit
+ Dialog
+ Radio Button
+ CheckBox
+ Panel
+ Image
+ ListBox
+ DropDownBox
+ PageControl
+ ToolBar
+ MainMenu
+ Timer


Thank you.

R. Iqbal

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Advice Needed for Klorofil Open Source PHP Platform

2005-11-28 Thread Ahmed Saad
On 11/28/05, Reza Iqbal [EMAIL PROTECTED] wrote:
 As a new open source project, we will need many advice in order
 to make it success.


ah an open source project with encoded source code?! how come?

-ahmed


Re: [PHP] Advice Needed

2004-02-20 Thread Richard Davey
Hello daniel,

Friday, February 20, 2004, 6:10:28 AM, you wrote:

deo Hi there, i have finally built a project space for work, its a collaborate
deo space for storing important key documents (not public), what is the best
deo way to store these, outside the web directory or would it be safe within a
deo htaccess protected directory ? Being that to access that directory i would
deo have to send the login and pass to the link of the file which i fopen up
deo and either header output to the browser or download.

If you're going to open the files via fopen on the local filesystem,
your htaccess settings have no implication on this at all. For files
like this I store them outside of the web root and fopen them from my
PHP script and stream them to the browser. That is on a dedicated
server where I know no-one has access to the directory they are stored
in and it can never be found via the web server. Your mileage may
vary.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Advice Needed

2004-02-20 Thread electroteque
Done, outside the webby is the goer, then i dont have to worry this the
hassle of getting a simple allowovedrride rule in the fukn conf file, which
has seem to be a simple process i could do but then a complicated process
with all the politics :\

The server is dedicated work serve their own servers.

Just that its public accessable and that its private documents and that
there are htaccess hacking tools out there scares me heheh.

-Original Message-
From: Richard Davey [mailto:[EMAIL PROTECTED]
Sent: Friday, February 20, 2004 9:48 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Advice Needed


Hello daniel,

Friday, February 20, 2004, 6:10:28 AM, you wrote:

deo Hi there, i have finally built a project space for work, its a
collaborate
deo space for storing important key documents (not public), what is the
best
deo way to store these, outside the web directory or would it be safe
within a
deo htaccess protected directory ? Being that to access that directory i
would
deo have to send the login and pass to the link of the file which i fopen
up
deo and either header output to the browser or download.

If you're going to open the files via fopen on the local filesystem,
your htaccess settings have no implication on this at all. For files
like this I store them outside of the web root and fopen them from my
PHP script and stream them to the browser. That is on a dedicated
server where I know no-one has access to the directory they are stored
in and it can never be found via the web server. Your mileage may
vary.

--
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Advice Needed

2004-02-19 Thread daniel
Hi there, i have finally built a project space for work, its a collaborate
space for storing important key documents (not public), what is the best
way to store these, outside the web directory or would it be safe within a
htaccess protected directory ? Being that to access that directory i would
have to send the login and pass to the link of the file which i fopen up
and either header output to the browser or download.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Replicate MSAcces form with sub-forms to PHP? Advice needed.

2003-06-10 Thread Apollo (Carmel Entertainment)
I am trying to convert MSAccess form (that have sub-forms) to PHP and can't seem
to figure out a solution. Anyone done anything like this before, the
sub-queries/sub-forms with PHP? Any examples?

Apolinaras Apollo Sinkevicius
Carmel Music  Entertainment, LLC  
 web-site:  http://carmelme.com 

Having an event in Chicago, or would you like to bring Chicago entertainment 
to your event? Give Carmel Music  Entertainment a call for the finest 
entertainment available in Chicago.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Advice needed

2002-07-13 Thread Mike Tuller

After much thought, I think I have figured out what I am going to do. I am
going to create on the first page, a place to add the hardware type, and
that will add a row to the database, and create the key I need. It will then
go to another page where I can enter the information, and I will have the
key to be able to do the volume stuff that I want. So I would have a
dropdown menu to select the type of hardware and and add hardware button
only.

This would also allow me to make this front end more customizable. For
instance if I have a drop down that contains workstation, server, printer,
etc. I could write the code so that when workstation is selected, and I hit
add, it brings up the page to enter workstation information. If I select
printer, then I can enter printer information. If later I decide to add
other items, even if they aren't computer related, I could with ease.

If anyone see a problem with this idea, let me know. I think this would
work, but I haven't started coding yet.

Mike

- Original Message -
From: Alberto Serra [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, July 12, 2002 10:35 PM
Subject: Re: [PHP] Advice needed


 ðÒÉ×ÅÔ!

 Mike Tuller wrote:
  So I would have the progressive key inside the addvolume window? Can you
  explain how to go about doing this?

 How you organize your HTML output should *never* interfere with the way
 you organize your data, they are two different things and must be kept
 well separated. In a perfect world design, process flow and datamodeling
 should be free to evolve without stepping into each other's way. It's
 obviously impossible to fully meet this condition in the real world, but
 one should always try and get as close to it as he can.

 Just do this:

 Think of your data as a temporary table, in which you have two keys:
 1) the real key, whenever available (will be blank on the stuff you
 haven't written in the database yet)
 2) a progressive key, assigned by your php scripts by some means

 You just have the two keys constantly in your forms as hidden fields, so
 that at process time you can still tell which is which when it comes to
 relations, even if you do not have an already established relation
 system (which is the case on new data).

 So:
 you load your hdw components, they all have a db id already, so your
 dataset will look like this:

 1) hdw 1, its real id, your own internal key (say 1), rest of the data
 2) hdw 2, its real id, your own internal key (say 2), rest of the data
 ...

 you add a new component and save the result on a temporary table, now
 your temporary dataset is:

 1) hdw 1, its real id, your own internal key (say 1), rest of the data
 2) hdw 2, its real id, your own internal key (say 2), rest of the data
 3) hdw new, no real id, your own internal key (say 3), rest of the data
 ...

 You add a new volume and stock the data on a second temporary table,
 which contains:

 1) vol 1, no real id, your own hdw internal key (should be 3 since you
 are adding to the last new hdw), your own internal volume id (say 1),
 rest of the data

 You can repeat this step all over as much as you want (like fully
 building up a number of new disks, volumes or whatever), and have it as
 multilayered as you want (it will just take as many temporary tables as
 are the real tables involved).

 Once your user finally reviews his/her data (say you entered a totally
 new system, reviewed it and felt satisfied with it) he will have a
 fire button somewhere.

 At this point your final script just takes the data off the temporary
 tables and uses them to build the real thing.

 Notice that this way you also sort of implemented a transaction. Not a
 real one, since it will not protect you if your final script fails at
 runtime. Yet you can be sure no unconsistent data from unterminated
 sessions will ever enter your stable datamodel, and that's were 99.99%
 of the risk would come from.

 ðÏËÁ
 áÌØÂÅÒÔÏ
 ëÉÅ×


 @-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@

 LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu?
 lOrD i'M sHiNiNg...
 YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE
 tHe TeSt, YeS iT iS
 ThE tEsT, yEs It Is
 tHe TeSt, YeS iT iS
 ThE tEsT, yEs It Is...


 --
 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] Advice needed

2002-07-13 Thread Analysis Solutions

On Sat, Jul 13, 2002 at 11:13:38AM -0500, Mike Tuller wrote:
 After much thought, I think I have figured out what I am going to do. I am
 going to create on the first page, a place to add the hardware type, and
 that will add a row to the database, and create the key I need. It will then
 go to another page where I can enter the information

Sounds like you could end up with a situation with incomplete input
validation.  If certain fields are required, you might not get them
when someone enters the first entry, but doesn't do the rest of the 
entry procedure.  Not that big a deal if you're the person doing all 
the entry, I guess.

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Advice needed

2002-07-12 Thread Mike Tuller

I am trying to develop a front end to a database that will be used for entering 
information about the computer systems I take care of. It would be easy to do if it 
weren't for one problem. I want to list information about the drives that are in each 
system. There could be one, two, or 10 drives, so I want to have it generate a new 
table row for each drive. That I can do. The issue I run into is how best to create 
the interface. Right now I have a page where everything is entered on one page. 

I have two tables in the database. One for the basic hardware information, and one for 
the volume information. The volume table has a field for the hardwareID so that I can 
tie the volumes to the hardware, and with a separte table, I can have as many drives 
as I want. The problem with this is that when I click on a hyperlink to open a window 
for adding a volume, I need a hardwareID to be able to tie the volume information to 
the hardware. The hardwareID is created in MySql when the information entered for the 
hardware is submitted, which hasn't been done yet.

I could break this up into multiple pages, where I enter the basic information, and 
then I will have an ID created to use so that I can add the volumes, but this could 
get messy. Is there a better way of doing this?

This is confusing to follow, I know. Here is a link to the page I am talking about so 
that you can get an idea of what I am talking about. 
http://bowser.homedns.org/assets/addasset.html  About 1/3 the way down, you will see 
an Add Volume link that will take you to the addvolume page.

Thanks in advance,

Mike



Re: [PHP] Advice needed

2002-07-12 Thread Alberto Serra

ðÒÉ×ÅÔ!

Mike Tuller wrote:
 The hardwareID is created in MySql when the information entered for the hardware is 
submitted, which hasn't been done yet.

You don't need it immediately. Just have a progressive key (like 
1,2,3,4...) stored in a hidden field along with the new info you are 
getting. Once you'll process the final result you will substitute it 
with the values assigned by your DB engine. Sort of temporary primary 
key, if you want :)

ðÏËÁ
áÌØÂÅÒÔÏ
ëÉÅ×

-_=}{=_-@-_=}{=_--_=}{=_-@-_=}{=_--_=}{=_-@-_=}{=_--_=}{=_-

LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu?
lOrD i'M sHiNiNg...
YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE
tHe TeSt, YeS iT iS
ThE tEsT, yEs It Is
tHe TeSt, YeS iT iS
ThE tEsT, yEs It Is...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Advice needed

2002-07-12 Thread Mike Tuller

So I would have the progressive key inside the addvolume window? Can you
explain how to go about doing this?


- Original Message -
From: Alberto Serra [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, July 12, 2002 8:56 PM
Subject: Re: [PHP] Advice needed


 ðÒÉ×ÅÔ!

 Mike Tuller wrote:
  The hardwareID is created in MySql when the information entered for the
hardware is submitted, which hasn't been done yet.

 You don't need it immediately. Just have a progressive key (like
 1,2,3,4...) stored in a hidden field along with the new info you are
 getting. Once you'll process the final result you will substitute it
 with the values assigned by your DB engine. Sort of temporary primary
 key, if you want :)

 ðÏËÁ
 áÌØÂÅÒÔÏ
 ëÉÅ×

 @-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@

 LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu?
 lOrD i'M sHiNiNg...
 YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE
 tHe TeSt, YeS iT iS
 ThE tEsT, yEs It Is
 tHe TeSt, YeS iT iS
 ThE tEsT, yEs It Is...


 --
 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] Advice needed

2002-07-12 Thread Analysis Solutions

Mike:

You MUST store the hardware information first so you can get the actual 
HardwareID determined by the hardware table's auto increment field.  
Any other way you do it you leave open the possibility for error.

On your main hardware page, I'd make the Volume Information section
have conditional text.  If the presently viewed page is for a new piece
of hardware, show a note saying something like Save the hardware
information.  Then you can input the volumes.  But, if the hardware
page is displaying the data for an existing piece of hardware, the Add
Volume link would be shown.  The link would have a HardwareID in the
URI query string.

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Advice needed

2002-07-12 Thread Alberto Serra

ðÒÉ×ÅÔ!

Mike Tuller wrote:
 So I would have the progressive key inside the addvolume window? Can you
 explain how to go about doing this?

How you organize your HTML output should *never* interfere with the way 
you organize your data, they are two different things and must be kept 
well separated. In a perfect world design, process flow and datamodeling 
should be free to evolve without stepping into each other's way. It's 
obviously impossible to fully meet this condition in the real world, but 
one should always try and get as close to it as he can.

Just do this:

Think of your data as a temporary table, in which you have two keys:
1) the real key, whenever available (will be blank on the stuff you 
haven't written in the database yet)
2) a progressive key, assigned by your php scripts by some means

You just have the two keys constantly in your forms as hidden fields, so 
that at process time you can still tell which is which when it comes to 
relations, even if you do not have an already established relation 
system (which is the case on new data).

So:
you load your hdw components, they all have a db id already, so your 
dataset will look like this:

1) hdw 1, its real id, your own internal key (say 1), rest of the data
2) hdw 2, its real id, your own internal key (say 2), rest of the data
...

you add a new component and save the result on a temporary table, now 
your temporary dataset is:

1) hdw 1, its real id, your own internal key (say 1), rest of the data
2) hdw 2, its real id, your own internal key (say 2), rest of the data
3) hdw new, no real id, your own internal key (say 3), rest of the data
...

You add a new volume and stock the data on a second temporary table, 
which contains:

1) vol 1, no real id, your own hdw internal key (should be 3 since you 
are adding to the last new hdw), your own internal volume id (say 1), 
rest of the data

You can repeat this step all over as much as you want (like fully 
building up a number of new disks, volumes or whatever), and have it as 
multilayered as you want (it will just take as many temporary tables as 
are the real tables involved).

Once your user finally reviews his/her data (say you entered a totally 
new system, reviewed it and felt satisfied with it) he will have a 
fire button somewhere.

At this point your final script just takes the data off the temporary 
tables and uses them to build the real thing.

Notice that this way you also sort of implemented a transaction. Not a 
real one, since it will not protect you if your final script fails at 
runtime. Yet you can be sure no unconsistent data from unterminated 
sessions will ever enter your stable datamodel, and that's were 99.99% 
of the risk would come from.

ðÏËÁ
áÌØÂÅÒÔÏ
ëÉÅ×


-_=}{=_-@-_=}{=_--_=}{=_-@-_=}{=_--_=}{=_-@-_=}{=_--_=}{=_-

LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu?
lOrD i'M sHiNiNg...
YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE
tHe TeSt, YeS iT iS
ThE tEsT, yEs It Is
tHe TeSt, YeS iT iS
ThE tEsT, yEs It Is...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Advice Needed

2002-04-08 Thread pong-TC

Hello All

We are planning to install Unix-Like system on our old PC.  I don't know
which one I should go among FreeBSD, Redhat, and Suse.  I'd like a very
easy installation, specially on a network configuration part.  Which is
good?

Thank you.
POng 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Advice needed

2002-03-22 Thread James Newkid

Sorry couldn't think of a better subject for this email :(

This has stumped 7 people so far. I'm not an expert with php, but any help 
would be great.

I have the following

$Quantity1
$Quantity2
$Quantity3

and

$Price1
$Price2
$Price3

These variables will eventually make a chart/database with the following 
headings
q1 q2 q3 q5 q10 q15 q20 q25 q50 q100 q300 q500 q600 q10
the number represents the number of quantity

so $Quantity1 uses $Price1 's value

so if $Quantity1 is 10
and $Price1 is $1.00
that means each unit is .10

so the output would be
q1 q2 q3 q5 q10 q15 q20 q25 q50 q100 q300 q500 q600 q10
0  0  0  0  .10 .10 .10 .10 .10 .10  .10  .10  .10  .10

Now the tricky part is $Quantity2 can either be blank or have a value
and if $Quantity2 has a value then $Quantity3 can either be blank or have a 
value

SO If $Quantity2 is 500
and $Price2 is $40.00
the output would now be
q1 q2 q3 q5 q10 q15 q20 q25 q50 q100 q300 q500 q600 q10
0  0  0  0  .10 .10 .10 .10 .10 .10  .10  .08  .08  .08

I think and hope you get the picture.

Things we know If there is no value for $Quantity2 then there will be no 
$Quantity3
and of course if either or both of those quantities are empty there will be 
no price.
And of course if there is a value for either of those quantities, there will 
be a price.


So what method would be best for doing this? Any functions that may come in 
handy?








_
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Advice needed

2002-03-22 Thread Daniel Tryba

On Sat, Mar 23, 2002 at 05:19:05AM +, James Newkid wrote:
 so if $Quantity1 is 10
 and $Price1 is $1.00
 that means each unit is .10
 
 so the output would be
 q1 q2 q3 q5 q10 q15 q20 q25 q50 q100 q300 q500 q600 q10
 0  0  0  0  .10 .10 .10 .10 .10 .10  .10  .10  .10  .10
 
 Now the tricky part is $Quantity2 can either be blank or have a value
 and if $Quantity2 has a value then $Quantity3 can either be blank or have a 
 value
 
 SO If $Quantity2 is 500
 and $Price2 is $40.00
 the output would now be
 q1 q2 q3 q5 q10 q15 q20 q25 q50 q100 q300 q500 q600 q10
 0  0  0  0  .10 .10 .10 .10 .10 .10  .10  .08  .08  .08
 

This had 7 people stumped? Fire them :)

I think you had something like this in mind:

8-
?
function CalcPPU($quantity, $price)
{
   global $ppu;
   global $quant;

   for($i=0;$icount($quant);$i++)
   {
  if($quant[$i]=$quantity)
  {
 $ppu[$i]=$price/$quantity;
  }
   }
}

$quant=array(1,2,3,5,10,15,20,25,50,100,300,500,600,1);

$Quantity1=10;
$Price1=1;
$Quantity2=500;
$Price2=40;

$ppu=array();
for($i=0;$icount($quant);$i++)
{
   $ppu[$i]=0;
}

if($Quantity1)
{
   CalcPPU($Quantity1, $Price1);
   if($Quantity2)
   {
  CalcPPU($Quantity2, $Price2);
  if($Quantity3)
  {
 CalcPPU($Quantity3, $Price3);
  }
   }
}


for($i=0;$icount($quant);$i++)
{
   echo |$quant[$i];
}
echo \n;
for($i=0;$icount($quant);$i++)
{
   echo |$ppu[$i];
}
echo \n;
?
8-

Output:
|1|2|3|5|10|15|20|25|50|100|300|500|600|1
|0|0|0|0|0.1|0.1|0.1|0.1|0.1|0.1|0.1|0.08|0.08|0.08


-- 

  Daniel Tryba
  PGP public key: http://www.stack.nl/~muaddib/pgp.txt

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Advice Needed

2001-11-13 Thread Joe Van Meer

Hi there. I have a small php app connected to sqlServer db. The app is used
as a code library for various programming languages. Basically, a code
repository.  My problem is this, I would like to be able to insert the code
for a function (the actual code) into the db. However, I keep running into
the quote problem when inserting. In Asp for example, commenting is done by
using a ' . When I try to insert some asp code into the db via my php app,
it throws errors. Somebody had mentioned that using addslashes() and
stripslashes () functions would do the trick. Is there a better way to do
this or are these two functions the best to use? Also, how do I keep the
formatting of a function to stay the same while inputting and retrieving?

Your time is greatly appreciated!
Thx Joe



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]