In general, friends ... I can not see an error in the code ... There is a code below that inserts the id, name, series fields into the database, but the name is always the same. The output works, but it inserts not ... Where is the cant with brackets ...

$sqlGetContentId = mysql_query("SELECT episode.id, episode.parent_id FROM parser.episode GROUP BY parent_id limit 10"); $sql = mysql_query("SELECT content.id, name, description, screenshot.url, episode.smil, content_types.type_id FROM parser.content, parser.screenshot, parser.episode, parser.content_types WHERE screenshot.id = content.id AND screenshot.size = '768x432' AND content.id = episode.id AND content_types.content_id = content.id LIMIT 10"); while ($row = mysql_fetch_assoc($sql)) { echo $id = $row['id']; echo "<br>"; echo $name = $row['name'] . "\n"; echo "<br>"; echo $description = $row['description'] . "\n"; echo "<br>"; echo $url = $row['url'] . "\n"; echo "<br>"; echo $smilSelect = $row['smil'] . "\n"; echo "<br>"; echo $typesId = $row['type_id'] . "\n"; echo "<br>"; } if ($sql == true) { if ($sqlGetContentId == true) { while ($row = mysql_fetch_assoc($sqlGetContentId)) { $newId = $row['id']; $contentId = $row['parent_id']; $sqlGetCount = mysql_query("SELECT count(episode_num) AS counterContent FROM parser.episode WHERE parent_id = $contentId"); if ($sqlGetCount == true) { $row = mysql_fetch_row($sqlGetCount); if ($row[0] > 1) { $number = $row[0]; $arr = range(1, $row[0]); echo $str = serialize($arr); $string = $str; echo "<br>"; $inertFilm = mysql_query("INSERT INTO stalker_db.news (id, name, series) VALUES ('$newId', '$name', '$str')"); } if ($row[0] == 1) { $urlFilm = "http://main.itv.by/getsmil.php?season=0&episode=0&content=$id"; $inertFilm = mysql_query("INSERT INTO stalker_db.news (id, name, series) VALUES ('$id', '$name', '$str')"); echo "This is film: " . "\n"; echo "<br>"; } } } } 

}

Closed due to the fact that off-topic participants Visman , Vladimir Glinskikh , tutankhamun , Saidolim , PloadyFree Aug 26 '15 at 18:40 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • “Questions asking for help with debugging (“ why does this code not work? ”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question . Questions without an explicit description of the problem are useless for other visitors. See How to create minimal, self-sufficient and reproducible example . " - Visman, Vladimir Glinskikh, tutankhamun, Saidolim, PloadyFree
If the question can be reformulated according to the rules set out in the certificate , edit it .

    1 answer 1

    So you nowhere in the insertion loop assign a new value to the variable $name , remaining always equal to the last displayed value.

    Make sure that you use the required variable names in the insertion process and do not forget to assign them the necessary values ​​in the insertion loop.