Question: Write a PHP script that obtains a URL and its description from user and stores the information into a database using MySQL. Create and run

Write a PHP script that obtains a URL and its description from user and stores the information into a database using MySQL. Create and run a SQL script with database named URL and a table named Urltable. The first field of the table should contain an actual URL, and the second, which is named Description, should contain a description of the URL. Use www.deitel.com as the first URL, and input Cool site! as its description. The second URL should be www.php.net, and the description should be The Official PHP site. After each new URL is submitted, print the contents of the database in a table. [Note: Follow the instructions in Section 18.5.2 to create the Url database by using the URLs.sql script that's provided with this chapter's examples in the dbscripts folder.]

MY PHP CODE IS GIVING ME PROBLEMS!!!! PLEASE HELP!!!!

Urlinfo.php

if ( !( $database = mysqli_connect( "localhost", "iw3htp", "password" ) ) ) die( "

Could not connect to database

" ); if ( !mysqli_select_db( $database, "URLs") ) die( "

Could not open URL database

" );

if ( !( $result = mysqli_query( $database, $query) ) ) { print( "

Could not execute query!

" ); die( mysqli_error() ); }

while ( $row = mysqli_fetch_row( $result ) ) print( "" . $row[ 0 ] . "" . $row[ 1 ] . "" ); mysqli_close( $database ); ?>

urlentry.html

Enter your URL name and discription here:


URL: Description:

urls.sql

DROP DATABASE IF EXISTS URLs;

CREATE DATABASE URLs;

USE URLs;

CREATE TABLE urltable ( ID int NOT NULL AUTO_INCREMENT PRIMARY KEY, URL varchar(128), description varchar(255) );

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!