Jump to content

Why save database ownly one field.


faces3
Go to solution Solved by faces3,

Recommended Posts

<html>
<head>
<title>Uue firma loomine</title>
<meta name="description" content="Uue firma loomine">
<meta name="author" content="uus">

</head>
<body>
	 <form action= "" method="post">
<H2>Firma:</h2>
Firma nimi: 
 <input type="text" name = "fnimi" size="30" /></br>
Firma registrikood:  
<input type="text" name = "reg" size="30" /></br>
Telefoni number:  
<input type="text" name = "ftel" size="30" /></br>
Emaili aadress:  
<input type="text" name = "femail" size="30" /></br>
Koduleht:  
<input type="text" name = "www" size="30" /></br>
<H2>Admin:</H2>
Ees- ja perekonnanimi:  
<input type="text" name = "animi" size="30" /></br>
Telefoni numer:  
<input type="text" name = "atel" size="30" /></br>
Emaili aadress:  
<input type="text" name = "aemail" size="30" /></br>
Kasutajanimi:  
<input type="text" name = "akas" size="30" /></br>
Parool:  
<input type="text" name = "apwd" size="30" /></br>
<H2>Raamatupidaja:</H2>
Ees- ja perekonnanimi:  
<input type="text" name = "rnimi" size="30" /></br>
Telefoni numer:  
<input type="text" name = "rtel" size="30" /></br>
Emaili aadress: 
 <input type="text" name = "remail" size="30" /></br>
Kasutajanimi:  
<input type="text" name = "rkas" size="30" /></br>
Parool:  
<input type="text" name = "rpwd" size="30" /></br>
<h2>Töödejuhataja</h2>
Ees- ja perekonnanimi:  
<input type="text" name = "jnimi" size="30" /></br>
Telefoni numer: 
 <input type="text" name = "jtel" size="30" /></br>
Emaili aadress:  
<input type="text" name = "jemail" size="30" /></br>
Kasutajanimi: 
 <input type="text" name = "jkas" size="30" /></br>
Parool:  
<input type="text" name = "jpwd" size="30" /></br>
<h2>Tööline</h2>
Ees- ja perekonnanimi: 
 <input type="text" name = "jnimi" size="30" /></br>
Telefoni numer: 
 <input type="text" name = "jtel" size="30" /></br>
Emaili aadress:  
<input type="text" name = "jemail" size="30" /></br>
Kasutajanimi:  
<input type="text" name = "jkas" size="30" /></br>
Parool:  
<input type="text" name = "jpwd" size="30" /></br>
<h2>Uldine</h2>
Sisselogimis aadress:
 <input type="text" name = "sub" size="30" /></br>
     <input type="submit" value="Add" />
     </form>
</body>
</html>

<?php

// Firma andmed
$fnimi = $_REQUEST['fnimi'];
$reg = $_REQUEST['reg'];
$ftel = $_REQUEST['ftel'];
$femail = $_REQUEST['femail'];
$www = $_REQUEST['www'];
// Aladomeen/andmebaas/kaust
$sub = $_REQUEST['sub'];
// MySQL uhendus
$user="root";
$password="";
$database="firma";
$con="localhost";
mysql_connect($con,$user,$password);
@mysql_select_db($database) or die( "Unable to select database");
mysql_query("CREATE TABLE $sub(id int(6) NOT NULL auto_increment,firma_nimi varchar(50) NOT NULL,firma_reg varchar(50) NOT NULL,firma_telefon varchar(50) NOT NULL,firma_email varchar(50) NOT NULL,firma_www varchar(50) NOT NULL,PRIMARY KEY (id),UNIQUE id (id),KEY id_2 (id))"); 
mysql_query("INSERT INTO $sub(firma_nimi, firma_reg, firma_telefon, firma_email, firma_www) VALUES ('$fnimi', 'reg', '$ftel', '$femail', '$fwww')");
mysql_close();
?>

<?php
	 $folder = $_REQUEST['sub'];
if(is_dir($folder))
echo "See kataloog on juba olemas!";
else
{
$zip = new ZipArchive;
     $res = $zip->open('w.zip');
     if ($res === TRUE) {
         $zip->extractTo($folder);
         $zip->close();
       
     }
     }
?>

	 <?php 
 $con=mysqli_connect("localhost","root",""); 
 // Check connection 
 if (mysqli_connect_errno()) 
   { 
   echo "Failed to connect to MySQL: " . mysqli_connect_error(); 
   } 

 // Create database   
 if(isset($_POST['sub'])){ 
$andmebaas = $_POST['sub'];  
 $sql="CREATE DATABASE $andmebaas";   
 if (mysqli_query($con,$sql))   
  {   
  echo "Database my_db created successfully";   
  }   
else   
  {   
  echo "Error creating database: " . mysqli_error($con);   
  }   
  } 	 
?>
<?php
ini_set('error_reporting', E_ALL);
// Firma andmed
$fnimi = $_REQUEST['fnimi']; 
$reg = $_REQUEST['reg']; 
$ftel = $_REQUEST['ftel']; 
$femail = $_REQUEST['femail'];
$www = $_REQUEST['www'];

// MySQL uhendus
$user="root";
$password="";
if ( isset($_REQUEST['sub']) ) {
$database = $_REQUEST['sub']; }
$con="localhost";
mysql_connect($con,$user,$password);
@mysql_select_db($database) or die( "Unable to select database");
// Firma tabeli tegemine
mysql_query("CREATE TABLE firma(id int(6) NOT NULL auto_increment,firma_nimi varchar(50) NOT NULL,firma_reg varchar(50) NOT NULL,firma_telefon varchar(50) NOT NULL,firma_email varchar(50) NOT NULL,firma_www varchar(50) NOT NULL,PRIMARY KEY (id),UNIQUE id (id),KEY id_2 (id))"); 

