hi all..
i am newbie in php-mysql. i have doubt to access the max id using php.
here is the problem.
member table
---------------
id auto_increment
name varchar(50);
-------
accessing data through html form, then dumping to mysql working nicely.but when accesing LAST DATA from mysql through browser using php code shows nothing.
[code=php]
<?php
mysql_connect(" localhost","roo t","") or die (mysql_error()) ;
$dblink = mysql_select_db ("test") or die (mysql_error()) ;
$res = mysql_query("se lect max(id) from members",$dblin k);
$maxid = mysql_result($r es,0,"MAX(id)") ;
$result=mysql_q uery("select * from members where id=$maxid");
$row = mysql_fetch_arr ay($result, MYSQL_ASSOC);
echo "ID : {$row['id']} , ". "Name : {$row['name']} <br>";
mysql_close($db link);
?>
[/code]
please help me
thanks in advance
i am newbie in php-mysql. i have doubt to access the max id using php.
here is the problem.
member table
---------------
id auto_increment
name varchar(50);
-------
accessing data through html form, then dumping to mysql working nicely.but when accesing LAST DATA from mysql through browser using php code shows nothing.
[code=php]
<?php
mysql_connect(" localhost","roo t","") or die (mysql_error()) ;
$dblink = mysql_select_db ("test") or die (mysql_error()) ;
$res = mysql_query("se lect max(id) from members",$dblin k);
$maxid = mysql_result($r es,0,"MAX(id)") ;
$result=mysql_q uery("select * from members where id=$maxid");
$row = mysql_fetch_arr ay($result, MYSQL_ASSOC);
echo "ID : {$row['id']} , ". "Name : {$row['name']} <br>";
mysql_close($db link);
?>
[/code]
please help me
thanks in advance
Comment