Re: [PHP-DB] Resource Id #2

2002-01-23 Thread Dan Brunner

Good, I'm glad it worked!!!

I see a lot of people using mysql_fetch_array().

Which is fine...But I'm more into Object Oriented programming...and 
that's why I always use mysql_fetch_object()

Good luck!!!


Dan


On Wednesday, January 23, 2002, at 11:45 AM, [EMAIL PROTECTED] wrote:

 My thanks for your quick response!

 Here's the problem I'm dealing with:

 I am inserting info with a unique identifier that auto-increments, then 
 take
 that ID and place it into another table for later reference.

 I was trying to use something like:

 $query=select var1 from table1 where var2='$var3'
 and var4='$var5';

 $somevar=mysql_query($query) or die.. yada yada
 echo $somevar;

 I tried your code, and it works wonderfully!  Thanks so much. :)

 J. Wharton
 [EMAIL PROTECTED]

 - Original Message -
 From: Dan Brunner [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Wednesday, January 23, 2002 12:21 PM
 Subject: Re: [PHP-DB] Resource Id #2


 Use something like this...

 ...
 ...
 ...
 $rows = mysql_num_rows($result);
 for ($y = 0; $y  $rows; $y++){
 $data = mysql_fetch_object($result);

 echo $data-Field_Name;
 ...
 ...
 ...

 }


 A Little more code would Help!!!




 On Wednesday, January 23, 2002, at 10:56 AM, [EMAIL PROTECTED] wrote:

 I'm having a problem with retrieving data from MySQL databases. I can
 input
 with no problems, but when I try to pull the data back out (single
 field)
 and echo it I get something showing up saying Resource Id #2.  Any
 ideas?





 --
 PHP Database 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: php-list-
 [EMAIL PROTECTED]






-- 
PHP Database 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]




Re: [PHP-DB] # of Records in Table

2002-01-23 Thread DL Neil

Zach,

 What syntax can I use to determine how many records are in a MySQL table and
 then retrieve the value of the field password for the last record? I tried
 using some combinations of COUNT(*) and LIMIT with no success.


SELECT COUNT(*) will answer the first part. What did you try that lacked success?

How do you define last record? We might need to see the table definition to answer 
this.

Regards,
=dn




-- 
PHP Database 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]




Re: [PHP-DB] # of Records in Table

2002-01-23 Thread Jim Lucas [php]

does the table have an autoincrement column?

Jim Lucas
- Original Message -
From: Zach Curtis [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, January 23, 2002 10:27 AM
Subject: [PHP-DB] # of Records in Table


 What syntax can I use to determine how many records are in a MySQL table
and
 then retrieve the value of the field password for the last record? I
tried
 using some combinations of COUNT(*) and LIMIT with no success.

 Thanks.


 Zach Curtis
 POPULUS


 --
 PHP Database 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]




-- 
PHP Database 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]




Re: [PHP-DB] # of Records in Table

2002-01-23 Thread Zach Curtis

The last record should be whatever the last record is in the table. For
example, if there are 1000 records in the table which COUNT(*) will tell me,
how can I get the password for record 1000. The only thing I can do that
would probably work is two query statements, one selecting COUNT(*) and the
other selecting password. What I don't like about this method is that I
would have to retrieve all of the passwords into an array, which I would
assume would be slow on larger tables. Ideally, I thought their would be a
way to do this operation in one select statement. Any thoughts?


Zach

-Original Message-
From: DL Neil [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 23, 2002 1:11 PM
To: Zach Curtis; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] # of Records in Table


Zach,

 What syntax can I use to determine how many records are in a MySQL table
and
 then retrieve the value of the field password for the last record? I
tried
 using some combinations of COUNT(*) and LIMIT with no success.


SELECT COUNT(*) will answer the first part. What did you try that lacked
success?

How do you define last record? We might need to see the table definition
to answer this.

Regards,
=dn




-- 
PHP Database 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]




Re: [PHP-DB] Resource Id #2

2002-01-23 Thread Dan Brunner

AHAHAHHAHA

AHHAHAHAH


