Issue with a query in my PHP code

Please I havr this query:

$yr1_1st = mysql_query("SELECT * FROM trans_general WHERE semester = '".$semester."' AND session = yearofadmission + '".$level."' AND regno = '".$mdata."'", $connection);

:mad: and it returns no value but when I used it in mysql sql editor:

SELECT *
FROM trans_general
WHERE semester =  'first'
AND SESSION = yearofadmission +1
AND regno =  'ESUT/2007/85506'
LIMIT 0 , 30

:slight_smile: it worked perfectly so what am I doing wrong pls.

Thanks

First off, you’re using the old MySQL library. This is forever deprecated and will probably be removed in the future. Like a lot of people tell me, “If you’re using a book then that book is outdated and you should just throw it away and buy a new one on either MySQLi or PDO.”

Second off, why are you adding a +1 for the value of yearofadmission? Shouldn’t that be in a date time format or at least in a year format?