// Firma andmete sisestamine
mysql_query("INSERT INTO firma(firma_nimi, firma_reg, firma_telefon, firma_email, firma_www) VALUES ('$fnimi', '$reg', '$ftel', '$femail', '$fwww')");
mysql_close();
?>
<?php
ini_set('error_reporting', E_ALL);
// Admini andmed
$animi = $_REQUEST['animi'];
$atel = $_REQUEST['atel'];
$aemail = $_REQUEST['aemail'];
$akas = $_REQUEST['akas'];
$apwd = $_REQUEST['apwd'];

// MySQL uhendus
$user="root";
$password="";
if ( isset($_REQUEST['sub']) ) {
$database = $_REQUEST['sub']; }
$con="localhost";
mysql_connect($con,$user,$password);
@mysql_select_db($database) or die( "Unable to select database");

// Admin tabeli tegemine
mysql_query("CREATE TABLE admin(id int(6) NOT NULL auto_increment,nimi varchar(50) NOT NULL,telefon varchar(50) NOT NULL,email varchar(50) NOT NULL,kasutaja varchar(50) NOT NULL,parool varchar(50) NOT NULL,PRIMARY KEY (id),UNIQUE id (id),KEY id_2 (id))"); 
// Admin andmete sisestamine
mysql_query("INSERT INTO admin(admin_nimi, admin_telefon, admin_email, admin_kasutaja, admin_parool) VALUES ('$animi', '$atel', '$aemail', '$akas', '$apwd')");
mysql_close();
?>
<?php
ini_set('error_reporting', E_ALL);
// Raamatupidaja andmed
$animi = $_REQUEST['rnimi'];
$atel = $_REQUEST['rtel'];
$aemail = $_REQUEST['remail'];
$akas = $_REQUEST['rkas'];
$apwd = $_REQUEST['rpwd'];
// MySQL uhendus
$user="root";
$password="";
if ( isset($_REQUEST['sub']) ) {
$database = $_REQUEST['sub']; }
$con="localhost";
mysql_connect($con,$user,$password);
@mysql_select_db($database) or die( "Unable to select database");

// Raamatupidaja andmete sisestamine
mysql_query("INSERT INTO admin(raamatupidaja_nimi, raamatupidaja_telefon, raamatupidaja_email, raamatupidaja_kasutaja, raamatupidaja_parool) VALUES ('$rnimi', '$rtel', '$remail', '$rkas', '$rpwd')");
mysql_close();
?>
<?php
ini_set('error_reporting', E_ALL);
// Töödejuhataja andmed
$animi = $_REQUEST['jnimi'];
$atel = $_REQUEST['jtel'];
$aemail = $_REQUEST['jemail'];
$akas = $_REQUEST['jkas'];
$apwd = $_REQUEST['jpwd'];
// MySQL uhendus
$user="root";
$password="";
if ( isset($_REQUEST['sub']) ) {
$database = $_REQUEST['sub']; }
$con="localhost";
mysql_connect($con,$user,$password);
@mysql_select_db($database) or die( "Unable to select database");

// Juhataja tabeli tegemine
mysql_query("CREATE TABLE juhataja(id int(6) NOT NULL auto_increment,nimi varchar(50) NOT NULL,telefon varchar(50) NOT NULL,email varchar(50) NOT NULL,kasutaja varchar(50) NOT NULL,parool varchar(50) NOT NULL,PRIMARY KEY (id),UNIQUE id (id),KEY id_2 (id))"); 
// Juhataja andmete sisestamine
mysql_query("INSERT INTO juhataja(juhataja_nimi, juhataja_telefon, juhataja_email, juhataja_kasutaja, juhataja_parool) VALUES ('$jnimi', '$jtel', '$jemail', '$jkas', '$jpwd')");
mysql_close();
?>
<?php
ini_set('error_reporting', E_ALL);
// Töölise andmed
$animi = $_REQUEST['tnimi'];
$atel = $_REQUEST['ttel'];
$aemail = $_REQUEST['temail'];
$akas = $_REQUEST['tkas'];
$apwd = $_REQUEST['tpwd'];
// MySQL uhendus
$user="root";
$password="";
if ( isset($_REQUEST['sub']) ) {
$database = $_REQUEST['sub']; }
$con="localhost";
mysql_connect($con,$user,$password);
@mysql_select_db($database) or die( "Unable to select database");

// Töölise tabeli tegemine
mysql_query("CREATE TABLE tooline(id int(6) NOT NULL auto_increment,nimi varchar(50) NOT NULL,telefon varchar(50) NOT NULL,email varchar(50) NOT NULL,kasutaja varchar(50) NOT NULL,parool varchar(50) NOT NULL,PRIMARY KEY (id),UNIQUE id (id),KEY id_2 (id))"); 
// Töölise andmete sisestamine
mysql_query("INSERT INTO tooline(toolise_nimi, toolise_telefon, toolise_email, toolise_kasutaja, toolise_parool) VALUES ('$tnimi', '$ttel', '$temail', '$tkas', '$tpwd')");
mysql_close();
?>

In that script add only database:

// Firma andmete sisestamine
mysql_query("INSERT INTO firma(firma_nimi, firma_reg, firma_telefon, firma_email, firma_www) VALUES ('$fnimi', '$reg', '$ftel', '$femail', '$fwww')");
mysql_close();
?>

How fix it?

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.