PDA

View Full Version : mysql


dimx
05-30-2001, 01:12 PM
I'd like to know if anyone here is having problems accessing mysql with PHP?

I do the simplest function, and I get an error when quering the database.

mysql_connect("localhost", "username", "password");
mysql_select_db("database");
// I get errors after I connect and make the database active
// I created the table using PHP myadmin because when I
// tried to do it in php it didn't work!

mysql_query("CREATE TABLE tablename(rowid INT AUTO_INCREMENT)");
mysql_query("INSERT INTO tablename SET value='1'");
$query = mysql_query("SELECT * FROM tablename");
$rows = mysql_num_rows($query);
echo $rows;
mysql_close();

BbBoy
05-30-2001, 01:34 PM
What are the errors?

dimx
05-30-2001, 01:45 PM
I think the database was corrupted. I deleted it and re-created it and it works.