错误列数与第1行的值计数不匹配?

时间:2015-12-23 10:01:26

标签: php mysqli

哪里是错误..... 列数与第1行的值计数不匹配

mysqli_select_db($conn, $data);
    $save = "INSERT INTO SONG_AS(ALBUM, CATEGORY, SUB_CATEGORY,
        SONG_NAME, ARTIST, ART_LINK, 
        YEAR, GENRE, SONG_LINK, POST_ON, 
        POST_BY, TOTAL_DOWNLOAD) 
            VALUES('$albm', '$cat', '$scat', "
            . "'$sn', '$art', '$img', "
            . "'$y', '$g', "
            . "'$sl', '$time', '', '0')";


    $success = mysqli_query($conn, $save) or die(mysqli_error($conn));
    $page = "index.php";
    $this->pageRedirect($page);

哪里是错误..... 列数与第1行的值计数不匹配

3 个答案:

答案 0 :(得分:1)

删除''从您的查询:

$save = "INSERT INTO SONG_AS(ALBUM, CATEGORY, SUB_CATEGORY,
        SONG_NAME, ARTIST, ART_LINK, 
        YEAR, GENRE, SONG_LINK, POST_ON, 
        POST_BY, TOTAL_DOWNLOAD) 
            VALUES('$albm', '$cat', '$scat','$sn', '$art', '$img', '$y', '$g', '$sl', '$time', '', '0')";

答案 1 :(得分:0)

试试这个:

public class ImageConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, string language)
    {
        string FileName = value as string;
        var file = Windows.Storage.KnownFolders.PicturesLibrary.GetFileAsync(FileName).AsTask().Result;
        var stream = file.OpenReadAsync().AsTask().Result;
        var bitmapImage = new BitmapImage();
        bitmapImage.SetSource(stream);
        return bitmapImage;
    }

    public object ConvertBack(object value, Type targetType, object parameter, string language)
    {
        throw new NotImplementedException();
    }
}

答案 2 :(得分:0)

 $query = "INSERT INTO employee VALUES ($empno','$lname','$fname','$init','$gender','$bdate','$dept','$position','$pay','$dayswork','$otrate','$othrs','$allow','$advancesance,'')";
    $msg = "New record saved!";
  }
  else {
    $query = "UPDATE employee SET empno=$empno','lname='$lname',fname='$fname',init= '$init',gender='$gender',bdate='$bdate',dept='$dept',position='$position',pay=$pay,dayswork=$dayswork,otrate=$otrate,othrs=$othrs,allow=$allow,advances=$advances,insurance=$insurance WHERE empno = $empno";
    $msg = "Record updated!";
  }