php - Not able to save data to a new table with composite primary key -


code

require_once 'detect/detect.php'; date_default_timezone_set('asia/kuala_lumpur');  $fb_id = $_post['id']; $full_name = $_post['name']; $first_name = $_post['first_name']; $last_name = $_post['last_name']; $email = $_post['email']; $date_time = date('y-m-d h:i:s'); $shared = null; $redeemed = null;  $connection = mysqli_connect("server", "username", "password", "db");  $sql = "insert ignore abc_cafe (fb_id, full_name, first_name, last_name, email, date_time, shared, redeemed) values ('$fb_id','$full_name','$first_name','$last_name','$email','$date_time','$shared','$redeemed')";  mysqli_close($connection); 

my table created no data. primary key (fb_id,date_time) not appearing in structure.

try mysqli_query() execute query.

try this.

$connection = mysqli_connect("server", "username", "password", "db"); $sql = "insert ignore abc_cafe (fb_id, full_name, first_name, last_name, email, date_time, shared, redeemed) values ('$fb_id','$full_name','$first_name','$last_name','$email','$date_time','$shared','$redeemed')"; mysqli_query($connection, $sql); mysqli_close($connection); 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -