Jump to content

Unknown Error


Drezard

Recommended Posts

Im getting an error I have no clue what it means:

 

Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in C:\xampp\htdocs\rgk\extensions\generator.php on line 20

 

So heres my code:

 

generator.php

<?php

include('extensions/includes/connection.inc.php');

$database = new connection;

class generator {

public $username;
public $query;
public $phrase_id;
public $phrase;

function generate () {

	$this->username = 'tom';

	$this->query = "SELECT phrase_id FROM user_ids WHERE username='$username'";

	$this->phrase_id = $database::fetch_one($this->query);

	$this->query = "SELECT phrase FROM admin_paraphrases WHERE phrase_id='$phrase_id'";

	$this->phrase = $database::fetch_one($this->query);

	echo $this->phrase;

}

}

 

and just incase you need the fetch_one function from database.inc.php:

 

function fetch_one($query) {

	$this->result = mysql_query($query);

	$this->output = mysql_fetch_array($this->result);

	$this->variable = $this->output[0];

	return $this->variable;

}

 

What have I done wrong?

 

Daniel

Link to comment
Share on other sites

include('extensions/includes/connection.inc.php');
class generator {
$database = new connection;
public $username;
public $query;
public $phrase_id;
public $phrase;

function generate () {

	$this->username = 'tom';

	$this->query = "SELECT phrase_id FROM user_ids WHERE username='$username'";

	$this->phrase_id = $database->fetch_one($this->query);

	$this->query = "SELECT phrase FROM admin_paraphrases WHERE phrase_id='$phrase_id'";

	$this->phrase = $database->fetch_one($this->query);

	echo $this->phrase;

}

}

 

try to do something like that.. the error says you used :: that is incorrect

Link to comment
Share on other sites

include('extensions/includes/connection.inc.php');
class generator extends connection{
public $username;
public $query;
public $phrase_id;
public $phrase;

function generate () {

	$this->username = 'tom';

	$this->query = "SELECT phrase_id FROM user_ids WHERE username='$username'";

	$this->phrase_id = parent::fetch_one($this->query);

	$this->query = "SELECT phrase FROM admin_paraphrases WHERE phrase_id='$phrase_id'";

	$this->phrase = parent::fetch_one($this->query);

	echo $this->phrase;

}

}

 

try

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.