hi forum
i was working with odbc and used odbc_exec(). but when i used this in mysql this is not working i also used mysql_query() but this is not working too
here is the code

$q2="SELECT MAX(ser) AS mxid FROM (SELECT * FROM Table1 AS T2 where subject='".$cs. "')";
if(!($result = mysql_query($q2))){
echo "whoooooooooooooooooooooops";
}// or die();
$sr=mysql_result($result, "mxid");
echo "MAX IS ".$sr; 

you need to connect and select a DB with the above method

$conn = mysql_connect("localhost","username","password");

$conn = mysql_connect("localhost","username","password"); mysql_select_db("database",$conn); i have used that but problem is in query

there is an error message. You are ignoring it.

The problem is your SQL

$q2="SELECT MAX(ser) AS mxid FROM (SELECT * FROM Table1 where subject='".$cs. "')  AS T2";

this is your solution

This question has already been answered. Start a new discussion instead.