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(); ?> Link to comment https://forums.phpfreaks.com/topic/37946-solved-getting-php-to-create-a-table-in-mysql/ 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. Link to comment https://forums.phpfreaks.com/topic/37946-solved-getting-php-to-create-a-table-in-mysql/#findComment-181600 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. Link to comment https://forums.phpfreaks.com/topic/37946-solved-getting-php-to-create-a-table-in-mysql/#findComment-181604 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.