How To Merge 2 Tables In 1 Table
Hi!
please this time i want use your last script for another colonn but it gave me a message error :s Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:xampphtdocsnew_scriptupdate_film.php on line 7 the file "update_film.php" is: <?php include('connect.php'); ?> <?php $acteur = @mysql_query("select * FROM `allfilms` order by id desc"); while($acteur = mysql_fetch_array($acteur)) { $name = str_replace("@", "'", $acteur['Acteur']); $films2 = @mysql_query("select * FROM `allfilms` where `name` LIKE '%$name%'"); $film = mysql_fetch_array($films2); if ($film) { if(mysql_query("update `films` set `Acteur` = '".$acteur['Acteur']."' where id = '".$film['id']."'")){ echo 'the film no('.$film['id'].') is updated <br>'; } }else{ echo 'there is an error with '.$name.' and '.mysql_error(); } } ?>my structure of "allfilms" is : id, name , realisateur , Acteur , annee , categorie , duree , desc , image , time the second table "films" has the same structure of "allfilms" the update i wanna make it now is colonn of "Acteur" because the table "films" of this colonn "Acteur" is empty thanke you so much
1 Answer
this is the fixed code:
<?php include(\'connect.php\'); ?> <?php $sql = @mysql_query(\"select * FROM `allfilms` order by id desc\"); while($acteur = mysql_fetch_array($sql)) { $films2 = @mysql_query(\"select * FROM `films` where `name` LIKE \'%$acteur[\'name\']%\'\"); $film = mysql_fetch_array($films2); if ($film) { if(mysql_query(\"update `films` set `Acteur` = \'\".$acteur[\'Acteur\'].\"\' where id = \'\".$film[\'id\'].\"\'\")){ echo \'the film no(\'.$film[\'id\'].\') is updated <br>\'; } }else{ echo \'there is an error with \'.$name.\' and \'.mysql_error(); } } ?> Posted: xtremex 0 of 0 people found this answer helpful. Did you? Yes No |
© Advanced Web Core. All rights reserved