nitesh Posted February 2, 2012 Share Posted February 2, 2012 Hi everybody iam trying to insert the last MAX value plus 1 value for example if my last value in database is 6 then it will insert 7 if 8 then 9 below is my code(Iam using MAX function)when i echo value before using in INSERT query (with SELECT statement) it's working fine but when i use $arrData variable in INSERT query it's showing blank value pls help.BELOW is my code $query = "SELECT MAX(position) + 1 AS 'position' FROM pages"; $rsQuery = dbQuery($query); $arrData = dbFetchRow($rsQuery); echo $arrData[0]; $qryInsert = "INSERT INTO pages (PageHeading,PageName,Content,position,Status) VALUES ('$pName','$pHeading','$pContent',$arrData,'$status')"; $rsQuery = dbQuery($qryInsert); Link to comment Share on other sites More sharing options...
justsomeguy Posted February 2, 2012 Share Posted February 2, 2012 $arrData is an array, not a number. You're printing $arrData[0], that's the value you need to use in the query. Link to comment Share on other sites More sharing options...
nitesh Posted February 3, 2012 Author Share Posted February 3, 2012 Thank you problem solved. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.