Sorry very very new to php , obviously my code below is wrong. What should the code be?

$result = mysql_query("SELECT * FROM TEST Where Name LIKE 'Smith%'") 
or die(mysql_error()); 

// Print out result
while($row = mysql_fetch_array($result)){
	echo "There are ". $row['COUNT(Surname)'] .";
}

Thanks If anyone can help

$result = mysql_query("SELECT COUNT(*) FROM TEST Where Name LIKE 'Smith%'") or die(mysql_error()); 

// Print out result
while($row = mysql_fetch_array($result)){
	echo "There are ". $row[0] .";
}

thanks for the help, but i get an error on the page row number that is outside the </body> of the page????

What is the problem please?

PHP Syntax (Toggle Plain Text)

$result = mysql_query("SELECT COUNT(*) FROM TEST Where Name LIKE 'Smith%'") or die(mysql_error()); 

// Print out result
while($row = mysql_fetch_array($result)){
    echo "There are ". $row['COUNT(Surname)'] ."; <-- This is the problem I guess
}

There should be another double quote right.

Oh yeah, I forgot :) WickedSelf is right.

Alternatively, you can take out the dot-double-quote, so you're left with this:

$result = mysql_query("SELECT COUNT(*) FROM TEST Where Name LIKE 'Smith%'") or die(mysql_error()); 

// Print out result
while($row = mysql_fetch_array($result)){
	echo "There are ". $row[0];
}
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.