PDA

View Full Version : db selection


Aymen++
03-29-2004, 10:31 AM
i tried to use this code to select a database named aymen:

<?php
$conn=mysql_connect();
mysql_select_db("aymen", $conn);
$sql="create table testTable (id int not null primary key auto_increment, testField varchar(75))";
$result=mysql_query($sql, $conn) or die(mysql_error());
echo $result;
?>

but i have this message:
No Database Selected
and i'm sure that i have the database named aymen.

Steveo31
03-29-2004, 04:23 PM
Forum hiccup or did you not enter code? I would assume you did...


<?php

$db = mysql_connect('localhost', 'root');
mysql_select_db('aymen', $db);

?>


Should do it.