Jump to content

string comparison..help please..


demented_gurl

Recommended Posts

hye. i'm trying to compare 2strings, 1string is passed from the database, and the other string is passed from a textfield in a form. below is the code that i have tried, but the page shows an error concerning  " while($Row= mysql_fetch_row($result)) "..please help.

 

current_project_title - is the column name of the previous projects stored.

project_name - the project name passed from textfield.

 

<?php

 

$current_project_title  = $_Get["current_project_title"];

 

$query = "SELECT * FROM project";

$result = mysql_query($query);

$similar = 0;

while($Row= mysql_fetch_row($result))

{

 

$project_name = $Row["project_name"];

 

if (strcmp($current_project_title,$project_name) > 90%)

 

similar = 1;

 

echo ("$project_name",$year);

}

 

if($similar > 0)

{no register}

 

else

{register};

 

 

 

?>

Link to comment
https://forums.phpfreaks.com/topic/152949-string-comparisonhelp-please/
Share on other sites

And the error is?

 

And it should be $_GET instead of $_Get. Also, strcmp() returns an integer. So you can't compare it to 90% (which will also spawn a syntax error I'm sure). And what's up with {no register} and {register}? Supposed to be comments?

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.