Dan


On Wednesday, January 23, 2002, at 02:19 PM, 
[EMAIL PROTECTED] wrote:

 Dan,

 Good, I'm glad it worked!!!

 I see a lot of people using mysql_fetch_array().

 Which is fine...But I'm more into Object Oriented programming...and
 that's why I always use mysql_fetch_object()


 hey this is a family show - but I guess 'what you do in the privacy 
 of' ...

 - and I'm just plain object-ionable, so I favor mysql_fetch_assoc()


-- 
PHP Database 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]




Re: [PHP-DB] # of Records in Table

2002-01-23 Thread DL Neil

Zach,

How can this last record be identified? Is there a key field or something similar?

Again: We might need to see the table definition to answer this.

Please advise,
=dn
 

- Original Message - 
From: Zach Curtis [EMAIL PROTECTED]
To: DL Neil [EMAIL PROTECTED]
Sent: 23 January 2002 20:49
Subject: RE: [PHP-DB] # of Records in Table


 The last record should be whatever the last record is in the table. For
 example, if there are 1000 records in the table which COUNT(*) will tell me,
 how can I get the password for record 1000. The only thing I can do that
 would probably work is two query statements, one selecting COUNT(*) and the
 other selecting password. What I don't like about this method is that I
 would have to retrieve all of the passwords into an array, which I would
 assume would be slow on larger tables. Ideally, I thought their would be a
 way to do this operation in one select statement. Any thoughts?
 
 
 Zach
 
 -Original Message-
 From: DL Neil [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, January 23, 2002 1:11 PM
 To: Zach Curtis; [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] # of Records in Table
 
 
 Zach,
 
  What syntax can I use to determine how many records are in a MySQL table
 and
  then retrieve the value of the field password for the last record? I
 tried
  using some combinations of COUNT(*) and LIMIT with no success.
 
 
 SELECT COUNT(*) will answer the first part. What did you try that lacked
 success?
 
 How do you define last record? We might need to see the table definition
 to answer this.
 
 Regards,
 =dn
 
 
 
 
 


-- 
PHP Database 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]




[PHP-DB] RE: mssql_init(), mssql_bind() and mssql_execute() not working in Linux

2002-01-23 Thread Oliver Cronk

I believe these additional functions are only available in the CVS version
of PHP not the version you can download from the web site.

But I could be wrong (someone correct me!)

Oliver Cronk

-Original Message-
From: Duarte Costa [mailto:[EMAIL PROTECTED]]
Sent: 23 January 2002 15:35
To: [EMAIL PROTECTED]
Subject: mssql_init(), mssql_bind() and mssql_execute() not working in
Linux


Dear Sirs,

I  have compiled PHP 4.1.1 in SuSE Linux  with Sybase+FreeTDS  to use
MSSQL_*  functions.

The mssql_connect(), mssql_close(), mssql_select() ... all works fine.

But when I  try to use : mssql_init (),  mssql_execute(), and
mssql_bind() I get an error:  Fatal error: Call to undefined function:
mssql_init() in /usr/local/httpd/htdocs/PHP/teste_1.php on line 10 


How can I have it working ... ?

Best Regards
Duarte Costa




-- 
PHP Database 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]




RE: [PHP-DB] # of Records in Table

2002-01-23 Thread Rick Emery

SELECT * FROM mytable ORDER BY fielda DESC LIMIT 1;

- Original Message - 
From: Zach Curtis [EMAIL PROTECTED]
To: DL Neil [EMAIL PROTECTED]
Sent: 23 January 2002 20:49
Subject: RE: [PHP-DB] # of Records in Table


 The last record should be whatever the last record is in the table. For
 example, if there are 1000 records in the table which COUNT(*) will tell
me,
 how can I get the password for record 1000. The only thing I can do that
 would probably work is two query statements, one selecting COUNT(*) and
