Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $db = 'mysql:dbname=new_site_eaginfo; host=localhost; charset=utf8;';
- $user = 'root';
- $password = '';
- try {
- $PDO = new PDO($db, $user, $password);
- $PDO->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- } catch (PDOException $e) {
- echo 'Connection failed: ' . $e->getMessage();
- }
- function Error_Handling() {
- global $news_name, $news_short_desc, $news_full_desc, $news_category, $news_author ;
- $news_name = $_POST['news_name'];
- $news_short_desc = $_POST['news_short_desc'];
- $news_full_desc = $_POST['news_full_desc'];
- $news_category = $_POST['news_category'];
- $news_author = $_POST['news_author'];
- } //Error_Handling()
- Error_Handling();
- class User
- {
- public $news_name;
- function __construct($news_name)
- {
- $this->SmallText = $news_name;
- if(mb_strlen($news_name) !=0) {
- $query = "INSERT INTO table_news_section (news_name) VALUES (:fnews_name) ";
- $addData = $PDO->prepare($query);
- $addData -> bindParam('fnews_name', $this->SmallText = $news_name);
- if($addData -> execute()) {
- echo 'Upload Done !';
- }
- }
- }
- function getInfo()
- {
- echo "სახელი: $this->SmallText <br>";
- }
- }
- $user2 = new User($news_name);
- $user2->getInfo();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement