Kreiranje baze iz php-ja problem
2 naročnika
2 naročnika
Nekaj mi razbija glavo in sicer:
V cms-ju dodam novo domeno, in ob tem se mora izvršit query, ki skreira novo bazo, naredi tabele itd...
napaka:
1064: 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 '; -- -- Database: imebaze
-- CREATE DATABASE `imeba' at line 10
Če pa ta isti query skopiram v phpmyadmin pa gre normalno čez.
Uporabljam adodb Database::getInstance()->query($query);
mysql user = root
?:confused:
4 odgovori
-- phpMyAdmin SQL Dump
-- version 2.10.1
-- http://www.phpmyadmin.net
-- Host: localhost
-- Generation Time: Oct 24, 2007 at 11:05 PM
-- Server version: 5.0.41
-- PHP Version: 5.2.3
SET SQLMODE="NOAUTOVALUEON_ZERO";
--
-- Database: {$database}
CREATE DATABASE {$database}
DEFAULT CHARACTER SET ucs2 COLLATE ucs2slovenianci;
USE {$database}
;
v prejšnem postu je prvih 15 vrstic iz database.tpl
$this->tpl->assign('database', $domain->_database);
$query = $this->tpl->fetch('database.tpl');
if(Database::getInstance()->query($query))
[INDENT]print('ok');[/INDENT]
else{
[INDENT]print(Database::getInstance()->ErrorMsg()); [/INDENT]
}
query fetcham s smarty-jem iz templata, kjer se spreminja ime baze.
Ne razumem zakaj deluje BP, če ta query izpišem in ga copy/pastam v phpmyadmin, če ga pa executam, pa vrže error
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 '; -- -- Database: affiliate_project_imebaze
-- CREATE DATABASE `affili' at line 10