the
 other selecting password. What I don't like about this method is that I
 would have to retrieve all of the passwords into an array, which I would
 assume would be slow on larger tables. Ideally, I thought their would be a
 way to do this operation in one select statement. Any thoughts?
 
 
 Zach
 
 -Original Message-
 From: DL Neil [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, January 23, 2002 1:11 PM
 To: Zach Curtis; [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] # of Records in Table
 
 
 Zach,
 
  What syntax can I use to determine how many records are in a MySQL table
 and
  then retrieve the value of the field password for the last record? I
 tried
  using some combinations of COUNT(*) and LIMIT with no success.
 
 
 SELECT COUNT(*) will answer the first part. What did you try that lacked
 success?
 
 How do you define last record? We might need to see the table definition
 to answer this.
 
 Regards,
 =dn
 
 
 
 
 


-- 
PHP Database 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]

-- 
PHP Database 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]




[PHP-DB] dallas ppl

2002-01-23 Thread Aamina \(yahoo\)

Hi,

I'm new to this group but so far it sounds good.  I was just wondering if
there are chapters perhaps in Dallas to get together with other developers
and talk PHP?

Aamina


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
PHP Database 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]




Re: [PHP-DB] Books and what nots

2002-01-23 Thread Barry Rumsey








  Just got back from Newmarket. Yes they had 1 copy of the book and got 
  her to put it aside for me. Now it's down to some hard reading in my spare 
  time or even take it to work.
  Thanks
  
  ---Original Message---
  
  
  From: DL Neil
  Date: Thursday, 24 
  January 2002 9:25:06 a.
  To: Barry Rumsey
  Cc: [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] 
  Books and what nots
  
  and as they say "if we haven't got it in stock, we'll get it in for 
  you..."
  
  At Newmarket one of the staff is reasonably 'up' on computer books - 
  the others tend to take deep breaths and roll their eyes. Just in case, 
  the ISBN is 0-672-31784-2 (but that may have changed if a new edition has 
  been published).
  
  Regards,
  =dn
  
  
- Original Message - 
From: 
Barry Rumsey 
To: [EMAIL PROTECTED] 

Cc: [EMAIL PROTECTED] 
Sent: 23 January 2002 18:31
Subject: Re: [PHP-DB] Books and 
what nots


  
  

  No haven't tried Amazon because I haven't got a credit card, 
  used to ,but it got me into a lot of trouble. No I'll head down to 
  tech books in a couple of of hours when they open.
  
  ---Original 
  Message---
  
  
  From: DL Neil
  Date: Thursday, 
  24 January 2002 7:23:17 a.
  To: Barry Rumsey
  Cc: [EMAIL PROTECTED]
  Subject: Re: 
  [PHP-DB] Books and what nots
  
  Barry,
  You can't buy a decent computer book for less than 
  NZD100!
  That's a fair price against what I paid.
  The USD price looks even worse. 
  Tried Amazon etc?
  =dn
  
  snip 
  
  

  


  
  
  
  





	
	
	
	
	
	
	




 IncrediMail - Email has finally evolved - 
Click 
Here



RE: [PHP-DB] # of Records in Table

2002-01-23 Thread Zach Curtis

The key field is the password field, which is also the field that I would
like to retrieve for that last record.


Zach

-Original Message-
From: DL Neil [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 23, 2002 2:08 PM
To: Zach Curtis
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] # of Records in Table


Zach,

How can this last record be identified? Is there a key field or something
similar?

Again: We might need to see the table definition to answer this.

Please advise,
=dn


- Original Message -
From: Zach Curtis [EMAIL PROTECTED]
To: DL Neil [EMAIL PROTECTED]
Sent: 23 January 2002 20:49
Subject: RE: [PHP-DB] # of Records in Table


 The last record should be whatever the last record is in the table. For
 example, if there are 1000 records in the table which COUNT(*) will tell
me,
 how can I get the password for record 1000. The only thing I can do that
 would probably work is two query statements, one selecting COUNT(*) and
