Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class sql {
- function __construct() {
- $host="localhost";
- $user="k963767g_sql";
- $pass="hackerman951";
- $db_name="k963767g_sql";
- $link=mysql_connect($host,$user,$pass);
- mysql_select_db($db_name,$link);
- }
- function write($date, $author, $author_url, $author_image, $post_url, $text, $image, $price, $headline, $post_image)
- {
- $sql = mysql_query("INSERT INTO `Base`(`date`, `author`, `author_url`, `author_image`, `post_url`, `text`, `image`, `price`, `headline`, `post_image`) VALUES ('".$date."','".$author."','".$author_url."','".$author_image."','".$post_url."','".$text."','".$image."','".$price."','".$headline."','".$post_image."')");
- }
- function get_user_login_and_passwrd()
- {
- $sql = mysql_query("SELECT * FROM `login`") or die("Base error");
- $row = mysql_fetch_array($sql);
- return array($row['login'], $row['password']);
- }
- function get_url()
- {
- $sql = mysql_query("SELECT * FROM `URL`") or die("Base error");
- $list_url = array();
- while($row = mysql_fetch_array($sql))
- {
- array_push($list_url, $row['URL']);
- }
- return $list_url;
- }
- }
- $class = new sql();
- $class->write("2019-02-05", "Name_author", "https://vk.com/autor_url", "https://vk.com/image_autor", "https://vk.com/wall_123", "We sell a house with a discount", "IMAGE", "566", "HEADLINE", "imAGE_pOST");
- $a = $class->get_url();
- echo $a[0];
- $a = $class->get_user_login_and_passwrd();
- echo $a[0]; //Login
- echo $a[1]; //Password
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement