daily pastebin goal
53%
SHARE
TWEET

Untitled

a guest Feb 4th, 2016 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $title = "new post";
  2. $text = "new text";
  3.    
  4. $query = 'insert into posts (title, text) values ("$title" ,"$text")';
  5. //запрос будет иметь вид такой
  6. //insert into posts (title, text) values ("$title" ,"$text")
  7.    
  8. $query = "insert into posts (title, text) values ("$title" ,"$text")";
  9. //запрос будет иметь вид такой
  10. //insert into posts (title, text) values ("new post" ,"new text")
  11.    
  12. <?php
  13. $dataSource = 'mysql:dbname=server;host=localhost';
  14. $user = 'world';
  15. $password = '';
  16. $db = new PDO($dataSource, $user, $password);
  17. $db->exec("SET NAMES utf8");
  18. $db->exec("SELECT id, title, text, date FROM wNews ORDER BY bid ASC");
  19. $db->null;
  20. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top