I have no idea why this error is happening, it’s shown in all the expressionengine tutorials and on the forums yet for some reason I still get it? line 43 is shown in the script
class upload_pictures
{
public function upload_pictures()
{
if (!isset($whats_gonna_happen))
{
$uploads='';
$cout=1;
if (!table_exists('albums'))
{
//line 43 below
$this->EE->db->query("CREATE TABLE albums(
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(id)
name VARCHAR(50)
") or die(mysql_error());
}
$stuff=$this->EE->db->query('SELECT id, name FROM albums');help?
Hi SDuke & welcome 😊
In order to get access to the “EE super object” you have to add one more line. Right after your function’s opening brace add “$this->EE =& get_instance();” so your code looks like this:
class upload_pictures
{
public function upload_pictures()
{
$this->EE =& get_instance();
if (!isset($whats_gonna_happen))
{
$uploads='';
$cout=1;
if (!table_exists('albums'))
{
//line 43 below
$this->EE->db->query("CREATE TABLE albums(
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(id)
name VARCHAR(50)
") or die(mysql_error());
}
$stuff=$this->EE->db->query('SELECT id, name FROM albums');sorry but one more question.
Never be sorry for asking a question! 😊
…what I want is to make it so that the upload page is in the cp of expressionengine ( or just accesible there ) so nobody can do some url hacking to get into it. How would I do this?
You’ll need a MCP file for that. Take a look through the Module Development Tutorial if you haven’t already. This part in particular: http://ellislab.com/expressionengine/user-guide/development/module_tutorial.html#control_panel_file
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.