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();
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();