mysql and functions
| From: | LYBARDJ8) | Date: | Mon, 21 May 2001 15:12:43 +0000 |
| Subject: | mysql and functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-56061@lists.php.net to get a copy of this message | ||
Hi All,
Is there a way to return the results of a mysql_query or the array that
is generated after mysql_fetch_array, via a function? Note I have tried to
do a straight return. Another issue is that all of the tables are a
different size, therefore a static array size would be a big waste of
memory. Thanks for any help you could lend.
- Denver
function findEntryId($tableName,$keyName){
connects to db here
$db ="SELECT * FROM '$tableName' WHERE '$keyName' =$selectOption";
$mysql_result = mysql_query($db);
$row = mysql_fetch_array($mysql_result);
return $row;
}
from page:
$row = findEntryId("x","x_num"));