the
 other selecting password. What I don't like about this method is that I
 would have to retrieve all of the passwords into an array, which I would
 assume would be slow on larger tables. Ideally, I thought their would be a
 way to do this operation in one select statement. Any thoughts?


 Zach

 -Original Message-
 From: DL Neil [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, January 23, 2002 1:11 PM
 To: Zach Curtis; [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] # of Records in Table


 Zach,

  What syntax can I use to determine how many records are in a MySQL table
 and
  then retrieve the value of the field password for the last record? I
 tried
  using some combinations of COUNT(*) and LIMIT with no success.


 SELECT COUNT(*) will answer the first part. What did you try that lacked
 success?

 How do you define last record? We might need to see the table definition
 to answer this.

 Regards,
 =dn








-- 
PHP Database 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]




[PHP-DB] Re: [PEAR-DEV] Re: [metabase-dev] RE: [PEAR-DEV] New MetabaseAniversary release

2002-01-23 Thread Manuel Lemos

Hello,

Tomas V.V.Cox wrote:
 
 El mar, 22-01-2002 a las 19:02, Manuel Lemos escribió:
  Hello Lukas,
 
  Lukas Smith wrote:
 
   FYI: there has been a lot of discussion about this project in the last
   couple months (especially december irrc) on the pear-dev mailinglist. So
   some questions might allready be answered there.
 
  From what I read lately I could not come to any conclusion. It seemed
  that most people were in favour except for Tomas that said he would not
  use it if I got him right.
 
 I'm not against, if you read my reply to Lukas I was the only one

It was not clear whether you were accepting to add Metabase to PEAR
independently of PEAR-DB or as a new implementation of PEAR-DB API.


 offering help to him in the task. What I also said was that I will
 continue supporting PEAR DB. If that project becomes a reality and
 provides at least the features PEAR DB has, the compatibility to the
 actual API is maintained, good features are added and this is finally
 adopted I would start to think in developing for it. But not before as
 PEAR DB has a good amount of users (and I include my self in it) who
 needs continue their work/projects.

The same for Metabase and its users.


 
  My opinion is that you should hear a clear yes or no answer from
  somebody in charge of PEAR organization before you have a go, or else
  you may be wasting your time working on something based on expectations
  that may not exactly be what you think.
 
 You have heared the opinion of Stig and it is not so different of my
 position.
 
 In short for me: yes, please go ahead.

Ok, Lukas will be working on making the proof of concept first.

Regards,
Manuel Lemos

-- 
PHP Database 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]




RE: [PHP-DB] # of Records in Table

2002-01-23 Thread Zach Curtis

Excellent. That is more efficient (one select statement) than what I was
trying to do.


Zach

-Original Message-
From: Miles Thompson [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 23, 2002 2:20 PM
To: Zach Curtis; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] # of Records in Table


Select your password field, and whatever other fields you need
Use
-mysql_num_rows() to capture the number of rows returned
-mysql_data_seek() to position pointer on last row (remember indexing
starts at 0)
-mysql_fetch_row() or mysql_fetch_array(), your choice, to return the
data.

One select.

One bit of relational theory I always ignore, but have come to appreciate
as I gain experience, is the virtue of having a unique key on every table
in a database. If that's a key I can rely on to steadily increase in value,
so much the better.



Hope this helps and gets you out of your fix - Miles Thompson


At 01:52 PM 1/23/2002 -0700, Zach Curtis wrote:
The last record should be whatever the last record is in the table. For
example, if there are 1000 records in the table which COUNT(*) will tell
me,
how can I get the password for record 1000. The only thing I can do that
would probably work is two query statements, one selecting COUNT(*) and the
other selecting password. What I don't like about this method is that I
would have to retrieve all of the passwords into an array, which I would
assume would be slow on larger tables. Ideally, I thought their would be a
way to do this operation in one select statement. Any thoughts?


Zach

-Original Message-
From: DL Neil [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 23, 2002 1:11 PM
To: Zach Curtis; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] # of Records in Table


Zach,

  What syntax can I use to determine how many records are in a MySQL table
and
  then retrieve the value of the field password for the last record? I
tried
  using some combinations of COUNT(*) and LIMIT with no success.


SELECT COUNT(*) will answer the first part. What did you try that lacked
success?

How do you define last record? We might need to see the table definition
to answer this.

Regards,
=dn




