Jump to content

nong

New Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by nong

  1. <?php

    $servername = "localhost";

    $username = "root";

    $password = "";

     

    try {

        $conn = new PDO("mysql:host=$localhost;dbname=userdata", $root, $'');

        // set the PDO error mode to exception

        $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

        $sql = "CREATE DATABASE myDBPDO";

        // use exec() because no results are returned

        $conn->exec($sql);

        echo "Database created successfully<br>";

        }

    catch(PDOException $e)

        {

        echo $sql . "<br>" . $e->getMessage();

        }

     

    $conn = null;

    foreach($con->query($sql) as $row)

    {

    ?>

    //html mixed with embedded PHP code goes here: please example code

    //where you need to grab something from the database to fill in the blanks use:  please example code

    //<?php echo $row['image_url']; ?>    etc etc     please example code

    }

    thank you

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.