setReturnType resultsetUsing the following code I have managed to display the array straight after it
<?php
include_once "./cpmfetch/cpmfetch.php";
$objCpm = new cpm("./cpmfetch/cpmfetch_config.php");
$options = array( "<hr />", "noimage" => "");
$objCpm->cpm_setReturnType("resultset");
$table = $objCpm->cpm_viewTopRatedMediaFrom ("cat=1",100,1,$options);
print_r($table) ;
$objCpm->cpm_close();
?
Produces:
Array ( [0] => Array ( [pFilepath] => userpics/10004/ [pFilename] => Autumn_morning.jpg [pAid] => 3 [pFilesize] => 204624 [pTitle] => Autumn morning [pCaption] => The field opposite my home [pOwner_name] => Mike Young [pOwnerId] => 4 [pCtime] => 1193671357 [pHits] => 2 [pPid] => 7 [pPic_Rating] => 100000 [pVotes] => 100 [pWidth] => 1000 [pHeight] => 731 [pUser1] => [pUser2] => [pUser3] => [pUser4] => [cCid] => [cName] => [cDescription] => [cPos] => [cParent] => [cThumb] => [aAid] => 3 [aTitle] => Mikes bits and bobs [aDescription] => [aVisibility] => 0 [aPos] => 1 [aCategory] => 10004 [aThumb] => 0 [aKeyword] => [fullPathToThumb] => albums/userpics/10004/thumb_Autumn_morning.jpg [fullPathToNormal] => albums/userpics/10004/normal_Autumn_morning.jpg [fullPathToFull] => albums/userpics/10004/Autumn_morning.jpg [cpmSubtitle] => Autumn morning
by Mike Young
I want to be able to use this array, grab some of the values and insert into another database table for further usage, only I'm having trouble grabbing the values. I've read up on arrays and it appears that they are seperated by '' or `` but the array above uses [].
So in the new file below I have insert into table, field is "filetype" and value is pFiletype which does not work, so I also tried pFiletype and filetype and even [pFiletype], but these do not work either. I'm obviously missing something about manipulating arrays...as I dont think resultset would have been written by Vuud for no reason
<?php
define('IN_COPPERMINE', true);
require('include/init.inc.php');
include_once "./cpmfetch/cpmfetch.php";
$objCpm = new cpm("./cpmfetch/cpmfetch_config.php");
$options = array( "<hr />", "noimage" => "");
$objCpm->cpm_setReturnType("resultset");
$table = $objCpm->cpm_viewTopRatedMediaFrom ("cat=1",100,1,$options);
print_r($table) ;
$objCpm->cpm_close();
$sql = "INSERT INTO {$CONFIG['TABLE_TEST']} ".
"(filepath, filename) ".
"VALUES ('pFilepath', 'pFilename')";
$result = cpg_db_query($sql)
?
How can I grab certain parts of this array and insert them into a new database table?
Thanks in advance
Steve...