HI folks,
I'm at wits end trying to create an array of values from a database .... no amount of searching of the manual and tutorials has helped :bemused: ...
All I'm trying to do is pull two variables from a database like so:
$sql="select TAGS.TLIBRARY_ID, TAGS.TAG_ID, TAGS.TAG_SEQ from TAGS where
TAGS.TAG_SEQ='$seq'";
$stmt=OCIParse($conn,$sql);
OCIDefineByName($stmt,"TLIBRARY_ID",&$lib_id);
OCIDefineByName($stmt,"TAG_ID",&$name);
OCIExecute($stmt);
$count=0;
while (OCIFetch($stmt)) {
I know that if I do this:
for ($i = 0; $i <= count($name); $i++);
for ($i = 0; $i <= count($lib_id); $i++);
echo "$name $lib_id";
I get this output in the browser.
Hv001 2 Hv002 3 Hv003 4 (don't really care about format here).
BUT that's not exactly what I am trying to do. What I want to do is get $name and $lib_id in an array format that would look like this:
$chart = array ( array ( "Name", "Hv001", "Hv002", "Hv003" /*these should be the values from $name*/
array ( "Library", "2", "3", "4" /*these should be the values from $lib_id*/)
);
/*the array values change everytime the user gives a different input value ($seq):*/
I believe its all in the declaration at the start, but I'm not quite sure how to go about doing that and then getting it all into the array .... any suggestions? 🙂
Thanks.