Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Write a PHP script that obtains a URL and its description from a user and stores the information into a database using MySQL. Create and run a SQL script with a 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 con- tents 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 thats provided with this chapters examples in the dbscripts folder.]

Submit all files and also have a word document which contains screen shots of working webpages ( include queries and results) from localhost or your ip address.

The scripts of database for this chapter are attached here.

Please create a user account as the video in course materials to connect mySQL. We should use:

username: iw3htp

password: password

Starting PHP 7, mysql_connect is no longer used. It is replaced by mysqli.

In our homework, the conversion from mysql to mysqli is straightforward.

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 );

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions