简体   繁体   中英

Strict standards: Only variables should be passed by reference in C:\wamp\www\Training session\con_user.php

I am trying to enter data in database with simple html form..thats why i coded controller for the form con_user.php but it is continuously giving an error which is "Strict standards: Only variables should be passed by reference in C:\\wamp\\www\\Training session\\con_user.php ". this is my con_user.php file in which this issue persists.Please find me a solution for this.

<?php
include("config.php");
extract($_POST);

$file_exts = array("jpg", "bmp", "jpeg", "gif", "png");
$upload_exts = end(explode(".", $_FILES["img"]["name"]));
if ((($_FILES["img"]["type"] == "image/gif")
|| ($_FILES["img"]["type"] == "image/jpeg")
|| ($_FILES["img"]["type"] == "image/png")
|| ($_FILES["img"]["type"] == "image/pjpeg"))
&& ($_FILES["img"]["size"] < 2000000)
&& in_array($upload_exts, $file_exts))
{
if ($_FILES["img"]["error"] > 0)
{
header("Location: user.php?err=imgpro1");
//echo "Return Code: " . $_FILES["img"]["error"] . "<br>";
}
else
{
$tempupname = time().$_FILES["img"]["name"];
$imgpathtostore="./uploads/".$tempupname;
// Enter your path to upload file here

move_uploaded_file($_FILES["img"]["tmp_name"], $imgpathtostore);
echo($imgpathtostore);
//$dt = DateTime::createFromFormat('m/d/Y', $bday);
$password = md5($pwd);
$confirmpassword = md5($cpwd);
$sql = "INSERT INTO ts.user (u_id, u_name, u_gen, u_email, u_password, u_confirmpwd, u_dob, u_hobby, u_desc, u_img) VALUES (NULL, '$fname', '$sex', '$email', '$password', '$confirmpassword' '".date('Y-m-d H:i:s', strtotime($bdate))."', '', '$desc', '$imgpathtostore');";

mysqli_query($con,$sql);

if(mysqli_errno($con))
{
//header("Location: user.php?msg=err");
echo "error";
}
else
{
//header("Location: user.php?msg=ok");
echo "success";
}

}
}
else
{
//header("Location: form-add-student.php?err=imgpro");
echo "image problem";
}
?>  

Put the following value,

date('Ymd H:i:s', strtotime($bdate))

Into a variable, and then use that variable in the INSERT query

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM