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
https://forums.phpfreaks.com/topic/64586-solved-mysql-entry/
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
https://forums.phpfreaks.com/topic/64586-solved-mysql-entry/#findComment-321982
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
https://forums.phpfreaks.com/topic/64586-solved-mysql-entry/#findComment-321991
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
https://forums.phpfreaks.com/topic/64586-solved-mysql-entry/#findComment-322001
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.