need help with php

helo there, i need some help

this is the code (check if specific record exists), there is no problem
[php]
global $conn;
$strSQLExists = “select * from klas where name=’”.$values[“name”]."’";
$rsExists = db_query($strSQLExists,$conn);
$data=db_fetch_array($rsExists);
if($data)
{
// if the record exists
$message="

<<< “.“Database NOT updated …The name entered already exists…Use another name”.” >>>
";
return false;
}
else
{

return true;
}

//but error is with this code
$strSQLExists = “select * from klas where name, nis=’”.$values[“name”]."’",’".$values[“nis”]."’";
[/php]

thanx for your help

// moderator note: please use the php bbcode.

you’ve got to many double quotes in there and the format is wrong

[php]$strSQLExists = “SELECT * FROM klas WHERE name = ‘$values[name]’ AND nis = ‘$values[nis]’”;[/php]

From Admin :
you’ve got to many double quotes in there and the format is wrong

PHP Code: [Select]
$strSQLExists = “SELECT * FROM klas WHERE name = ‘$values[name]’ AND nis = ‘$values[nis]’”;

// thank you for reply
but this code doesnt work, the nis still record after added

any other idea sir??

I don’t know what you’re trying to do. The reference code doesn’t have that nis bit. And if thats inside a function, then $values needs to be declared as a global also unless its being sent in the function call.

And dont start a new topic on the exact same thing.

Sponsor our Newsletter | Privacy Policy | Terms of Service