el codigo php es este:
Código PHP:
if ( $_POST )
{
//echo "<pre>";
//print_r( $_POST);
//die();
$p = $_POST;
$saved=true;
foreach ( $p['links'] as $link )
{
mysql_query("UPDATE movies_links SET
url='".mysql_real_escape_string($link['url'])."',
lang='".mysql_real_escape_string($link['lang'])."',
title='".mysql_real_escape_string($link['title'])."',
platform='".mysql_real_escape_string($link['platform'])."'
WHERE
id='".$link['id']."'
");
}
foreach ( $p['new_links'] as $link )
{
mysql_query("INSERT INTO movies_links ( movie_id,url,lang,title,platform ) VALUES (
'".$p['id']."',
'".mysql_real_escape_string($link['url'])."',
'".mysql_real_escape_string($link['lang'])."',
'".mysql_real_escape_string($link['title'])."',
'".mysql_real_escape_string($link['platform'])."'
)");
}
mysql_query("UPDATE moviesv2 SET
name_es = '".mysql_real_escape_string($p['name_es'])."',
name_en = '".mysql_real_escape_string($p['name_en'])."',
extra_name_es = '".mysql_real_escape_string($p['extra_name_es'])."',
extra_name_en = '".mysql_real_escape_string($p['extra_name_en'])."',
category_name_es = '".mysql_real_escape_string($p['category_name_es'])."',
category_name_en = '".mysql_real_escape_string($p['category_name_en'])."',
thumbnail = '".mysql_real_escape_string($p['thumbnail'])."',
picture = '".mysql_real_escape_string($p['picture'])."',
picture_top = '".mysql_real_escape_string($p['picture_top'])."',
description_es = '".mysql_real_escape_string($p['description_es'])."',
description_en = '".mysql_real_escape_string($p['description_en'])."',
duration = '".mysql_real_escape_string($p['duration'])."',
year = '".mysql_real_escape_string($p['year'])."',
director = '".mysql_real_escape_string($p['director'])."',
staff = '".mysql_real_escape_string($p['staff'])."',
valid = '".mysql_real_escape_string($p['valid'])."',
report_type = '".mysql_real_escape_string($p['report_type'])."',
keywords = '".mysql_real_escape_string($p['keywords'])."'
WHERE id = ".$p['id'] );
if ( $_POST['update_date'] == 'ok' )
{
mysql_query("UPDATE moviesv2 SET date_added = '".date("Y-m-d H:i:s")."' WHERE id = ".$p['id'] );
}
aparte para crear links uso javascript para añadir mas campos:
Código:
function addLink()
{
var num = $$('mr').length;
var html = '<hr><mr>URL: <input type="text" name="new_links['+num+'][url]" style="width:950px;" /><br>';
html += 'Lang: <select name="new_links['+num+'][lang]">';
html += '<option value="español españa">Español</option>';
html += '<option value="español latino">Latino</option>';
html += '<option value="versión original subtitulada">VO</option>';
html += '<option value="inglés">Ingles</option>';
html += '</select>';
html += '<select name="new_links['+num+'][platform]">';
html += '<option value="vk">Vk</option>';html += '<option value="yt">Youtube</option>';html += '<option value="nv">Nowvideo</option>';html += '<option value="pl">Putlocker</option>';html += '<option value="mv">Moevideos</option>';html += '<option value="amv">AllMyVideos</option>';html += '<option value="ply">Played.to</option>';html += '<option value="sc">Streamcloud</option>'; html += '</select> <br>';
html += 'Title: <input type="text" name="new_links['+num+'][title]" style="width:950px;" /><br>';
$('new_links').insert(html);
}