2016-07-20 8 views
0

Ich habe eine Datenbanktabelle in eine .sql-Datei exportiert. Danach habe ich WAMP neu installiert, ich habe eine neue Datenbank erstellt und die Tabelle importiert.Mysql-Tabellenimport funktioniert nicht?

Die importierte Tabelle funktioniert nicht, welche Einstellungen in mysql sollte ich auf eine erfolgreiche Migration überprüfen?

dies der Code

if (isset($_POST['send']) ) 
{ 

$servername = "****"; 
$username = "****"; 
$password = "****"; 
$dbname = "****"; 

$conn = new mysqli($servername, $username, $password,  $dbname); 
if ($conn->connect_error) { die("Connection failed: " . $conn >connect_error);} 



$sql = "INSERT INTO $tabel (fname, lname, strnu, poco, place, pro_reg, country, email, tele, mobi, citizen, pport_id, birthday, cl_nr, sxmf) VALUES 
        ('$fname' , '$lname' , '$strnu' , '$poco' , '$place' , '$pro_reg' , '$country' , '$email' , '$tele' , '$mobi' , '$citizen' , '$pport_id' , '$birthday' , '$cl_nr' , '$sxmf')" ; 
         if ($conn->query($sql) === TRUE) 

          { echo' Thank you for completing this form'; 
           var_dump($fname);        

          } else { 

          echo "Error: " . $sql ; 
          $conn->error; 

          } 

$hi_val = mysqli_insert_id($conn);      
// data fetch 
$sql2 = "SELECT id, fname, lname, strnu, poco, place, pro_reg, country, email, tele, mobi, citizen, pport_id, birthday, cl_nr, sxmf FROM $tabel WHERE id = $hi_val"; 
$result = $conn->query($sql2); 


// output data of each row 
while($row = $result->fetch_assoc()) { 

    //var_dump($hi_val); 

    // echo 'id: ' . $row["id"]; 


    $fname = $row["fname"]; 
    // etc 
} 
} 

und hier ist die Tabelle I:

-- phpMyAdmin SQL Dump 
-- version 4.5.5.1 
-- http://www.phpmyadmin.net 
-- 
-- Host: 127.0.0.1 
-- Generated: 19 jul 2016 at 07:42 
-- Server version: 5.7.11 
-- PHP-version: 5.6.19 

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 
SET time_zone = "+00:00"; 


/*!40101 SET @[email protected]@CHARACTER_SET_CLIENT */; 
/*!40101 SET @[email protected]@CHARACTER_SET_RESULTS */; 
/*!40101 SET @[email protected]@COLLATION_CONNECTION */; 
/*!40101 SET NAMES utf8mb4 */; 

-- 
-- Database: `dbase_name` 
-- 

    -- -------------------------------------------------------- 

-- 
-- Tabelstructure for table `user` 
-- 

CREATE TABLE `user` (
`fname` text NOT NULL, 
`lname` text NOT NULL, 
`strnu` varchar(45) NOT NULL, 
`poco` varchar(15) NOT NULL, 
`place` text NOT NULL, 
`pro_reg` varchar(30) NOT NULL, 
`country` text NOT NULL, 
`email` varchar(40) NOT NULL, 
`tele` varchar(20) NOT NULL, 
`mobi` varchar(20) NOT NULL, 
`citizen` text NOT NULL, 
`pport_id` varchar(25) NOT NULL, 
`birthday` varchar(15) NOT NULL, 
`id` tinyint(3) NOT NULL, 
`cl_num` varchar(25) NOT NULL, 
`sxmf` text NOT NULL 
) ENGINE=InnoDB DEFAULT CHARSET=utf8; 

-- 
-- Index exported tables 
-- 

-- 
-- Index for table `user` 
-- 
ALTER TABLE `user` 
ADD PRIMARY KEY (`id`); 

-- 
-- AUTO_INCREMENT exported table 
-- 

-- 
-- AUTO_INCREMENT table `user` 
-- 
ALTER TABLE `user` 
MODIFY `id` tinyint(3) NOT NULL AUTO_INCREMENT; 
/*!40101 SET [email protected]_CHARACTER_SET_CLIENT */; 
/*!40101 SET [email protected]_CHARACTER_SET_RESULTS */; 
/*!40101 SET [email protected]_COLLATION_CONNECTION */; 

Antwort

1

Der Einsatz und select-Anweisungen verweisen

cl_nr 

die Namen

cl_num 

in der Tabelle

+0

Vielen Dank, das hat den Fehler behoben –

0

Ich würde mit der Überprüfung beginnen, dass Ihr Benutzername, Passwort und Tabellenname genau sind.

starten Sie MySQL in der Befehlszeile.

SELECT * FROM mysql.user; 

Passwort zurücksetzen

UPDATE mysql.user SET Password=PASSWORD('[password]') WHERE User='[username]'; 

Vergessen Sie nicht, Stop MySQL und starten Sie ihn neu und erinnern Ihrem neuen Benutzernamen zu starten.

Dies ist von this post

Achten Sie darauf, Ihre PHP-Datei diese aktualisierten Benutzernamen und Passwörter hat, und auch Ihre WAMP Server-Symbol nach dem Neustart sicher, grün ist.

Lassen Sie mich wissen, wie es geht und sonst den Tisch fallen und erneut hochladen. Viel Glück!