2014-12-06 69 views
0

我想註冊後用戶發送到有個人資料的網站註冊後,配置文件,但我沒有得到任何輸入文件 不知道我做錯了,但我開始在ELS語句會不知道這是寫有人可以幫助我也許重定向到使用PHP

<?php 
// set database connection 
require("dbconfig.php"); 


// lets get our posts // 

$email = $_POST['email']; 
$pass = $_POST['password']; 
$bn = $_POST['bandname']; 
$state = $_POST['state']; 
$genre = $_POST['genre']; 
$description = $_POST['description']; 
$image = $_FILES['image']; 

/// valid image types /// 

$image_type = array("image/jpg","image/jpeg","image/bmp","image/gif","image/png"); 


/// folder that will hold the image 

$imagepath = "images/"; 


$imagepath .= $image["name"]; 


// move the file from the tmp folder to the image folder 

if (move_uploaded_file($image['tmp_name'], $imagepath)){ 

$foo = `mogrify -quality 92 -scale 500x $imagepath`;  
} 



// insert data into mysql 

    $sql = "insert into dbusers (email, password, bandname, state, genre,   description , image) 

                           values ('$email','$pass','$bn ','$state','$genre','$description','".$image['name']  . "')"; 


if (!mysql_query($sql)){ 

die('ERROR' . mysql_error());  

     }else {  

     $id=mysqli_insert_id($sql); // Get the associated ID number 
          // Set up a login session 
    session_start(); 
    $_SESSION ['id'  ] = $id; 
    $_SESSION ['bandname' ] = $bandname; 
    $_SESSION ['password' ] = $password; 
    header ("Location:ympprofile.php?listid=$id"); 
}  
?> 
+0

插入行的ID檢查你的代碼中的其他部分執行,如果沒有,那麼請檢查您的MySQL查詢 – manuyd 2014-12-06 05:38:08

回答

0

您需要更改

header ("location:ympprofile.php?listid=$id"); 

header ("Location:ympprofile.php?listid=$id"); 

標頭函數的Location屬性被大寫。

0

首先,你需要得到像

$id=mysqli_insert_id($sql); 

then 

header ("location:ympprofile.php?listid=$id"); 
+0

我試過了,但仍然沒有我編輯上方,但仍代碼中沒有輸入文件 – 2014-12-07 17:37:41

+0

嘗試: - 別人(的mysql_query($的SQL)) ,如果這行不通過PLZ然後提意見的錯誤 – 2014-12-08 07:25:30