Php project

Okay hello I am trying to create a project for my advanced database course. I am trying to run like a online supplement store and I am having trouble with getting PHP admin to show my database. This is the table that I created and it wont show the data that I have entered in my insert value code.

{<?php

$host=“localhost”;
$username=“root”;
$password=“mysql”;

$db_name=“firstdb”;

mysql_connect("$host","$username","$password") or die(“Cannot connect”);
mysql_select_db("$db_name") or die(“Cannot select DB”);

mysql_query(“CREATE TABLE tstudents(id INT NOT NULL, PRIMARY KEY(id),fname VARCHAR(50),lname VARCHAR(50),credits DECIMAL(10,2))”);

?>

thanks for any help

First, stop using deprecated mysql_ functions. If this is being taught in your “Advanced” course, show your instructor the depreciation notice in the PHP Docs homepage. Have you tried creating the table in PHPmyAdmin?

My guess is this isn’t a php class, but a Coldfusion or something similar and that PHP is just an introduction to databases. At least I hope my guess is right. ;D Still, they should not be using depreciated mysql… :frowning:

Sponsor our Newsletter | Privacy Policy | Terms of Service