Re: [PHP-DB] is this possible in one query?

2006-01-14 Thread RaJeSh VeNkAtA

u can have the query as

$query = " select * from $table where nameId = 31 " ;

$result = mysql_query ( $query ) ;

$i = 0 ;

while ( $row   = mysql_fetch_array( $result , MYSQL_NUM ) )
{
$array[$i][0] = $row[0] ;
$array[$i][1] = $row[1] ;
$array[$i][2] = $row[2] ;
$i++
}

// now $array  has ur required names :-)


rajesh



On Sat, 14 Jan 2006, Sjef Janssen wrote:


Hi there,
I have a table that keeps names for different language codes.
In a short example:
nameId name languageCode
31 House EN
31 Wohnung DE
32 Piece En
32 Stuck De
33 Car EN
33 PKW DE

What I would like is to have a query that returns for example:
nameId = 31
Names = House - Wohnung

Maybe I can even have a result that consists of an array with nameIds and
Names.
Or should I fire a bunch of queries after each other to have this result?

I use mysql and php 4.3.8

Tnxs!!




--

Your absence should be long enough so that someone miss you ,
But it shouldn't be so long enough that
Someone learns to live without you
So keep in touch !

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



[PHP-DB] is this possible in one query?

2006-01-14 Thread Sjef Janssen
Hi there,
I have a table that keeps names for different language codes.
In a short example:
nameId name languageCode
31 House EN
31 Wohnung DE
32 Piece En
32 Stuck De
33 Car EN
33 PKW DE

What I would like is to have a query that returns for example:
nameId = 31
Names = House - Wohnung

Maybe I can even have a result that consists of an array with nameIds and
Names.
Or should I fire a bunch of queries after each other to have this result?

I use mysql and php 4.3.8

Tnxs!!

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



[PHP-DB] Is this possible?

2005-01-22 Thread JeRRy
Hi,

Is it "security safe and possible" to use my server to
query another server, outside the local zone, and make
updates to another server using a PHP page from my
server?

I'm just wondering.

So in other words I'd have a DB setup to hold users
domains, db names, db usernames, db passwords etc on
mine and run PHP code query their own on their server.
 I wanna do this to run a program I am working on and
wanna keep the code on my server rather than handing
it out to people to freely use.

Again the question is, is it security safe and
possible. :)

J

Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com

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



[PHP-DB] Is this possible?

2005-01-22 Thread JeRRy
Hi,

Is it "security safe and possible" to use my server to
query another server, outside the local zone, and make
updates to another server using a PHP page from my
server?

I'm just wondering.

So in other words I'd have a DB setup to hold users
domains, db names, db usernames, db passwords etc on
mine and run PHP code query their own on their server.
 I wanna do this to run a program I am working on and
wanna keep the code on my server rather than handing
it out to people to freely use.

Again the question is, is it security safe and
possible. :)

J

Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com

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



[PHP-DB] is this possible?

2003-01-19 Thread Addison Ellis
hello,
	i have a page where the user selects a category. they are 
directed to a page that takes them to subactegory and displays the 
subcategory according to category id.
	my question is can i from there direct them to a particular 
page from a list of a number of different pages according to their 
subcategory choice? my thought was to direct them to one page that 
contains all the relations between category and subcategory and if 
subcategory=id where category=$category then include or header 
example.php.
	i wasn't even sure about that.
	anyway... thank you for your time and thoughts. best, addison
--
Addison Ellis
small independent publishing co.
114 B 29th Avenue North
Nashville, TN 37203
(615) 321-1791
[EMAIL PROTECTED]
[EMAIL PROTECTED]
subsidiaries of small independent publishing co.
[EMAIL PROTECTED]
[EMAIL PROTECTED]

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



RE: [PHP-DB] Is this possible in mysql?

2002-03-08 Thread Gurhan Ozen

Leif,
IF i understood this correctly you would like to add up the values of a
particular column and return it to PHP with a different name right?

You can do:
$query="select sum(column_name) as nameyouwant from tablename"; // this will
return the sum of the column in a column called nameyouwant
$result=mysql_query($query);
$row=mysql_fetch_row($result); // fetching it into array so you can use it..

$sumofnumber=$row[0];

Of course you can use other alternatives to mysql_fetch_row() function. See
PHP manual SEction LXI (MySQL functions) for this..
Is this what you are looking for??


Gurhan

-Original Message-
From: Leif K-Brooks [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 08, 2002 2:17 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Is this possible in mysql?


I need to add up the (integer) values of columns, and return the added up
value as one column to php.  Is this possible?  Or is there something else
to do it? (I'd rather not have to mysql_fetch_array() in a while loop and
add it up there, it might be a lot of rows)


--
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] Is this possible in mysql?

