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
https://forums.phpfreaks.com/topic/87459-unknown-error/
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
https://forums.phpfreaks.com/topic/87459-unknown-error/#findComment-447311
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
https://forums.phpfreaks.com/topic/87459-unknown-error/#findComment-447327
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.