PDO и хранимая процедура
так правильно или нет
Код:
define('DB_DRIVER','mysql');
define('DB_HOST','localhost');
define('DB_NAME','test');
define('DB_USER','root');
define('DB_PASS','');
$connect_str = DB_DRIVER . ':host='. DB_HOST . ';dbname=' . DB_NAME;
$db = new PDO($connect_str,DB_USER,DB_PASS);
$result = $db->query("new_user");
define('DB_HOST','localhost');
define('DB_NAME','test');
define('DB_USER','root');
define('DB_PASS','');
$connect_str = DB_DRIVER . ':host='. DB_HOST . ';dbname=' . DB_NAME;
$db = new PDO($connect_str,DB_USER,DB_PASS);
$result = $db->query("new_user");
Код:
// в начале конфиг
define('DB_DRIVER','mysql');
define('DB_HOST','localhost');
define('DB_NAME','test');
define('DB_USER','root');
define('DB_PASS','');
// соединяемся с базой данных
$connect_str = DB_DRIVER . ':host='. DB_HOST . ';dbname=' . DB_NAME;
$db = new PDO($connect_str,DB_USER,DB_PASS);
$result = $db->query("CALL new_user($login, $password, $country, $city, $mail, $phone)";);
define('DB_DRIVER','mysql');
define('DB_HOST','localhost');
define('DB_NAME','test');
define('DB_USER','root');
define('DB_PASS','');
// соединяемся с базой данных
$connect_str = DB_DRIVER . ':host='. DB_HOST . ';dbname=' . DB_NAME;
$db = new PDO($connect_str,DB_USER,DB_PASS);
$result = $db->query("CALL new_user($login, $password, $country, $city, $mail, $phone)";);