multiple functions
Moderator: General Moderators
multiple functions
I've got users that store their stock names in a database. Now, I would like to set up a function that would use all of their stock names, to look up the quote, and put it out on a line. Is there a way of doing this as a function? like, stockLookUp($mysqlResults);, and it would do the function, for the query from the database. I've already got the quote look up script customized the way I want it. Anyone got any ideas?
Alright..
This link is the source of my file. Note: This is only a form-based lookup. This is the working version of the above script.
Now... Lets say that there are multiple querys, coming from one database table. and $query = $row['stockNames'];
I would like to set up a function, that includes that script above, that would use the string included with that function, like: stockScript($query);
Is there a way of doing this? If so -- Could anyone point me in the right direction?
This link is the source of my file. Note: This is only a form-based lookup. This is the working version of the above script.
Now... Lets say that there are multiple querys, coming from one database table. and $query = $row['stockNames'];
I would like to set up a function, that includes that script above, that would use the string included with that function, like: stockScript($query);
Is there a way of doing this? If so -- Could anyone point me in the right direction?
jepp, better and (hopefully) simple enough for me to answer 
i.e.
or if you've already put the data into an array you can perform a forrach-loop
or misuse the array_map function
see also:
mysql_query
mysql_fetch_row
mysql_free_result
die
foreach
array_map
(damn, I love this site and even more linking to it
)
i.e.
Code: Select all
$result=mysql_query(....) or die('query failed');
while ($row = mysql_fetch_row($result)
somethingUseful($row);
mysql_free_result($result);Code: Select all
$allstocks=getAllStocks(..);
foreach($allstocks as $stock) whatEver($stock);Code: Select all
$allstock=getAllStock(..);
$allstocks = array_map("whatEver", $allstocks);mysql_query
mysql_fetch_row
mysql_free_result
die
foreach
array_map
(damn, I love this site and even more linking to it
