Author Topic: It just won't insert!  (Read 1486 times)

0 Members and 1 Guest are viewing this topic.

Offline AvalancheTopic starter

  • Enthusiast
  • Posts: 390
    • View Profile
It just won't insert!
« on: May 18, 2003, 03:00:28 PM »
[php:1:20ca43efce]// Record in change logs if roster_trackchanges is 1
if ($roster_trackchanges == 1) {
$query_changes = \"INSERT INTO roster_changes(er, ee, type, date, time)
VALUES(\'user\',\'\".$_SESSION[mem_alias].\"\',\'edited\',date(), time())\";
mysql_query($query_changes);
}[/php:1:20ca43efce]

I added a \"else { echo \"hey hey\"; }\" but the \"hey hey\" didn\'t come up, so $roster_trackchanges IS 1, it just doesn\'t insert.                    
DEFINE("YOU","Spending Too Much Time On The Computer");

Offline Nairb

  • Enthusiast
  • Posts: 68
    • View Profile
It just won't insert!
« Reply #1 on: May 18, 2003, 03:13:05 PM »
Try assigning the session, so you dont have to break it, or w/e

[php:1:8452372283]
if ($roster_trackchanges == 1) {
$session = $_SESSION[mem_alias];

$query_changes = \"INSERT INTO roster_changes(er, ee, type, date, time)
VALUES(\'user\',\'$session\',\'edited\',date(), time())\";  
mysql_query($query_changes);
}
[/php:1:8452372283]

Try that, it\'s all I can think of                    

Offline AvalancheTopic starter

  • Enthusiast
  • Posts: 390
    • View Profile
It just won't insert!
« Reply #2 on: May 18, 2003, 04:15:33 PM »
It still won\'t work. I also tried removing the if argument, and optimizing the table in phpMyAdmin (becaue apparently it needed optimization).                    
DEFINE("YOU","Spending Too Much Time On The Computer");

Offline Nairb

  • Enthusiast
  • Posts: 68
    • View Profile
It just won't insert!
« Reply #3 on: May 18, 2003, 04:39:29 PM »
Lol, hmmm...
Once again, try assigning some stuff:

[php:1:4eac3f3181]
if ($roster_trackchanges == 1) {  
$session = $_SESSION[mem_alias];
$date = date();
$time = time();

$query_changes = \"INSERT INTO roster_changes(er, ee, type, date, time)
VALUES(\'user\',\'$session\',\'edited\',\'$date,\' \'$time\')\";  
mysql_query($query_changes);  
}
[/php:1:4eac3f3181]

Again, just a suggestion?                    

Offline AvalancheTopic starter

  • Enthusiast
  • Posts: 390
    • View Profile
It just won't insert!
« Reply #4 on: May 18, 2003, 04:44:01 PM »
Yeah, I just now figured out you don\'t put the apostrophes around the field names, just the values.

Anyway, thanks.

(PS: When I tried inserting a time() into my database it came out like 839:49:49 when it\'s 4:43... the field type is time; should it be timestamp?)                    
DEFINE("YOU","Spending Too Much Time On The Computer");

Offline AvalancheTopic starter

  • Enthusiast
  • Posts: 390
    • View Profile
It just won't insert!
« Reply #5 on: May 18, 2003, 04:54:16 PM »
Nevermind, figured it out.                    
DEFINE("YOU","Spending Too Much Time On The Computer");