Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
anyone help with this code
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / General / General Chat

2022-11-27 17:01:08
I been playing with adding genre to the database pulled from imdb. I have this code
if ($row["genre"]='NULL'){
$str = strstr($_data->Genre, ',', true);
SQL_Query_exec("UPDATE `torrents` SET `genre` = '".mysqli_real_escape_string ($GLOBALS["DBconnector"],$str). "' WHERE `id` = $id");
}

It works as long as the genre is listed like horror, thriller, action, because it sees the comma then returns the string in front of the comma, but if no comma exists, then nothing gets pulled. Is there a batter way to do this?
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
2022-11-27 21:34:47

<?
if (!is_null($row['genre'])) {
   if (strpos($_data->Genre, ',') !== false) {
       SQL_Query_exec("UPDATE `torrents` SET `genre` = '" . mysqli_real_escape_string($GLOBALS["DBconnector"], $str) . "' WHERE `id` = $id");
   }
}
2022-11-28 09:42:36
@MicroMonkey
why to put in that in sql database, why not read that FROM iMDB genre


www.exyusubs.com
TorrentTrader V3.8.3 (SE)
OS: AlmaLinux 9.9 (BC)
Apache version: 2.4.71
PHP version: 8.5.13 (PHP-FPM)
MySQL version: 10.11.18-MariaDB
2022-11-28 12:09:27
I was just looking at an old idea of pulling similar torrents in a list based on the genre of each movie rather than simliar name
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
2022-11-28 13:18:43
OK interesting idea,
can we develop it in such a way that we directly "import" genre from iMDB to sql database?


www.exyusubs.com
TorrentTrader V3.8.3 (SE)
OS: AlmaLinux 9.9 (BC)
Apache version: 2.4.71
PHP version: 8.5.13 (PHP-FPM)
MySQL version: 10.11.18-MariaDB
2022-11-28 16:24:23
Oh... so your looking at SELECT GROUP_CONCAT(id) AS ids ... FROM ... GROUP BY ...

And in a foreach looping a query WHERE id IN($row[id]) and pushing all that to a array.

I dont know the table structure but I think thats what needs to be done.
Last edited by STorrents2020 on 2022-11-28 16:25:58
2022-11-29 03:48:23
that was the idea I had Botanicar. Pulling data from IMDB genre sometimes has 3 words in it, like "horror, thriller, mystery" But sometimes it only has 1 word, like "comedy", and the problem I am having is The code I posted will search for the first instance of a comma, then insert the data in front of it, which is fine. But if it has no comma, like "comedy" then you get no result inserted into the database. Thats where im stuck. If there is a comma then the code works, but no comma, no work.
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Last edited by MicroMonkey on 2022-11-29 03:48:56
2022-11-29 04:50:52
i did something like this, because updating the torrent is half the issue, the other side was searching that column afterwards. You want to search action the the column is horror,action so it made sense to split the string up and create a tags table

$genre  = $IMDB_GENRE_RESULT;
$pieces = explode(",", $genre);
SQL_Query_exec("INSERT INTO tags (torrentid, type1, type2, type3) VALUES ($id,  $pieces[0],  $pieces[1],  $pieces[2]");


CREATE TABLE `tags` (
 `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
 `torrentid` int(10) DEFAULT NULL,
 `type1` varchar(40) DEFAULT NULL,
 `type2` varchar(40) DEFAULT NULL,
 `type3` varchar(40) DEFAULT NULL,
 PRIMARY KEY (`id`)
) ENGINE=MyISAM;


for search use where in type1 or type2 etc

You would need to check result not empty before inserting

Last edited by M-jay warn on 2022-11-29 14:48:17
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 9
  • Members: 0
  • Guests online: 9
  • Comments: 3
  • Messages: 1,728