mercredi 20 août 2014

Get Maximum Value from the mysql database in Php PDO and add one to it


Vote count:

0




I want to fetch maximum value from column stud_id in Mysql database and add 1 to it


for eg: if i get stud_id as 10 as maximum value i should add 1 to it and put back the result 11 into the new stud_id for next record but im get an error as "Array to string conversion"



stud_id
------
2
4
8
10


my code is



require 'Db.class.php';

$pdo=new DB();

$studid=$pdo->query("SELECT max(stud_id) maxcount FROM t_notes");

$version = $studid+1;

echo "$version";



TJ-

1,950

asked 2 mins ago







Get Maximum Value from the mysql database in Php PDO and add one to it

Aucun commentaire:

Enregistrer un commentaire