Pete wrote:
> In message <[EMAIL PROTECTED]>, James
> Keeline <[EMAIL PROTECTED]> writes
> 
>>I don't think you can set an arbitrary length of an INT field like you can 
>>with
>>VARCHAR (not you can't with TEXT either).  
> 
> 
> I have got a project where the previous 'person' put all sorts of
> values, quite often int(10), which works, but just seems very
> inefficient.  Either the table must run more slowly or space is wasted,
> I can't see it being neither.

from my expeirnece, it depends on the DB.

MSSQL will give you the finger if you try to specify an int as anything 
but the default.  mysql will let you do it so long as its less than its 
max field length.

on the same note, MYsql tops out varchar at 255, and then you must move 
to TEXT.  in MSsql, there is no "TEXT" and varchar will hold 8000 
characters.


>>>From your latest example, it seems that you are trying to renumber the value 
>>>in
>>a field.  As you have discovered, dropping and readding the column won't do
>>this.  Nothing in your queries has actually placed a value in that column. 
> 
> 
> I hate to disagree (he lied <G>) but adding an autoinc field will make
> that field automatically renumber itself.

yes, it will work.  but, IMO, its VERY impractical.  Especially if 
you're trying to keep the table useful in a relational database 
structure.  The only way i'd see this as being a *smart* thing to do, 
would be on a very small table, say < 25 rows, of which links nor joins 
to any other table EVER.

On the same token, i would never do it.  honsetly, what's the point?

you want them in order?  you have the ORDER BY clause.
you want to display them in order, with nice 0 through 25 (for example) 
numbers, do it in php or in the sql statement itself.

for example:

<?php

$sql = "select ID, field from table order by ID limit 25";

//process query here...
$results = mysql_fetch... //however you do it...



//make it nice and pretty with numbers...

echo "<table>"

for(x=0; x<26; x++)
{
        echo "<tr><td>" . x . "</td><td>" . $results['field'] . "</td></tr>";
}
echo "</table>";

?>


no?


        







Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to