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

Probably you do not have PHP version 5.3 or higher.

I am using "PHP Version 5.3.5".

Apparantly, you need to use backslashes, see the manual.

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/>

Start a new thread for this, use code tags for your code, and highlight the offending line.

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?

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.

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';
		
	}
?>

:)

And Phorce is the expert you were looking for!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.