--
PHP Database 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]



-- 
PHP Database 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]




Re: [PHP-DB] # of Records in Table

2002-01-23 Thread DL Neil

Zach,
We're going back and forth on this and getting no where...

So far all you have informed us is that the table has one column, which contains a 
bunch of passwords (I also
suggest that this is not really the case and there'll at least be some sort of userId 
field - but you haven't
bothered to tell me/us that)

The concept of last in relational terminology is ambiguous. Do you mean last 
entered, or do you mean the row
with the field containing the highest value in the column - for example.

Some people are used to the idea that there is also some 'phantom' rowId that 
counts/labels each row. In other
file systems this might have been the case, but the physically last record in an RDBMS 
table-file may not
conform to either of the last definitions mentioned above. There is no such 
'highest' in an RDBMS unless you
put it there - as mentioned by another correspondent, it's a good idea to use some 
sort of 'id' field in every
table. This can be generated for you with the AUTO_INCREMENT feature. With appropriate 
design, eg first record
has id=1 and the succeeding records have id-s with ascending values, then you can use 
SELECT MAX() against the
'id' or possibly against the AUTO_INCREMENT feature.

These commands are well documented - RTFM. Many tutorials with plenty of examples of 
authentication techniques
exist on the PHP/MySQL web sites.

Next time, please don't be so (repeatedly) parsimonious in the provision of 
information, if you expect/hope that
someone is going to give their (free) time to help you out. (grumble)

=dn


- Original Message -
From: Zach Curtis [EMAIL PROTECTED]
To: DL Neil [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: 23 January 2002 21:52
Subject: RE: [PHP-DB] # of Records in Table


 The key field is the password field, which is also the field that I would
 like to retrieve for that last record.


 Zach

 -Original Message-
 From: DL Neil [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, January 23, 2002 2:08 PM
 To: Zach Curtis
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] # of Records in Table


 Zach,

 How can this last record be identified? Is there a key field or something
 similar?

 Again: We might need to see the table definition to answer this.

 Please advise,
 =dn


 - Original Message -
 From: Zach Curtis [EMAIL PROTECTED]
 To: DL Neil [EMAIL PROTECTED]
 Sent: 23 January 2002 20:49
 Subject: RE: [PHP-DB] # of Records in Table


  The last record should be whatever the last record is in the table. For
  example, if there are 1000 records in the table which COUNT(*) will tell
 me,
  how can I get the password for record 1000. The only thing I can do that
  would probably work is two query statements, one selecting COUNT(*) and
 the
  other selecting password. What I don't like about this method is that I
  would have to retrieve all of the passwords into an array, which I would
  assume would be slow on larger tables. Ideally, I thought their would be a
  way to do this operation in one select statement. Any thoughts?
 
 
  Zach
 
  -Original Message-
  From: DL Neil [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, January 23, 2002 1:11 PM
  To: Zach Curtis; [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] # of Records in Table
 
 
  Zach,
 
   What syntax can I use to determine how many records are in a MySQL table
  and
   then retrieve the value of the field password for the last record? I
  tried
   using some combinations of COUNT(*) and LIMIT with no success.
 
 
  SELECT COUNT(*) will answer the first part. What did you try that lacked
  success?
 
  How do you define last record? We might need to see the table definition
  to answer this.
 
  Regards,
  =dn
 
 
 
 
 



 --
 PHP Database 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]




-- 
PHP Database 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]




RE: [PHP-DB] # of Records in Table

2002-01-23 Thread Rick Emery

By last record, do you mean the last was inserted into the database?  If
so, look to MYSQL's auto_increment and last_insert_id().

 -Original Message-
 From: DL Neil [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, January 23, 2002 2:08 PM
 To: Zach Curtis
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] # of Records in Table


 Zach,

 How can this last record be identified? Is there a key field or
