Hi guys!
looks like the mod is letting this morph to a different topic.. thats cool.
thank you for all the responses. gives me good food for thought.
Im starting to think laserlight is a sales rep for sql lite LOL!! I havent looked into that, and the highlights you bring up are worth me taking a look.
I did not realize that sql lite and mysql were different, or at least to the degree you mentioned.
I can, remod the install app to create the all the db stuff as required so a user would not have to jump into cpanel to make / add databases. Something NOT required with FF.
Is there a good site to check up on sql lite? (yes I'll google it, just getting a jump star here - laser? heheh)
@
here is the curl i use to read the rss page
function getXMLFeed($xml_feed)
{
############################################################################
##### GRAB GAME XML BY CURL
############################################################################
$ch = curl_init($xml_feed);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 0);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
and the import routine (flat file - it is very similar to the sql version i have)
############################################################################
##### OPEN UP (OR CREATE) THE DATABASE TEXT FILE
############################################################################
$game_file = fopen('data/game.db','w');
############################################################################
##### PROCESS XML FILE AS PROVIDED BY $DATA
############################################################################
$data = getXMLFeed(XML_FEED);
$data = new SimpleXMLElement($data);
foreach($data->gamexml->game as $game)
{
################################################################
##### CLEAN UP ALL THE STRINGS
################################################################
/**
* some games do not have a rank, so we'll fix that here
* */
$gamerank = !$game->gamerank ? 0 : (string)$game->gamerank;
/**
* good trick to get exact genre searches
* */
$allgenreid = ','.(string)$game->allgenreid.',';
/**
* macgameid and oggameid are NULL'ed sometimes so we will set
* them to 0 here
* */
$macgameid = 0;
$oggameid = 0;
if($game->macgameid > 0) $macgameid = (string)$game->macgameid;
if($game->oggameid > 0 ) $oggameid = (string)$game->oggameid;
$ostype = ',pc,';
if($macgameid > 0) $ostype .= 'mac,';
if($oggameid > 0) $ostype .= 'og,';
/**
* of all the nerve LOL
* descriptions sometimes have a hard return right in the middle
* of the string, we'll clean it up here
* */
$longdesc = str_replace("\n","",(string)$game->longdesc);
$shortdesc = str_replace("\n","",(string)$game->shortdesc);
$meddesc = str_replace("\n","",(string)$game->meddesc);
$bullet1 = str_replace("\n","",(string)$game->bullet1);
$bullet2 = str_replace("\n","",(string)$game->bullet2);
$bullet3 = str_replace("\n","",(string)$game->bullet3);
$bullet4 = str_replace("\n","",(string)$game->bullet4);
$bullet5 = str_replace("\n","",(string)$game->bullet5);
################################################################
##### PREP DATA TO ARRAY FOR SERIALIZING
################################################################
$gamedata = array (
'gameid' => trim( (string)$game->gameid),
'gamename' => trim( (string)$game->gamename),
'family' => trim( (string)$game->family),
'familyid' => trim( (string)$game->family),
'productid' => trim( (string)$game->productid),
'genreid' => trim( (string)$game->genreid),
'price' => trim( (string)$game->price),
'allgenreid' => $allgenreid,
'shortdesc' => $shortdesc,
'meddesc' => $meddesc,
'longdesc' => $longdesc,
'bullet1' => $bullet1,
'bullet2' => $bullet2,
'bullet3' => $bullet3,
'bullet4' => $bullet4,
'bullet5' => $bullet5,
'foldername' => trim( (string)$game->foldername),
'hasdonwload' => trim( (string)$game->hasdownload),
'macgameid' => $macgameid,
'oggameid' => $oggameid,
'hasvideo' => trim( (string)$game->hasvideo),
'hasflash' => trim( (string)$game->hasflash),
'gamerank' => $gamerank,
'releasedate' => trim( (string)$game->releasedate),
'gamesize' => trim( (string)$game->gamesize),
'sysreqos' => trim( (string)$game->systemreq->pc->sysreqos),
'sysreqmhz' => trim( (string)$game->systemreq->pc->sysreqmhz),
'sysreqmem' => trim( (string)$game->systemreq->pc->sysreqmem),
'sysreqdx' => trim( (string)$game->systemreq->pc->sysreqdx),
'sysreqhd' => trim( (string)$game->systemreq->pc->sysreqhd),
'ostype' => $ostype
);
/**
* serialize the array and save it to data/game.db
* */
$game_data = serialize($gamedata);
fwrite($game_file,$game_data."\n");
}// xml loop
fclose($game_file);
$count = count(file('data/game.db'));
//echo "<p/>IMPORTED $count GAMES SUCCESSFULLY!";
}
Not perfect, but its served its purpose for the last 4yrs. The last part is where i either dump the info in sql or flat file.
enjoy :-)