Zach,

On the subject of sharing information we differ big-time: have you heard the story 
about the three blind men
attempting to describe an elephant?

Apparently you have failed to appreciate the self-help nature of the list. No one is 
paid to help you. However
your behavior demands/evidences more goodwill and effort from your (several) 
correspondents than you have
demonstrated yourself.

"Relational" technology is all about the logical interrelationship between elements of 
data, both between tables
and within a table. Perhaps some reading/revision is required. Accordingly without 
information about the
subject-table, you are left with the two somewhat-artificial solutions offered: 
incremented field or timestamp
as key, and a nagging feeling that wonders if there might be a 'better way'.

You have just mentioned the serial file/data source. That opens a whole new avenue of 
attack! However time and
goodwill can both be quickly exhausted.

Let us know how you get on with the suggestions made so far, and if they don't 
work/you think there might be a
better way, consider another approach for assistance.
=dn



----- Original Message -----
From: "Zach Curtis" <[EMAIL PROTECTED]>
To: "DL Neil" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: 24 January 2002 00:01
Subject: RE: [PHP-DB] # of Records in Table


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

Reply via email to