something
 similar?

 Again: We might need to see the table definition to answer this.

 Please advise,
 =dn


 - Original Message -
 From: Zach Curtis [EMAIL PROTECTED]
 To: DL Neil [EMAIL PROTECTED]
 Sent: 23 January 2002 20:49
 Subject: RE: [PHP-DB] # of Records in Table


  The last record should be whatever the last record is in the table. For
  example, if there are 1000 records in the table which COUNT(*) will tell
 me,
  how can I get the password for record 1000. The only thing I can do that
  would probably work is two query statements, one selecting COUNT(*) and
 the
  other selecting password. What I don't like about this method is that
I
  would have to retrieve all of the passwords into an array, which I would
  assume would be slow on larger tables. Ideally, I thought their would be
a
  way to do this operation in one select statement. Any thoughts?
 
 
  Zach
 
  -Original Message-
  From: DL Neil [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, January 23, 2002 1:11 PM
  To: Zach Curtis; [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] # of Records in Table
 
 
  Zach,
 
   What syntax can I use to determine how many records are in a MySQL
table
  and
   then retrieve the value of the field password for the last record? I
  tried
   using some combinations of COUNT(*) and LIMIT with no success.
 
 
  SELECT COUNT(*) will answer the first part. What did you try that lacked
  success?
 
  How do you define last record? We might need to see the table
definition
  to answer this.
 
  Regards,
  =dn
 
 
 
 
 



 --
 PHP Database 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]




-- 
PHP Database 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]

-- 
PHP Database 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]




[PHP-DB] similar_text

2002-01-23 Thread Andrés Felipe Hernández

From the php manual:
 
int similar_text (string first, string second [, double percent]) 

This calculates the similarity between two strings as described in Oliver [1993]. Note 
that this implementation does not use a stack as in Oliver's pseudo code...

where can i find the algorithm or pseudo code?

sorry if this is not a db related question (anyway i'd like to use it on certain 
queries)

thanks, 

andrés




RE: [PHP-DB] # of Records in Table

2002-01-23 Thread Zach Curtis

There are many columns of data in the table. The only column that I would
like to extract a value from is the password field (this is the key as
well). I do not have an AUTO_INCREMENT field. Although, I see how adding
that field could be of use by using it with the SELECT MAX() as you
mentioned.

The last record is whatever the last record was inserted using INSERT INTO.
To give you the overall picture of what I am trying to accomplish:

1) I am opening up a db table and searching for the password of the last
record in the table
2) I then open a flat file and search for that password and grab the next
record after that (as records are appended to the end of the flat file) and
any other subsequent records added to the flat file
3) Write those new records to the db table

In this scenario, the last record would be the last record from the flat
file added to the db table.

Another suggestion from [EMAIL PROTECTED] was to:

Select your password field, and whatever other fields you need to
Use
-mysql_num_rows() to capture the number of rows returned
-mysql_data_seek() to position pointer on last row (remember indexing
starts at 0)
-mysql_fetch_row() or mysql_fetch_array(), your choice, to return the
data.

This is done with one select statement, however all the passwords from the
table have to be loaded into array (perhaps not the most efficient way? But
better than what I had come up with.).

I do generally find that the more brief I am in describing an issue, the
more likely I am to get a reply. Then details can be given if needed, in
further correspondences.

I will give that AUTO_INCREMENT and SELECT MAX() a try as well.


Zach

-Original Message-
From: DL Neil [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 23, 2002 3:27 PM
To: Zach Curtis
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] # of Records in Table


Zach,
We're going back and forth on this and getting no where...

So far all you have informed us is that the table has one column, which
contains a bunch of passwords (I also
suggest that this is not really the case and there'll at least be some sort
of userId field - but you haven't
bothered to tell me/us that)

The concept of last in relational terminology is ambiguous. Do you mean
last entered, or do you mean the row
with the field containing the highest value in the column - for example.

Some people are used to the idea that there is also some 'phantom' rowId
that counts/labels each row. In other
file systems this might have been the case, but the physically last record
in an RDBMS table-file may not
conform to either of the last definitions mentioned above. There is no
such 'highest' in an RDBMS unless you
put it there - as mentioned by another correspondent, it's a good idea to
use some sort of 'id' field in every
table. This can be generated for you with the AUTO_INCREMENT feature. With
appropriate design, eg first record
has id=1 and the succeeding records have id-s with ascending values, then
you can use SELECT MAX() against the
'id' or possibly against the AUTO_INCREMENT feature.

