Jump to content

mysql_compare


Garethp

Recommended Posts

I just built a class, thought this might be the place to share it. It compares a class to a mysql value. Here it is

 

mysql_compare($Table, $IDColumn, $ID, $CompareCol, $Value);

 

function mysql_compare($Table, $Columna, $ID, $Columnb, $Value)
{

$Error = 0;

$Query = mysql_query("SELECT * FROM `$Table` WHERE `$Columna`='$ID'");

if(mysql_num_rows($Query) > 1)
	{
	$Error = 1;
	$Errortext = "Identifier is not unique";
	}
else if(mysql_num_rows($Query) == 0)
	{
	$Error = 1;
	$Errortext = "Row does not exist";
	}
else
	{
	$Show = mysql_fetch_array($Query);
	$Compare = $Show["$Columnb"];

	if($Compare == $Value)
		{
		$Errortext = 1;
		}
	else
		{
		$Errortext = 0;
		}
	}

return ($Errortext);
}

Link to comment
https://forums.phpfreaks.com/topic/124473-mysql_compare/
Share on other sites

 

Description

string mysql_escape_string ( string $unescaped_string )

 

This function will escape the unescaped_string , so that it is safe to place it in a mysql_query(). This function is deprecated.

 

This function is identical to mysql_real_escape_string() except that mysql_real_escape_string() takes a connection handler and escapes the string according to the current character set. mysql_escape_string() does not take a connection argument and does not respect the current charset setting.

 

 

(Underlining by me)

Link to comment
https://forums.phpfreaks.com/topic/124473-mysql_compare/#findComment-644642
Share on other sites

What exactly does the last paragraph mean? I get that my version is depreciated.

 

Quick question, how do I update the PHP version on EasyPHP? Because if I can't, I need to find another way to host my own PHP server, and last time I tried I had no luck

Link to comment
https://forums.phpfreaks.com/topic/124473-mysql_compare/#findComment-644714
Share on other sites

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.