Question RE: fetch_row() output?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
maddenuk
Forum Commoner
Posts: 27
Joined: Fri May 18, 2007 3:07 am

Question RE: fetch_row() output?

Post by maddenuk »

Parse error: syntax error, unexpected '[', expecting T_STRING or T_VARIABLE or '{' or '$' in /home/creative/public_html/demo1/scripts/validate.class.php on line 193
I keep getting the error above from my sendValidationEmail() function.

I'm trying to output content from the database using the $row[''] method but i assume its not likeing the braces i am using to output. Could someone shed some light on this for me? Thanks...

Code: Select all

private function sendRequestEmail($value)
	{
	
	$results = $this->mMysqli->query('SELECT * FROM users '.
										'WHERE email = "'.$value.'"');
	
	$row = $results->fetch_row();
	
	$time_of_enquiry = date('r');
	$recipient = $value;
	$headers = "MIME-Version: 1.0\n";
	$headers .= "Content-type: text/plain; charset=iso-8859-1\n";
	$headers .= "X-Mailer: php\n";
	$headers .= 'IPI';
	$subject = "Username and Password Request from IPI";
	$mail = '
	Dear IPI Memeber,
	
	You requested to know your username and password, these are below
	
	Username:'.$row['username'].' 
	Password:'.$row['password'].'
	
	Regards,
	IPI
	
			
			';
			
			$result = mail($recipient, $subject, $mail, $headers); 
	
	
	}
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

I don't get a parse error for

Code: Select all

<?php
class foo {
  private function sendRequestEmail($value)
  {

  $results = $this->mMysqli->query('SELECT * FROM users '.
                                                        'WHERE email = "'.$value.'"');

  $row = $results->fetch_row();

  $time_of_enquiry = date('r');
  $recipient = $value;
  $headers = "MIME-Version: 1.0\n";
  $headers .= "Content-type: text/plain; charset=iso-8859-1\n";
  $headers .= "X-Mailer: php\n";
  $headers .= 'IPI';
  $subject = "Username and Password Request from IPI";
  $mail = '
  Dear IPI Memeber,

  You requested to know your username and password, these are below

  Username:'.$row['username'].'
  Password:'.$row['password'].'
  
  Regards,
  IPI


  ';

  $result = mail($recipient, $subject, $mail, $headers);
  }
}
Post Reply