jscix Posted February 10, 2007 Share Posted February 10, 2007 Ok, I'm extreamly new to php/sql.. what i'm trying to do is create a table in mysql using a php script... I'm not sure what i'm doing wrong here.. but I am getting the error Fatal error: Call to a member function mysql_query() on a non-object in C:\wamp\www\PHP\Test\createtable.php on line 23 which is: $xx=$connection->mysql_query($query); What am I doing wrong? Anyone? :/ <?php include('db_connect.php'); $connection = mysql_connect($db_host, $db_username, $db_password); if (!$connection){ die ("Could not connect to the database: <br />". mysql_error()); } $query = ' CREATE TABLE `info` ( `username` varchar(26) NOT NULL, `password` varchar(26) NOT NULL, PRIMARY KEY (`username`) )'; $xx=$connection->mysql_query($query); // print ("$xx". mysql_error()); $connection->disconnect(); ?> Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 10, 2007 Share Posted February 10, 2007 $xx= mysql_query($query); $connection isn't an object, as the error is telling you. Quote Link to comment Share on other sites More sharing options...
jscix Posted February 10, 2007 Author Share Posted February 10, 2007 :ooo that's it? wow, thank's alot. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.