Jump to content

Barand

Moderators
  • Content count

    18,664
  • Joined

  • Last visited

  • Days Won

    328

Barand last won the day on November 14

Barand had the most liked content!

Community Reputation

1,213 Excellent

About Barand

  • Rank
    Sen . ( ile || sei )

Profile Information

Recent Profile Visitors

55,876 profile views
  1. Barand

    Declaring Variable Hell

    Set default values $customerNumber = $_POST['customerNumber'] ?? ""; $loop_counter = $_POST['loop_counter'] ?? 0; // etc
  2. As are many of us. I first started with SQL using dBase and Foxbase. Get out of the habit of using "SELECT * ". You should specify just the columns you need. Dragging all the data from the server makes your queries really inefficient.
  3. Barand

    Why isn't it working

    Probably because it's using out of date mysql_ functions that no longer exist in PHP. Try turning on php error reporting and refer to the manual occasionally.
  4. Good idea. Reminds me, it's time for another G&T.
  5. Barand

    Sending mail from multiple table

    foreach (email type) { create message etc get recipients foreach (recipient) { add to BCC list } send email }
  6. The question now is "What are you going to do with that 8m 17secs that you just saved? 😄
  7. Barand

    Transfer JS data to PHP

    Javascript is on the client, php is on the server. To communicate between the two you need to put the value in a form field (input, hidden or textarea) and submit the form, or use AJAX and send the value to the server
  8. If it helps, this puts it all together in a PHP script <?php include('db_inc.php'); $db = pdoConnect("test"); // connect to "test" database function get_data($path){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$path); curl_setopt($ch, CURLOPT_FAILONERROR,1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_TIMEOUT, 15); $retValue = curl_exec($ch); curl_close($ch); return $retValue; } $url = "http://cdn-rss.bigfishgames.com/src.php?feedtype=game&username=KlyxGaming&content=glrelease&gametype=pc&type=6&locale=en"; $xml = get_data($url); file_put_contents('game1.xml', $xml); $db->exec("DROP TABLE gameinput"); $db->exec("CREATE TABLE `gameinput` ( `gameid` int(11) NOT NULL, `gamename` varchar(250) DEFAULT NULL, `family` varchar(250) DEFAULT NULL, `familyid` int(11) DEFAULT NULL, `productid` int(11) DEFAULT NULL, `genreid` int(11) DEFAULT NULL, `allgenreid` varchar(250) DEFAULT NULL, `shortdesc` varchar(250) DEFAULT NULL, `meddesc` text, `longdesc` text, `bullet1` varchar(250) DEFAULT NULL, `bullet2` varchar(250) DEFAULT NULL, `bullet3` varchar(250) DEFAULT NULL, `bullet4` varchar(250) DEFAULT NULL, `foldername` varchar(250) DEFAULT NULL, `price` varchar(50) DEFAULT NULL, `hasdownload` varchar(50) DEFAULT NULL, `macgameid` int DEFAULT NULL, `hasvideo` varchar(50) DEFAULT NULL, `hasflash` varchar(50) DEFAULT NULL, `hasdwfeature` varchar(50) DEFAULT NULL, `gamerank` int(11) DEFAULT NULL, `releasedate` datetime DEFAULT NULL, `gamesize` long DEFAULT NULL, `sysreqos` varchar(250) DEFAULT NULL, `sysreqmhz` varchar(50) DEFAULT NULL, `sysreqmem` int(11) DEFAULT NULL, `sysreqdx` varchar(10) DEFAULT NULL, `sysreqhd` int(11) DEFAULT NULL, PRIMARY KEY (`gameid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8" ); $db->exec("LOAD XML LOCAL INFILE 'C:/inetpub/wwwroot/test/game1.xml' INTO TABLE gameinput ROWS IDENTIFIED BY '<game>'" ); // CHECK DOWNLOAD/LOAD TABLE $res = $db->query("SELECT COUNT(*) FROM gameinput"); printf("Game records loaded: %d<br>", $res->fetchColumn()); ?>
  9. I just ran it with your data mysql> LOAD XML LOCAL INFILE 'C:/inetpub/wwwroot/test/game.xml' -> INTO TABLE gameinput -> ROWS IDENTIFIED BY '<game>'; Query OK, 4975 rows affected (3.54 sec)
  10. I was experimenting too. This worked (at least the one record you provided): CREATE TABLE `gameinput` ( `gameid` int(11) NOT NULL, `gamename` varchar(50) DEFAULT NULL, `family` varchar(50) DEFAULT NULL, `familyid` int(11) DEFAULT NULL, `productid` int(11) DEFAULT NULL, `genreid` int(11) DEFAULT NULL, `allgenreid` varchar(50) DEFAULT NULL, `shortdesc` varchar(50) DEFAULT NULL, `meddesc` varchar(250) DEFAULT NULL, `longdesc` text, `bullet1` varchar(50) DEFAULT NULL, `bullet2` varchar(50) DEFAULT NULL, `bullet3` varchar(50) DEFAULT NULL, `bullet4` varchar(50) DEFAULT NULL, `foldername` varchar(50) DEFAULT NULL, `price` varchar(50) DEFAULT NULL, `hasdownload` varchar(50) DEFAULT NULL, `macgameid` int(11) DEFAULT NULL, `hasvideo` varchar(50) DEFAULT NULL, `hasflash` varchar(50) DEFAULT NULL, `hasdwfeature` varchar(50) DEFAULT NULL, `gamerank` int(11) DEFAULT NULL, `releasedate` datetime DEFAULT NULL, `gamesize` int(11) DEFAULT NULL, `sysreqos` varchar(50) DEFAULT NULL, `sysreqmhz` varchar(50) DEFAULT NULL, `sysreqmem` int(11) DEFAULT NULL, `sysreqdx` varchar(10) DEFAULT NULL, `sysreqhd` int(11) DEFAULT NULL, PRIMARY KEY (`gameid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; LOAD XML LOCAL INFILE 'C:/inetpub/wwwroot/test/game.xml' INTO TABLE gameinput ROWS IDENTIFIED BY '<game>'; You have some work to normalising the data (eg the comma delimited allgenreid field) and the bulletN fields.
  11. Canyou provide a sample of the XML you are trying to load?
  12. Fastest way is with mysql's LOAD XML command
  13. There is also an alternative solution you could use without FULLTEXT. EG (using same data) SELECT id , link , description , IF(INSTR(description,'register'),1,0) + IF(INSTR(description,'domain'),1,0) + IF(INSTR(description,'name'),1,0) as rank FROM notices ORDER BY rank DESC; +----+------------------------+---------------------------------------+------+ | id | link | description | rank | +----+------------------------+---------------------------------------+------+ | 1 | http://cheapnames.it | Register domain names from $1 to $25 | 3 | | 6 | http://gomama.uk | Register your domain name for $1 | 3 | | 2 | http://lownames.usa | Get domain names from $1 to $20 | 2 | | 3 | http://lowcostnames.uk | Register domains for as low as $1 | 2 | | 4 | http://getdoman.biz | Register names from between $1 to $25 | 2 | | 5 | http://gopapa.uk | Domains for as low as $1 | 1 | | 7 | http://petemporium.com | Puppies and kittens free | 0 | | 8 | http://gamblersrus.com | Bingo, roulette and poker | 0 | +----+------------------------+---------------------------------------+------+
  14. Barand

    How to get data from MySQL

    Try this tutorial
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.