[PHP] how to read a specific cell

2005-04-26 Thread Sebastien Pahud
Hello,
I cannot figure out how to read a specific cell in a result i got from 
a SQL request.

I have a SQL request on a database:
SELECT nameAttribute, fr, de, en
FROM traduction
WHERE nameTable = 'whatever'
AND idTable = 1
ORDER BY nameAttribute
and i am suppose to get something like this :
-
| msg   | bonjour  | gutentag | good morning |
-
| time   | diner  | essen  | lunch |
-
| weather | beau  | schön | nice|
-
I always know how many rows i am suppose to get.
Now, how can i get the word schön for example out from that table ? I 
need to get it specifically, and not all the row.
$table['de'] will return the 1st one. (Gutentag in my example) I need 
the 3rd one... or the 2nd... and so on.

$table[2][2]; or anything like this doesn't seem to work.
mysql_fetch_assoc, mysql_fetch_row, mysql_fetch_array Well, what 
and how should i use this

Hope you got my broken english
Thanks
Seb
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] how to read a specific cell

2005-04-26 Thread Brian V Bonini
On Tue, 2005-04-26 at 17:05, Sebastien Pahud wrote:
 Hello,
 
 I cannot figure out how to read a specific cell in a result i got from 
 a SQL request.
 
 I have a SQL request on a database:
 SELECT nameAttribute, fr, de, en
 FROM traduction
 WHERE nameTable = 'whatever'
 AND idTable = 1
 ORDER BY nameAttribute
 
 and i am suppose to get something like this :
 
 -
 | msg   | bonjour  | gutentag | good morning |
 -
 | time   | diner  | essen  | lunch |
 -
 | weather | beau  | schön | nice|
 -
 
 I always know how many rows i am suppose to get.
 
 Now, how can i get the word schön for example out from that table 

SELECT * FROM traduction WHERE nameAttribute='weather' AND de='schön';

??

-- 

s/:-[(/]/:-)/g


BrianGnuPG - KeyID: 0x04A4F0DC | Key Server: pgp.mit.edu
==
gpg --keyserver pgp.mit.edu --recv-keys 04A4F0DC
Key Info: http://gfx-design.com/keys
Linux Registered User #339825 at http://counter.li.org

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



Re: [PHP] how to read a specific cell

2005-04-26 Thread Sebastien Pahud
Brian V Bonini wrote:
On Tue, 2005-04-26 at 17:05, Sebastien Pahud wrote:
 

Hello,
I cannot figure out how to read a specific cell in a result i got from 
a SQL request.

I have a SQL request on a database:
SELECT nameAttribute, fr, de, en
FROM traduction
WHERE nameTable = 'whatever'
AND idTable = 1
ORDER BY nameAttribute
and i am suppose to get something like this :
-
| msg   | bonjour  | gutentag | good morning |
-
| time   | diner  | essen  | lunch |
-
| weather | beau  | schön | nice|
-
I always know how many rows i am suppose to get.
Now, how can i get the word schön for example out from that table 
   

SELECT * FROM traduction WHERE nameAttribute='weather' AND de='schön';
??
 

Thanks Brian, but you didn't get the problem... i want to get the 
content with the position in the array, because i never know what is 
inside my array. (schön and all those inputs change) But i know the 
position of what i need. (because of the ORDER BY and the fact that i 
always get only 3 rows)

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


RE: [PHP] how to read a specific cell

2005-04-26 Thread David Tucker
I would do it like this :

if (mysql_data_seek($result, $rownum))
$a_row = mysql_fetch_row($result);

echo $a_row[$column_int];

--Codefox

-Original Message-
From: Sebastien Pahud [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 26, 2005 5:52 PM
To: php-general@lists.php.net
Subject: Re: [PHP] how to read a specific cell

Brian V Bonini wrote:

On Tue, 2005-04-26 at 17:05, Sebastien Pahud wrote:
  

Hello,

I cannot figure out how to read a specific cell in a result i got 
from a SQL request.

I have a SQL request on a database:
SELECT nameAttribute, fr, de, en
FROM traduction
WHERE nameTable = 'whatever'
AND idTable = 1
ORDER BY nameAttribute

and i am suppose to get something like this :

-
| msg   | bonjour  | gutentag | good morning |
-
| time   | diner  | essen  | lunch |
-
| weather | beau  | schön | nice|
-

I always know how many rows i am suppose to get.

Now, how can i get the word schön for example out from that table



SELECT * FROM traduction WHERE nameAttribute='weather' AND de='schön';

??
  

Thanks Brian, but you didn't get the problem... i want to get the content
with the position in the array, because i never know what is inside my
array. (schön and all those inputs change) But i know the position of what
i need. (because of the ORDER BY and the fact that i always get only 3 rows)

-- 
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 read a specific cell

2005-04-26 Thread Joseph Connolly
seb,
it would help to post the actual table structure
jozef
Sebastien Pahud wrote:
Hello,
I cannot figure out how to read a specific cell in a result i got 
from a SQL request.

I have a SQL request on a database:
SELECT nameAttribute, fr, de, en
FROM traduction
WHERE nameTable = 'whatever'
AND idTable = 1
ORDER BY nameAttribute
and i am suppose to get something like this :
-
| msg   | bonjour  | gutentag | good morning |
-
| time   | diner  | essen  | lunch |
-
| weather | beau  | schön | nice|
-
I always know how many rows i am suppose to get.
Now, how can i get the word schön for example out from that table ? 
I need to get it specifically, and not all the row.
$table['de'] will return the 1st one. (Gutentag in my example) I need 
the 3rd one... or the 2nd... and so on.

$table[2][2]; or anything like this doesn't seem to work.
mysql_fetch_assoc, mysql_fetch_row, mysql_fetch_array Well, 
what and how should i use this

Hope you got my broken english
Thanks
Seb
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] [SOLVED] Re: [PHP] how to read a specific cell