These commands are well documented - RTFM. Many tutorials with plenty of
examples of authentication techniques
exist on the PHP/MySQL web sites.

Next time, please don't be so (repeatedly) parsimonious in the provision of
information, if you expect/hope that
someone is going to give their (free) time to help you out. (grumble)

=dn


- Original Message -
From: Zach Curtis [EMAIL PROTECTED]
To: DL Neil [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: 23 January 2002 21:52
Subject: RE: [PHP-DB] # of Records in Table


 The key field is the password field, which is also the field that I would
 like to retrieve for that last record.


 Zach

 -Original Message-
 From: DL Neil [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, January 23, 2002 2:08 PM
 To: Zach Curtis
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] # of Records in Table


 Zach,

 How can this last record be identified? Is there a key field or
something
 similar?

 Again: We might need to see the table definition to answer this.

 Please advise,
 =dn


 - Original Message -
 From: Zach Curtis [EMAIL PROTECTED]
 To: DL Neil [EMAIL PROTECTED]
 Sent: 23 January 2002 20:49
 Subject: RE: [PHP-DB] # of Records in Table


  The last record should be whatever the last record is in the table. For
  example, if there are 1000 records in the table which COUNT(*) will tell
 me,
  how can I get the password for record 1000. The only thing I can do that
  would probably work is two query statements, one selecting COUNT(*) and
 the
  other selecting password. What I don't like about this method is that
I
  would have to retrieve all of the passwords into an array, which I would
  assume would be slow on larger tables. Ideally, I thought their would be
a
  way to do this operation in one select statement. Any thoughts?
 
 
  Zach
 
  -Original Message-
  From: DL Neil [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, January 

RE: [PHP-DB] # of Records in Table

2002-01-23 Thread Barry Rumsey








  Zach wrote:
   "I do generally find that the more brief I am in 
  describing an issue, themore likely I am to get a reply. Then details 
  can be given if needed, infurther correspondences."
  
  I would like to disagree with this. I am only a newbie to php and 
  have found that if I can describe to my best ability the problem I'm 
  having I can get a reply that helps me in the best way in 1 or 2 replies. 
  There is none of this back and forward and end up still getting nowhere. 
  You have towait for some replies, but they are worth it.
  
  ---Original Message---
  
  
  From: Zach Curtis
  Date: Thursday, 24 
  January 2002 1:02:07 p.
  To: DL Neil
  Cc: [EMAIL PROTECTED]
  Subject: RE: [PHP-DB] # 
  of Records in Table
  There are many columns of data in the table. The only 
  column that I wouldlike to extract a value from is the password field 
  (this is the key aswell). I do not have an AUTO_INCREMENT field. 
  Although, I see how addingthat field could be of use by using it with 
  the SELECT MAX() as youmentioned.The last record is whatever 
  the last record was inserted using INSERT INTO.To give you the overall 
  picture of what I am trying to accomplish:1) I am opening up a db 
  table and searching for the password of the lastrecord in the 
  table2) I then open a flat file and search for that password and grab 
  the nextrecord after that (as records are appended to the end of the 
  flat file) andany other subsequent records added to the flat 
  file3) Write those new records to the db tableIn this 
  scenario, the last record would be the last record from the flatfile 
  added to the db table.Another suggestion from [EMAIL PROTECTED] 
  was to:Select your password field, and whatever other fields you 
  need toUse-mysql_num_rows() to capture the number of rows 
  returned-mysql_data_seek() to position pointer on last row (remember 
  indexingstarts at 0)-mysql_fetch_row() or mysql_fetch_array(), 
  your choice, to return thedata.This is done with one select 
  statement, however all the passwords from thetable have to be loaded 
  into array (perhaps not the most efficient way? Butbetter than what I 
  had come up with.).I do generally find that the more brief I am in 
  describing an issue, themore likely I am to get a reply. Then details 
  can be given if needed, infurther correspondences.I will give 
  that AUTO_INCREMENT and SELECT MAX() a try as 
  well.Zach-Original Message-From: DL Neil 
  [mailto:[EMAIL PROTECTED]]Sent: 
  Wednesday, January 23, 2002 3:27 PMTo: Zach CurtisCc: [EMAIL PROTECTED]Subject: 
  Re: [PHP-DB] # of Records in TableZach,We're going back 
  and forth on this and getting no where...So far all you have 
  informed us is that the table has one column, whichcontains a bunch of 
  passwords (I alsosuggest that this is not really the case and there'll 
  at least be some sortof userId field - but you haven'tbothered to 
  tell me/us that)The concept of "last" in relational terminology is 
  ambiguous. Do you meanlast entered, or do you mean the rowwith the 
  field containing the highest value in the column - for 
  example.Some people are used to the idea that there is also some 
  'phantom' rowIdthat counts/labels each row. In otherfile systems 
  this might have been the case, but the physically last recordin an 
  RDBMS table-file may notconform to either of the "last" definitions 
  mentioned above. There is nosuch 'highest' in an RDBMS unless 
  youput it there - as mentioned by another correspondent, it's a good 
  idea touse some sort of 'id' field in everytable. This can be 
  generated for you with the AUTO_INCREMENT feature. Withappropriate 
  design, eg first recordhas id=1 and the succeeding records have id-s 
  with ascending values, thenyou can use SELECT MAX() against 
  the'id' or possibly against the AUTO_INCREMENT feature.These 
  commands are well documented - RTFM. Many tutorials with plenty 
  ofexamples of authentication techniquesexist on the PHP/MySQL web 
  sites.Next time, please don't be so (repeatedly) parsimonious in 
  the provision ofinformation, if you expect/hope thatsomeone is 
  going to give their (free) time to help you out. 
  (grumble)=dn- Original Message -From: 
  "Zach Curtis" lt;[EMAIL PROTECTED]To: "DL 
  Neil" lt;[EMAIL PROTECTED]Cc: 
  lt;[EMAIL PROTECTED]Sent: 
  23 January 2002 21:52Subject: RE: [PHP-DB] # of Records in 
  Table The key field is the password field, which is also 
  the field that I would like to retrieve for that last 
  record. Zach -Original 
  Message- From: DL Neil [mailto:[EMAIL PROTECTED]] 
  Sent: Wednesday, January 23, 

