Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php/mysql] Dodanie kilku tabel z poziomu php, Jak dodać tabele z poziomu php
-Ed-
post
Post #1





Goście







Witam, chcę dodać kilka tabel z poziomu php

  1. <?php
  2. $connect = @mysql_connect(host, user_db, pass_db);
  3. $select_db = @mysql_select_db(database);
  4. $sql = "CREATE TABLE `ban` (
  5. `id` int(11) NOT NULL auto_increment,
  6. `ip` varchar(255) NOT NULL default '0',
  7. PRIMARY KEY (`id`)
  8. ); CREATE TABLE `pages` (
  9. `id` int(11) NOT NULL auto_increment,
  10. `title` varchar(255) NOT NULL default '',
  11. `text` text NOT NULL,
  12. PRIMARY KEY (`id`)
  13. );
  14. ";
  15. $add = mysql_query($sql) or die(mysql_error());
  16. echo $add;
  17. ?>


Jedną tabele w zapytaniu moge dodać, ale już drugiej nie. Zapytanie na pewno do bani bo wyskakuje mi błąd:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '; CREATE TABLE `pages` ( `id` int(11) NOT NULL auto_increment, `title` var' at line 5

W jaki sposób można dodać kilka tabel, albo jak to zrobić np includując plik baza.sql

Z góry dziękuje za odpowiedź
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 20.08.2025 - 23:40