RE: [PHP-DB] lenght of a record
| From: | Dave Watkinson | Date: | Fri, 28 Sep 2001 10:38:42 +0000 |
| Subject: | RE: [PHP-DB] lenght of a record | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-12814@lists.php.net to get a copy of this message | ||
why don't you get the record length through MySQL instead of getting PHP
to do it?
$query = "SELECT column1, column2, LENGTH(column2) FROM
tablename ORDER BY column1";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result)) {
$length_to_check_for = $row[3];
// and then start your while() loop
}
mysql_free_result($result);
hope this helps, and hope I understood your question!
Dave
-----Original Message-----
From: its me [mailto:fotna@egypt.net]
Sent: 28 September 2001 11:41
To: php-db@lists.php.net
Subject: [PHP-DB] lenght of a record
how can i get the length of a record:
to make something like this:
$result=mysql_query($sql,$conn);
$row=mysql_fetch_row($result);
for($i=0;$i<record_length;$i++)
{
echo $row[$i];
}
i need it like this as i don't want to use mysql_fetch_array
------------------------------------------------------------
------------------------------------------------------------
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
For additional commands, e-mail: php-db-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net