2002-03-08 Thread Andrey Hristov

list($sum)=mysql_fetch_assoc(mysql_query('SELECT SUM(salary') FROM employes;'));

Best regards,
Andrey Hristov

On Friday 08 March 2002 09:17 pm, you wrote:
> I need to add up the (integer) values of columns, and return the added up
> value as one column to php.  Is this possible?  Or is there something else
> to do it? (I'd rather not have to mysql_fetch_array() in a while loop and
> add it up there, it might be a lot of rows)

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




RE: [PHP-DB] Is this possible in mysql?

2002-03-08 Thread Leotta, Natalie (NCI/IMS)

Here's an example for how to select the sum of a column in SQL.  Maybe that
will help.

-Natalie

http://www.devguru.com/Technologies/jetsql/quickref/sum.html

> -Original Message-
> From: Leif K-Brooks [SMTP:[EMAIL PROTECTED]]
> Sent: Friday, March 08, 2002 2:17 PM
> To:   [EMAIL PROTECTED]
> Subject:      [PHP-DB] Is this possible in mysql?
> 
> I need to add up the (integer) values of columns, and return the added up
> value as one column to php.  Is this possible?  Or is there something else
> to do it? (I'd rather not have to mysql_fetch_array() in a while loop and
> add it up there, it might be a lot of rows)
> 
> 
> -- 
> 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] Is this possible in mysql?

2002-03-08 Thread Leif K-Brooks

I need to add up the (integer) values of columns, and return the added up
value as one column to php.  Is this possible?  Or is there something else
to do it? (I'd rather not have to mysql_fetch_array() in a while loop and
add it up there, it might be a lot of rows)


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




Re: [PHP-DB] Is this possible?

2002-02-06 Thread William Fong

I was thinking something similar, but I couldn't figure out what it meant
(was it in German?).

Why would you need quantity as a field?  If buying two, you get a 10%
discount, why not put that in a formula?  Would make it a little more
dynamic.

Without knowing all the information:

(id, item_name, price, option, option_cost, quantity_discount)

?

--
William Fong - [EMAIL PROTECTED]
Phone: 626.968.6424 x210  |  Fax: 626.968.6877
Wireless #: 805.490.7732|  Wireless E-mail: [EMAIL PROTECTED]




- Original Message -
From: "Hugh Bothwell" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 06, 2002 10:00 AM
Subject: Re: [PHP-DB] Is this possible?


> It looks to me like you should be dividing the data differently; something
> like
>
> (quantity, item, option, price)
> VALUES
> (1, '6inch', '', '29),
> (1, '6inch', 'meny', 51),
> (1, 'footlong', '', 45),
> (1, 'footlong', 'meny', 66),
>
> and so forth...
>
>
> "Raymond lilleødegård" <[EMAIL PROTECTED]> wrote in message
> 001d01c1af34$621b96e0$31c7d450@amd">news:001d01c1af34$621b96e0$31c7d450@amd...
> > My table look like this:
> >
> > Pricetable: (varetabell)
> > 
> > (varenr, type, pris)
> > VALUES
> > (1, '6inch', 29),
> > (1, '6inch meny', 51),
> > (1, 'footlong', 45),
> > (1, 'footlong meny', 66),
> > (1, 'salat', 39),
> > (1, 'salat meny', 51),
> > (2, '6inch', 49),
> > (2, '6inch meny', 69),
> > (2, 'footlong', 75),
> > (2, 'footlong meny', 96),
> > (2, 'salat', 49),
> > (2, 'salat meny', 69),
>
>
>
>
> --
> 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] Is this possible?

2002-02-06 Thread Rick Emery

SELECT * FROM pristabell LEFT JOIN varetabell USING(varenr) WHERE
pristabell.varenr=$item

This statement will get all prices and quantities fro a given item ($item).
Simply interate through the recordset and display the info in whatever
format you wish.

-Original Message-
From: Raymond Lilleødegård [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 06, 2002 11:33 AM
To: Rick Emery; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Is this possible?


My table look like this:

Pricetable: (varetabell)

(varenr, type, pris)
VALUES
(1, '6inch', 29),
(1, '6inch meny', 51),
(1, 'footlong', 45),
(1, 'footlong meny', 66),
(1, 'salat', 39),
(1, 'salat meny', 51),
(2, '6inch', 49),
(2, '6inch meny', 69),
(2, 'footlong', 75),
(2, 'footlong meny', 96),
(2, 'salat', 49),
(2, 'salat meny', 69),


Product table: (pristabell)
---
(varenr, varenavn, innhold)
VALUES
('1','Veggie Delite','Grønnsaker og ost'),
('2','Subway Club', 'Kalkun, skinke og roasbeef'),
('3','Classic Italian BMT', 'Skinke, salami og pepperoni'),



And the query that I have tried looks like this:

SELECT  varetabell.varenavn, varetabell.varenr, varetabell.innhold,
pristabell.pris  FROM varetabell, pristabell WHERE
pristabell.varenr=varetabell.varenr AND pristabell.type='6inch' AND
pristabell.type='footlong'



- Original Message -
From: "Rick Emery" <[EMAIL PROTECTED]>
To: "'Raymond Lilleodegard'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, February 06, 2002 6:23 PM
Subject: RE: [PHP-DB] Is this possible?


> Yes, you can do that easily.
>
> It is easier to answer your question if you show us your table structure.
>
> -Original Message-
> From: Raymond Lilleodegard [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 06, 2002 11:16 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Is this possible?
>
>
> Hi!
>
> I have this tricky case, at lest for me : )
>
> I'm trying to get some data out of two tables and listing the data in a
> product/price site. But. :
>
> I have one table with productinfo and one with prices.
> And it is several columns with the same id in the pricetable, because
every
> product have several sizes.
>
> So... how do I get only one row from the "product table" and two rows from
> the "price table" in one line in a page?
> Is it possible?
>
>
>
> Best regards
>
> Raymond
>
>
>
> --
> 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] Is this possible?

2002-02-06 Thread DL Neil

Raymond,
See complaint elsewhere as a result of cross-posting. Add my criticism because I'm on 
both lists and keep them
in separate InBox folders and now feeling schizoid...

SELECT * [whatever]
FROM pristabell P, varetabell V1, varetabell V2
WHERE P.varenr = V1.varenr AND P.varenr = V2.varenr
 AND V2.type = concat(V1.type, " meny")

[sorry, machine is busy on something, so haven't prototyped it]

The last AND condition might have to move to a HAVING clause.
This conditional on the larger product always being called name + " meny" - absolutely 
NOT a good idea!

Alternative:
AND V2.pris > V1.pris
(better than what I said before)

Have you tried any of these?
Please advise,
=dn


> Pricetable: (varetabell)
> 
> (varenr, type, pris)
> VALUES
> (1, '6inch', 29),
> (1, '6inch meny', 51),
> (1, 'footlong', 45),
> (1, 'footlong meny', 66),
> (1, 'salat', 39),
> (1, 'salat meny', 51),
> (2, '6inch', 49),
> (2, '6inch meny', 69),
> (2, 'footlong', 75),
> (2, 'footlong meny', 96),
> (2, 'salat', 49),
> (2, 'salat meny', 69),
>
>
> Product table: (pristabell)
> ---
> (varenr, varenavn, innhold)
> VALUES
> ('1','Veggie Delite','Grønnsaker og ost'),
> ('2','Subway Club', 'Kalkun, skinke og roasbeef'),
> ('3','Classic Italian BMT', 'Skinke, salami og pepperoni'),
>
>
>
> And the query that I have tried looks like this:
>
> SELECT  varetabell.varenavn, varetabell.varenr, varetabell.innhold,
> pristabell.pris  FROM varetabell, pristabell WHERE
> pristabell.varenr=varetabell.varenr AND pristabell.type='6inch' AND
> pristabell.type='footlong'
>
>
>
> - Original Message -
> From: "Rick Emery" <[EMAIL PROTECTED]>
> To: "'Raymond Lilleodegard'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Wednesday, February 06, 2002 6:23 PM
> Subject: RE: [PHP-DB] Is this possible?
>
>
> > Yes, you can do that easily.
> >
> > It is easier to answer your question if you show us your table structure.
> >
> > -Original Message-
> > From: Raymond Lilleodegard [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, February 06, 2002 11:16 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-DB] Is this possible?
> >
> >
> > Hi!
> >
> > I have this tricky case, at lest for me : )
> >
> > I'm trying to get some data out of two tables and listing the data in a
> > product/price site. But. :
> >
> > I have one table with productinfo and one with prices.
> > And it is several columns with the same id in the pricetable, because
> every
> > product have several sizes.
> >
> > So... how do I get only one row from the "product table" and two rows from
> > the "price table" in one line in a page?
> > Is it possible?
> >
> >
> >
> > Best regards
> >
> > Raymond
> >
> >
> >
> > --
> > 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] Is this possible?

2002-02-06 Thread Hugh Bothwell

It looks to me like you should be dividing the data differently; something
like

(quantity, item, option, price)
VALUES
(1, '6inch', '', '29),
(1, '6inch', 'meny', 51),
(1, 'footlong', '', 45),
(1, 'footlong', 'meny', 66),

and so forth...


"Raymond lilleødegård" <[EMAIL PROTECTED]> wrote in message
001d01c1af34$621b96e0$31c7d450@amd">news:001d01c1af34$621b96e0$31c7d450@amd...
> My table look like this:
>
> Pricetable: (varetabell)
> 
> (varenr, type, pris)
> VALUES
> (1, '6inch', 29),
> (1, '6inch meny', 51),
> (1, 'footlong', 45),
> (1, 'footlong meny', 66),
> (1, 'salat', 39),
> (1, 'salat meny', 51),
> (2, '6inch', 49),
> (2, '6inch meny', 69),
> (2, 'footlong', 75),
> (2, 'footlong meny', 96),
> (2, 'salat', 49),
> (2, 'salat meny', 69),




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




Re: [PHP-DB] Is this possible?

2002-02-06 Thread DL Neil

Hi Raymond,

> I have this tricky case, at lest for me : )
>
> I'm trying to get some data out of two tables and listing the data in a
> product/price site. But. :
>
> I have one table with productinfo and one with prices.
> And it is several columns with the same id in the pricetable, because every
> product have several sizes.
>
> So... how do I get only one row from the "product table" and two rows from
> the "price table" in one line in a page?
> Is it possible?


No, not as such.

Code one query to do the join and SELECT the data, grouped and ordered by (say) 
ProdCode and within that
PackSize.

Then use PHP to cycle (outer loop) though each product (group), continuing the 
'output' across the line when
consecutive records are for the same ProdCode (but not re-displaying the ProductInfo 
data).

Regards,
=dn



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




Re: [PHP-DB] Is this possible?

2002-02-06 Thread Raymond Lilleødegård

My table look like this:

Pricetable: (varetabell)

(varenr, type, pris)
VALUES
(1, '6inch', 29),
(1, '6inch meny', 51),
(1, 'footlong', 45),
(1, 'footlong meny', 66),
(1, 'salat', 39),
(1, 'salat meny', 51),
(2, '6inch', 49),
(2, '6inch meny', 69),
(2, 'footlong', 75),
(2, 'footlong meny', 96),
(2, 'salat', 49),
(2, 'salat meny', 69),


Product table: (pristabell)
---
(varenr, varenavn, innhold)
VALUES
('1','Veggie Delite','Grønnsaker og ost'),
('2','Subway Club', 'Kalkun, skinke og roasbeef'),
('3','Classic Italian BMT', 'Skinke, salami og pepperoni'),



And the query that I have tried looks like this:

SELECT  varetabell.varenavn, varetabell.varenr, varetabell.innhold,
pristabell.pris  FROM varetabell, pristabell WHERE
pristabell.varenr=varetabell.varenr AND pristabell.type='6inch' AND
pristabell.type='footlong'



- Original Message -
From: "Rick Emery" <[EMAIL PROTECTED]>
To: "'Raymond Lilleodegard'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, February 06, 2002 6:23 PM
Subject: RE: [PHP-DB] Is this possible?


> Yes, you can do that easily.
>
> It is easier to answer your question if you show us your table structure.
>
> -Original Message-
> From: Raymond Lilleodegard [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 06, 2002 11:16 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Is this possible?
>
>
> Hi!
>
> I have this tricky case, at lest for me : )
>
> I'm trying to get some data out of two tables and listing the data in a
> product/price site. But. :
>
> I have one table with productinfo and one with prices.
> And it is several columns with the same id in the pricetable, because
every
> product have several sizes.
>
> So... how do I get only one row from the "product table" and two rows from
> the "price table" in one line in a page?
> Is it possible?
>
>
>
> Best regards
>
> Raymond
>
>
>
> --
> 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] Is this possible?

2002-02-06 Thread Rick Emery

Yes, you can do that easily.

It is easier to answer your question if you show us your table structure.

-Original Message-
From: Raymond Lilleodegard [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 06, 2002 11:16 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Is this possible?


Hi!

I have this tricky case, at lest for me : )

I'm trying to get some data out of two tables and listing the data in a
product/price site. But. :

I have one table with productinfo and one with prices.
And it is several columns with the same id in the pricetable, because every
product have several sizes.

So... how do I get only one row from the "product table" and two rows from
the "price table" in one line in a page?
Is it possible?



Best regards

Raymond



-- 
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] Is this possible?

2002-02-06 Thread Raymond Lilleodegard

Hi!

I have this tricky case, at lest for me : )

I'm trying to get some data out of two tables and listing the data in a
product/price site. But. :

I have one table with productinfo and one with prices.
And it is several columns with the same id in the pricetable, because every
product have several sizes.

So... how do I get only one row from the "product table" and two rows from
the "price table" in one line in a page?
Is it possible?



Best regards

Raymond



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