I followed the example today and found that there are many errors. In order to let the rookie brothers understand it better, I will show you the modified file.
The data structure is as follows:
CREATE TABLE ad (
url varchar(100) NOT NULL,
banner varchar(150) NOT NULL,
alt varchar(100),
priority int(4) DEFAULT '1' NOT NULL,
)
File to add advertisements
******************putad.php** ******************
if($submit){
// PHP program that processes form data; The image banner name and link address cannot be empty;
if (( banner!="") & ( url!="")) {
//If the advertising link and image name have been used, they must be selected separately;
if (file_exists("adbanner/". $banner_name)) {
echo "Ad image. banner_name. has been used, please choose another one!"";
exit;
};
//Upload the link image file name to the adbanner directory;
copy($banner,"adbanner/". $banner_name);
//Connect to MySQL Database;
include("config.inc");
//Insert new data from the form into the data table ad;
$query="insert into ad (url, alt, priority, banner ) values('$url','$alt','$priority','$banner_name')";
//If the insertion is successful, the following information will be displayed;
$try=mysql_query($query);
if($try){
echo "An advertisement has been added, detailed information: ";
echo "";
echo "Advertising URL: $url
Advertising link description: $alt
Display weighting: $priority ";
}else{echo "Error";}
}else{
?>
< head>