[PHP-DB] displaying images

2002-01-23 Thread mike

Hello,

I'm storing image URLs in a varchar text field for items in my database. The
problem is not all the items in the database have images, so when i do a
query that displays multiple results some have images and some have the
nasty red Xs. Is there a way do some kind of IF statement. If the image url
is there, display image if not display No picture available or something
like that?

Thanks in advance,
Mike


-- 
PHP Database 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]




Re: [PHP-DB] displaying images

2002-01-23 Thread Jason Wong

On Thursday 24 January 2002 12:34, [EMAIL PROTECTED] wrote:
 Hello,

 I'm storing image URLs in a varchar text field for items in my database.
 The problem is not all the items in the database have images, so when i do
 a query that displays multiple results some have images and some have the
 nasty red Xs. Is there a way do some kind of IF statement. If the image url
 is there, display image if not display No picture available or something
 like that?

Yes.

  if ($image) {
display_url(); }
  else {
echo No image;
  }


-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
What is irritating about love is that it is a crime that requires an 
accomplice.
-- Charles Baudelaire
*/

-- 
PHP Database 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]




[PHP-DB] Creating a pdf document

2002-01-23 Thread Mihail Bota

Hello,

I was wondering if I could save the result of a query in a pdf document. I
looked for any functions that might help, but I got confused because I
could not see how/where exactly to insert the necessary .dll's. I'd like
to do this (saving the output of a query) by using mysql installed on a
Irix machine, and PHP4.
If this is not possible, could I create a pdf document or a word document
from a query from either Access database or mysql on a win2k system,
PHP4.1?
Any references that might help?
Thanks for your help!

Mihai


-- 
PHP Database 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]