1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| 1. ## FICHIER DE MIGRATION VERS DRUPAL
2.
3. # CONFIGURATION DE LA BASE DE DONNEE
4. $dbhost = 'localhost';
5. $dbname = 'drupal';
6. $dbuser = 'root';
7. $dbpass = '';
8.
9. # CONNEXION MYSQL
10. $connect = mysql_connect($dbhost,$dbuser,$dbpass);
11. mysql_select_db($dbname,$connect);
12.
13. //IMPORTATION DES DONNEES DANS LA BASE NODE
14.
15. # LECTURE DES DONNEES DE LA TABLE SOURCE
16. $result = mysql_query('
17. SELECT
18. *
19. FROM
20. recettes
21. ORDER BY
22. id
23. ASC');
24. $row = mysql_fetch_array($result);
25.
26. while($row = mysql_fetch_array($result)) {
27. $numid=mysql_fetch_array(mysql_query('SELECT max(nid) FROM node'));
28. $i = ++$numid['0'];
29.
30. mysql_query("
31. INSERT INTO node
32. (nid,vid ,type ,language ,title ,uid ,status ,created ,changed ,comment ,promote ,moderate ,sticky ,tnid ,translate)
33. VALUES
34. ('NULL' ,'".$i."' , 'recette', 'fr', '".$row[titre]."', '1', '1', '1246872423', '1246872423', '2', '1', '0', '0', '0', '0')
35. " ) or mysql_error();
36.
37. } |
Partager