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
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) ); There are 3 Steps involved in it See step-by-step solutions with expert insights and AI powered tools for academic success Enter your URL name and discription here:
Step by Step Solution
Step: 1
Get Instant Access to Expert-Tailored Solutions
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started