Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>class & method exist</title>
- <link rel="stylesheet" href="/css/master.css">
- <style media="screen">
- *{margin: 0;padding: 0;}
- body{background-color: gray;}
- .header
- {
- width: 960px;
- height: 50px;
- background: green;
- margin: 20px auto;
- border: 2px solid white;
- border-radius: 10px;
- }
- .header h2
- {
- color: white;
- margin-left: 200px;
- padding: 8px;
- font-family: arial;
- }
- .main
- {
- width: 960px;
- background: green;
- margin: 10px auto;
- border: 1px solid white;
- border-radius: 20px;
- overflow: hidden;
- }
- .main .code
- {
- margin: 10px 20px;
- color: white;
- font-weight: bold;
- font-size: 20px;
- font-family: verdana;
- overflow: hidden;
- }
- .footer
- {
- width: 960px;
- height: 50px;
- background: green;
- margin: 10px auto;
- border: 2px solid white;
- border-radius: 10px;
- }
- .footer h2
- {
- color: white;
- margin-left: 250px;
- padding: 8px;
- font-family: arial;
- }
- </style>
- </head>
- <body>
- <div class="header">
- <h2>work with PDO:</h2>
- </div>
- <div class="main">
- <div class="code">
- <p>pdo_insert values:(with bind values)</p>
- <br>
- <?php
- $dsn = "mysql:dbname=test;host=localhost";
- $user = "root";
- $password = "";
- try {
- $db = new PDO( $dsn, $user, $password ); //pdo is used to connect any database engine;
- echo "database is updated successfully";
- } catch (PDOException $e) {
- echo "somthing error with database....".$e->getMessage();
- }
- $name = "s";
- $skill = "c,c++,python";
- $insert = "insert into info(name,skill) values( :name, :skill )";
- $prepare = $db->prepare($insert);
- $prepare->bindvalue( ':name', "x" ); //bindvalue can pass both variable & value;
- $prepare->bindvalue( ':skill', "c#,python");
- $prepare->execute();
- ?>
- </div>
- </div>
- <div class="footer">
- <h2>© the hompage is created by <i>Riju</i></h2>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement