0

Hi,
I dont know, what mistake i made in my code.

[B]test1.php[/B]
<?php
namespace MyNameSpace;
class A
{
  public function B()
  {
      echo "san";
  }
}
?>
[B]test2.php[/B]
<?php
include('test1.php');
$test=new MyNameSpace::A();
$test->B();
?>

http://localhost/test2.php
Error:
Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE or '$' in C:\xampp\htdocs\MyNameSpace\test2.php on line 3

6
Contributors
9
Replies
22
Views
6 Years
Discussion Span
Last Post by gilgil2
0

Parse error: syntax error, unexpected T_STRING in /var/www/vhosts/numyspace.co.uk/web_users/home/~unn_v026713/public_html/updatebook.php on line 29

The browser keeps coming up with this error in my code but i see anything wrong with it :-(

Ive tried everything and nothing has changed....Arghhhhhhhhhhhhhhhhhhhh!!!!!!!!!

.....Please Help!!!

Heres my code! I have put stars next to line 29 code!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Updating using select lists</title>
</head>
<body>


<?php


include 'links.php';

$bookISBN = $_GET;
$bookTitle = $_GET;
$bookYear = $_GET;
$pubID = $_GET;
$catID = $_GET;
$bookPrice = $_GET;

$sql = "UPDATE nbc_book SET bookISBN = '$bookISBN', bookTitle = '$bookTitle', bookYear = '$bookYear', pubID = '$pubID', catID = '$catID', bookPrice = '$bookPrice'";

$queryresult = mysql_query($sql);
if ($queryresult === false ) {
echo "Updating $bookTitle failed: " . mysql_error();**********************
}
else { echo "Book has been updated";
}

?>

<p><a href="chooseBook.php">Go back to choose a book</a></p>

<body/>
<head/>

0

I don't see a need to start a new thread. I am relatively new to PHP, but in the line just before line 29(the one with the stars) there is a triple "=" as in "===". Is that correct?

0

I think the problem is with the "===" I am not a PHP expert, but === means that the values and variables are the same for it to be true, try "==" and see if that works.

Edited by gilgil2: n/a

0

I think the problem is with the "===" I am not a PHP expert, but === means that the values and variables are the same for it to be true, try "==" and see if that works.

That's the way I view them =) ..

<?php

	$num = (int) 4;
	$num2 = (string) "4";
	
	if($num === $num2) // will print "no"
	{
		echo 'Yes';
	}else{
		echo 'No';
	}
	
	if($num == $num2) // Will print "Yes"
	{
		echo 'Yes';
	}else{
		echo 'No';
		
	}
?>

:)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.