G:
/
PleskVhosts
/
seeonsoft.com
/
hp.thefalconunited.com
/
up file
home
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> </head> <body> <?php include('config.php'); $sno =1; $result = $js->query('SELECT * FROM `subheads` ORDER BY `id`'); echo $count = $result->rowCount(); if($count == '0') { $sno = 'SUBMI001'; } else { while($row = $result->fetch(PDO::FETCH_ASSOC)) { $nw = $row['subid']; } $i = substr($nw,5); if($i != 0) { $sno = $i + 1; } if($i == 0 && $sno <10) { $sno = 'SUBMI00'.$sno; } if($i > 0 && $sno <10) { $sno = 'SUBMI00'.$sno; } if($sno >= 10 && $sno <100) { $sno = 'SUBMI0'.$sno; } if($sno >= 100 && $sno <1000) { $sno = 'SUBMI'.$sno; } if($sno >= 1000) { $sno = 'SUBMI'.$sno; } else { $sno = $sno; } } $headname = $_POST['head']; $subh = $_POST['subname']; $sql = 'INSERT INTO `subheads` (`subid`, `head`, `subname`) VALUES (:sno, :headname, :subh)'; $query = $js->prepare($sql); $status = $query->execute(array(':sno' => $sno, ':headname' => $headname, ':subh' => $subh)); if ($status) { $f = 1; } else { die('Error: ' . mysql_error()); print_r($js->errorInfo()); } if($f == 1) { ?> <script type="text/javascript"> alert("Have successfully added the subhead"); window.location = 'heads.php'</script> <?php } ?> </body> </html>