Jump to content

[SOLVED] Mysql entry


sstangle73

Recommended Posts

 function addNew9sch($ID, $Type, $HR, $Period1, $Period2, $Period3, $Period4, $Period5, $Period6, $Period7, $Period8, $Period9){
   global $conn;
   $q2 = "INSERT INTO schedule VALUES ('$ID', '$Type', '$HR', '$Period 1', '$Period 2', '$Period 3', '$Period 4', '$Period 5', '$Period 6', '$Period 7', '$Period 9')";
   return mysql_query($q2,$conn);
}
$type = '9Per';
$hr = $_POST['hr'];
$per1 = $_POST['per1'];
$per2 = $_POST['per2'];
$per3 = $_POST['per3'];
$per4 = $_POST['per4'];
$per5 = $_POST['per5'];
$per6 = $_POST['per6'];
$per7 = $_POST['per7'];
$per8 = $_POST['per8'];
$per9 = $_POST['per9'];

$_SESSION['regresult'] = addNew9sch($ID, $type, $hr, $per1, $per2, $per3, $per4, $per5, $per6, $per7, $per8, $per9);
if($_SESSION['regresult']){
echo	"Success";
} else { echo "Failed"; }

 

results with failed cant figure it out

Link to comment
Share on other sites

yeah thats what i thought it failed with no space. i put the space in there after the original code to see if i could get it to work

 

$type = '9Per';

$hr = $_POST['hr']; was right in there dont know why u missed it and the ID was defined earlier in the page :) when i run a query from the table users ill try the debug now

 

yes and yes

Link to comment
Share on other sites

Change your function to the following then post your output.

 

function addNew9sch($ID, $Type, $HR, $Period1, $Period2, $Period3, $Period4, $Period5, $Period6, $Period7, $Period8, $Period9){
  global $conn;
  $q2 = "INSERT INTO schedule VALUES ('$ID', '$Type', '$HR', '$Period1', '$Period2', '$Period3', '$Period4', '$Period5', '$Period6', '$Period7', '$Period9')";
  if ($result(mysql_query($q2,$conn)) {
    return $result;
  } else {
    die(mysql_error() . "<br />" . $q2);
  }
}

Link to comment
Share on other sites

Sorry... my fault, your function ought look like....

 

function addNew9sch($ID, $Type, $HR, $Period1, $Period2, $Period3, $Period4, $Period5, $Period6, $Period7, $Period8, $Period9){
  global $conn;
  $q2 = "INSERT INTO schedule VALUES ('$ID', '$Type', '$HR', '$Period1', '$Period2', '$Period3', '$Period4', '$Period5', '$Period6', '$Period7', '$Period9')";
  if ($result = mysql_query($q2,$conn)) {
    return $result;
  } else {
    die(mysql_error() . "<br />" . $q2);
  }
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.