RE: [PHP] mysql and user-defined functions
| From: | LYBARDJ8) | Date: | Tue, 22 May 2001 13:10:14 +0000 |
| Subject: | RE: [PHP] mysql and user-defined functions | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-53851@lists.php.net to get a copy of this message | ||
ok sorry let me include the code(which I should have done the first time), I
have so far and then it should become clear what I am trying to do and the
difficults I am having:
the function is in a separate file:
function findEntryId($tableName,$keyName){
connects to DB
$db ="SELECT * FROM '$tableName' WHERE '$keyName' = $selectOption";
$mysql_result = mysql_query($db);
$temp = mysql_fetch_array($mysql_result);
return $temp;
}
in another file the call:
$row = findEntryId("vendor","vendor_num");
the problem is I want $row to equal $temp after the call but it is not
allowing me to return $temp, any ideas?
> ----------
> From: Alexander Wagner[SMTP:wagner@globalpark.de]
> Sent: Monday, May 21, 2001 4:19 PM
> To: Lybarger, Denver J (LYBARDJ8); 'php-general@lists.php.net'
> Subject: Re: [PHP] mysql and user-defined functions
>
> Lybarger, Denver J (LYBARDJ8) wrote:
> > 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.
>
> What was the problem? This should work. Maybe you just got the
> mysql_fetch_array() wrong, or the database-connect.
>
> > Another issue is that all
> > of the tables are a different size, therefore a static array size
> > would be a big waste of memory.
>
> PHP doesn't have static array sizes, only associative arrays.
>
> > Thanks for any help you could lend.
>
> Sorry, but what you wrote is insufficent to find out where your problem
> lies. For me, anyway.
>
> regards
> Wagner
>
> --
> "Some guy hit my fender, and I told him, 'Be fruitful and multiply,'
> but not in those words."
> - Woody Allen
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>