AsscBB
06-06-2008, 09:55 PM
I'm not sure what I'm doing wrong, but I've been wrestleing with this issue for the past few days (not all day, just when I've had time to play) and the resources I've been referencing have been less than useful
I'm trying to write my first Mod, and I'm trying to create a table in my database from a .php script. I'm using the following to try to insert a test table into my database and I'm getting errors with the function.
<?php
require_once('./global.php');
$DB_site->query(
"CREATE TABLE " . TABLE_PREFIX . "addon_table1 (
addon_table1_ID int() NOT NULL AUTO_INCREMENT PRIMARY KEY,
addon_table1_field1 varchar() NOT NULL,
addon_table1_field2 varchar() NOT NULL
)");
?>
The error I'm getting is:
Fatal error: Call to a member function on a non-object in /home/username/public_html/forums/admincp/test_table.php on line 5
This is my first shot at playing with php and mySQL so I'm not sure what the problem with the query function is. As I understand it, including globab.php should have make the necessary links? Anyway, I'd appreciate any advice!
Scott
I'm trying to write my first Mod, and I'm trying to create a table in my database from a .php script. I'm using the following to try to insert a test table into my database and I'm getting errors with the function.
<?php
require_once('./global.php');
$DB_site->query(
"CREATE TABLE " . TABLE_PREFIX . "addon_table1 (
addon_table1_ID int() NOT NULL AUTO_INCREMENT PRIMARY KEY,
addon_table1_field1 varchar() NOT NULL,
addon_table1_field2 varchar() NOT NULL
)");
?>
The error I'm getting is:
Fatal error: Call to a member function on a non-object in /home/username/public_html/forums/admincp/test_table.php on line 5
This is my first shot at playing with php and mySQL so I'm not sure what the problem with the query function is. As I understand it, including globab.php should have make the necessary links? Anyway, I'd appreciate any advice!
Scott