how do i find out the row size in kb? is it possible to automatically insert the size I have a mail table and have the field is there a way of automatically creating the value on insert by resetting the values of the field??

`messagesize` int(255) NOT NULL default '0',

but am unsure how to do this any ideas I have thought that maybe i have to call the last inserted ID get the value then do an update of that row but am unsure of how to do this in php.

I would of posted in the SQL forum if i could find it.

Try this:

<?
$result=mysql_query('SELECT * FROM `table`');
$fields=mysql_fetch_array($result);
foreach($fields AS $field) {
    $string.=$field;
    } unset($field);
$kilobites=strlen($string);
$kilobites=$kilobites/1024;

echo $kilobites;
?>

Basically the string length is the number of bytes and there are 1024 bytes in a kilobite.

mm i am trying to find out the value of one row not all of them

i tried this but it doestn't work?

$msize = "SELECT * FROM mailtbl WHERE mailID='$messageid';
$mresult = mysql_query($msize);
$row = mysql_fetch_array($mresult); 
$length = strlen($row);
$kilobites = $length/1024;

$addmessagesize = "update mailtbl set messagesize='$kilobites' where mailID='$messageid'";
$resultsize = mysql_query($addmessagesize);

solved already using

$mtotal = "SELECT * FROM mailtbl WHERE mailID='$messageid'";
$mresult = mysql_query($mtotal);
$newsize = 0;
while ($row = mysql_fetch_array($mresult, MYSQL_NUM)) { 
  foreach ($row as $val) {
     $newsize += strlen($val);     
  }
}
This question has already been answered. Start a new discussion instead.