Page 359 - CITS - CSA - TP (Volume 1) - Hindi
P. 359

कंप्यूटर सॉफ्टवेयर एप्लीकेशन- CITS




                          <html >
                 <head>
                      <title> create a table </title>
                 </head>
                 <body>
                    <?php

                        // Database connection parameters
                       $servername = “localhost”;  // Change this if  MySQL server is on a different host
                       $username = “your_username”; // Change this to your MySQL username
                       $password = “your_password”; // Change this to your MySQL password
                       $database = “example_db”;    // Change this to your database name

                       // Create connection
                       $conn = new mysqli($servername, $username, $password, $database);
                                // Check connection
                    if ($conn->connect_error) {
                       die(“Connection failed: “ . $conn->connect_error);
                       }
                   // sql to create table

                   $sql = “create table persons(
                   id int,  first_name varchar(30),    last_name varchar(30) ,   email varchar(70))”;
                   if ($conn->query($sql) === TRUE) {
                       echo “Table created successfully”;
                   } else {

                       echo “Error creating table: “ . $conn->error;
                   }
                   $conn->close();
                         ?>
                 </body>
                 </html>

              3   ो ाम को C:\Apache24\htdocs म  .php ए ट शन वाले फ़ो र म  सेव कर

              4  िवंडोज़ सिव स से अपाचे सिव स रन कराये
              5   ाउज़र ओपन करे और िन  एड ेस टाइप कर
                 http://localhost/foldername/
              6  रन कराने के  िलए php फ़ाइल पर   क कर  और आउटपुट वे रफाई कर t















                                                           343

                                     CITS : IT & ITES - कं  ूटर सॉ वेयर ए ीके शन - अ ास 61
   354   355   356   357   358   359   360   361   362   363   364