2005-04-26 Thread Sebastien Pahud
Thanks David,
Exactly what i was looking for !
Seb
David Tucker wrote:
I would do it like this :
if (mysql_data_seek($result, $rownum))
$a_row = mysql_fetch_row($result);
echo $a_row[$column_int];
--Codefox
-Original Message-
From: Sebastien Pahud [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 26, 2005 5:52 PM
To: php-general@lists.php.net
Subject: Re: [PHP] how to read a specific cell

Brian V Bonini wrote:
 

On Tue, 2005-04-26 at 17:05, Sebastien Pahud wrote:
   

Hello,
I cannot figure out how to read a specific cell in a result i got 
 

from a SQL request.
   

I have a SQL request on a database:
SELECT nameAttribute, fr, de, en
 

FROM traduction
   

WHERE nameTable = 'whatever'
AND idTable = 1
ORDER BY nameAttribute
and i am suppose to get something like this :
-
| msg   | bonjour  | gutentag | good morning |
-
| time   | diner  | essen  | lunch |
-
| weather | beau  | schön | nice|
-
I always know how many rows i am suppose to get.
Now, how can i get the word schön for example out from that table
  

 

SELECT * FROM traduction WHERE nameAttribute='weather' AND de='schön';
??
   

Thanks Brian, but you didn't get the problem... i want to get the content
with the position in the array, because i never know what is inside my
array. (schön and all those inputs change) But i know the position of what
i need. (because of the ORDER BY and the fact that i always get only 3 rows)
 

--


Sébastien Pahud
Salève 6
1004 Lausanne
Switzerland
Prof +41 (0) 21 646 63 65
Fax  +41 (0) 21 646 63 65
Privé+41 (0) 21 646 63 81
Mobile   +41 (0) 78 665 76 93
___
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] how to read a specific cell

2005-04-26 Thread Stuart Nielson
Sebastian, just a guess, but maybe when you do $table['de'] it is
assuming the first element in the array.  i.e.  $table['de'][0].
Perhaps if you tried $table['de'][2] it might work.  Just an idea.

Also, how does your code look to convert the result set to an array?
That might help to decipher what might be going wrong.  I'm wondering if
you're just off on your array elements.  Arrays in PHP typically start
with 0, so it should be $table[2][2].

Stuart


On Tue, 2005-04-26 at 23:05 +0200, Sebastien Pahud wrote:

 Hello,
 
 I cannot figure out how to read a specific cell in a result i got from 
 a SQL request.
 
 I have a SQL request on a database:
 SELECT nameAttribute, fr, de, en
 FROM traduction
 WHERE nameTable = 'whatever'
 AND idTable = 1
 ORDER BY nameAttribute
 
 and i am suppose to get something like this :
 
 -
 | msg   | bonjour  | gutentag | good morning |
 -
 | time   | diner  | essen  | lunch |
 -
 | weather | beau  | schn | nice|
 -
 
 I always know how many rows i am suppose to get.
 
 Now, how can i get the word schn for example out from that table ? I 
 need to get it specifically, and not all the row.
 $table['de'] will return the 1st one. (Gutentag in my example) I need 
 the 3rd one... or the 2nd... and so on.
 
 $table[2][2]; or anything like this doesn't seem to work.
 
 mysql_fetch_assoc, mysql_fetch_row, mysql_fetch_array Well, what 
 and how should i use this
 
 Hope you got my broken english
 
 Thanks
 
 Seb
 

Stuart G. Nielson
Inventra


Re: [PHP] how to read a specific cell

2005-04-26 Thread Richard Lynch
On Tue, April 26, 2005 2:05 pm, Sebastien Pahud said:
\ I cannot figure out how to read a specific cell in a result i got from
 a SQL request.

http://php.net/mysql_result

You don't want to use that a hundred times instead of mysql_fetch_row, but
it's fine for what you want.

If you are only getting the 3rd row, however, you may want to use LIMIT
instead to save downloading two rows you don't need.


 I have a SQL request on a database:
 SELECT nameAttribute, fr, de, en
 FROM traduction
 WHERE nameTable = 'whatever'
 AND idTable = 1
 ORDER BY nameAttribute

 and i am suppose to get something like this :

 -
 | msg   | bonjour  | gutentag | good morning |
 -
 | time   | diner  | essen  | lunch |
 -
 | weather | beau  | schön | nice|
 -

 I always know how many rows i am suppose to get.

 Now, how can i get the word schön for example out from that table ? I
 need to get it specifically, and not all the row.
 $table['de'] will return the 1st one. (Gutentag in my example) I need
 the 3rd one... or the 2nd... and so on.

 $table[2][2]; or anything like this doesn't seem to work.

 mysql_fetch_assoc, mysql_fetch_row, mysql_fetch_array Well, what
 and how should i use this

 Hope you got my broken english

 Thanks

 Seb

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




-- 
Like Music?
http://l-i-e.com/artists.htm

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