Jump to content

2 INSERT Queries


Xtremer360

Recommended Posts

The first query goes through but the second does not just seeing if I'm missing something.

 

<?php

// Include the database page
require ('../inc/dbconfig.php');

if (isset($_POST['submittitle'])) {
    $titlename = mysqli_real_escape_string($dbc, $_POST['titlename']);
    $titleshortname = mysqli_real_escape_string($dbc, $_POST['titleshortname']);
    $titlestyle = mysqli_real_escape_string($dbc, $_POST['titlestyle']);
    $titlestatus = mysqli_real_escape_string($dbc, $_POST['titlestatus']);

    $query = "INSERT INTO `titles` (titlename, titleshortname, style_id, status_id, creator_id, datecreated) VALUES ('$titlename','$titleshortname','$titlestyle','$titlestatus', 1, NOW())";
    mysqli_query($dbc, $query);
    $query_id = mysqli_insert_id($dbc); 
    $query1 = "INSERT INTO `champions` (title_id) VALUES ('$query_id')";
    mysqli_query($dbc, $query1);  
}
?>

Link to comment
https://forums.phpfreaks.com/topic/219879-2-insert-queries/
Share on other sites

I was going to say have you tried doing a:

 

mysqli_query($dbc, $query1) or die (mysql_error());

 

or is it perhaps: mysqli_query($dbc, $query1) or die (mysqli_error()); ?

 

Not used mysqli before but that's how you'd find out whats happening otherwise if there is an error related here

Link to comment
https://forums.phpfreaks.com/topic/219879-2-insert-queries/#findComment-1139847
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.