I am trying to fetch some record as below, but can't proceed. My code is below Please help to get this corrected. Here, have a variable $evaid against which I want to fetch a record from DB, but can't add this to query whoever, without adding "where" it's giving me data.
After getting data I am not able to run last part of this code If else Statement while it's directly giving the last msg as "Contact WebAdmin As Nothing Is Found !!!". I know, I did something wrong with this code, but need some help because I can't trace it out. :(
<?php
$evaid = "' + response[0].EvaluationId + '";
echo $evaid;
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '123456';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn ) {
die('Could not connect: ' . mysql_error());
}
$sql = 'SELECT * FROM eval Where evaid=$evaid';
mysql_select_db('ops');
$retval = mysql_query( $sql, $conn );
if(! $retval ) {
die('Could not get data: ' . mysql_error());
}
while($row = mysql_fetch_array($retval, MYSQL_ASSOC)) {
echo "Eva ID :{$row['evaid']} <br> ".
"Division: {$row['division']} <br> ".
"Sub Type: {$row['evastype']} <br> ".
"--------------------------------<br>";
}
if ($row['division'] === "666" && $row['evaid'] === $evaid) {
print '666';
}
elseif($row['division']==="11" || $row['division']==="22" || $row['division']==="33" && $row['evaid'] === $evaid) {
print '112222';
}
elseif($row['division']==="cc22cc" && $row['evastype']==="dd22dd" && $row['evaid'] === $evaid) {
print 'cd123';
}
elseif($row['division']==="cc22cc" && $row['evastype']==="po1122" && $row['evaid'] === $evaid) {
print 'c9o123';
}
elseif($row['division']==="cc22cc" && $row['evastype']==="dgd11" && $row['evaid'] === $evaid) {
print 'cdgn666 ';
}
else {
print '<p style="border:2px solid MediumSeaGreen;"> Contact WebAdmin As Nothing Is Found !!! </p> ';
}
mysql_close($conn);
?>