Jump to content

PHP scripts in 1.....


deesse

Recommended Posts

Hi All,

 

I am a newbie in php...plzzzzzzzzzzz your help is needed.

I have 5 different php codes. How can I combine/link all into one php command to execute ?

The scripts help to connect to the MySQL database and download the contents through the URL.

 

It goes like this:

IF I have: 

- A.php to configure

- B.php to create tables

- C.php to clean data

- D.php to command

- E.php to start

 

I would like to create a very simple interface where the user can only click on a single button (for instance DOWNLOAD.php) so that all the command can be executed at once? Instead of the user going through every single php script to modify the contents.

 

How to proceed with this ? any sample example out there to illustrate this?

 

hope to get your comments soon...

thanks in advance!

Link to comment
Share on other sites

thanks for the reply....

 

I am trying to include some of the scripts, hopefully it works.

 

By the way, is there any php scripts example there that help like once one is connected to database (MySQL), it can prompt user to enter the database name and get feedback that the name has been created?

 

And also connect directly to a URL through a command procedure?

please help...

thanks thanks...

Link to comment
Share on other sites

Hi All,

 

I have this php script running fine but when it comes to creating tables it only creates the first table instead of 4.... why?

am I missing something here????

help is appreciated.-.-.-.-

 

 
<?php
$link = mysql_connect('localhost', 'username', 'password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}

$sql = 'CREATE DATABASE test2';
if (mysql_query($sql, $link)) {
echo "Database test2 created successfully\n";
} else {
echo 'Error creating database: ' . mysql_error() . "\n";
}
// Create tables in test2 database

mysql_select_db("test2", $link);

$sql = "CREATE TABLE car (
title varchar(255) NOT NULL,
description varchar(255) NOT NULL,
priority tinyint(2) NOT NULL default '0'
) TYPE=InnoDB\n";

mysql_query($sql, $link);
if (mysql_error()) echo __line__.") Error creating table: ".mysql_error();

//Create links table
$sql = "CREATE TABLE links (
type varchar(20) NOT NULL default '',
resource varchar(255) NOT NULL,
) TYPE=InnoDB\n";

mysql_query($sql, $link);
if (mysql_error()) echo __line__.") Error creating table: ".mysql_error();

//Create home table
$sql = "CREATE TABLE home (
name varchar(255) NOT NULL,
title varchar(255) NOT NULL default '',
description varchar(255) NOT NULL default '',
) TYPE=InnoDB\n";

mysql_query($sql, $link);
if (mysql_error()) echo __line__.") Error creating table: ".mysql_error();

//Create people table
$sql = "CREATE TABLE people (
name varchar(20) NOT NULL default '',
address varchar(255) NOT NULL
resource varchar(255) NOT NULL,

) TYPE=InnoDB\n";

echo "car,home,links, & people tables in the relational database (".test2.") have been successfully created!\n";
mysql_query($sql, $link);
if (mysql_error()) echo __line__.") Error creating table: ".mysql_error();
mysql_close($link);//Close connection
?> 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.