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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

The Structure Of The Relational Database Model

Authors: Jan Paredaens ,Paul De Bra ,Marc Gyssens ,Dirk Van Gucht

1st Edition

3642699588, 978-3642699580

More Books

Students also viewed these Databases questions

Question

2. Describe how technology can impact intercultural interaction.

Answered: 1 week ago