| Index
» Projekty
» phpMyEdit
» Fórum
» Triggers not being called |
 |
twhit67
Založený: 03.02.2010
Príspevky: 16
Zaslal: 2010-04-14 15:18
Návrat hore
Odpovedať s citátom
|
Need some clarification on triggers;
My triggers aren't getting called.
My form:
| Kód: |
$opts['fdd']['days_worked'] = array(
'name' => 'DAYS WORKED',
'select' => 'T',
'input' => 'H',
'options' => 'AVLCD',
'maxlen' => 5,
'sort' => false,
);
$opts['trigger']['insert']['after']='daysworked.php'; |
The following doesn't seem to call on my php at all.
Do I have the trigger statement wrong? In wrong place? Maybe because field input is hidden?
The php is a simple IF ELSE statement.
| Kód: |
<?php
$m=('miles_driven');
if ($m=='0')
echo "1";
else
echo "0";
?> |
|
kally
Založený: 05.01.2005
Príspevky: 14
Zaslal: 2010-05-05 19:10
Návrat hore
Odpovedať s citátom
|
Where are you getting your miles_driven variable from? That may be the problem.
Here is a sample of a file I use to Insert After, maybe it will help to see how I use the variables.
Also, I normally put my call to the insert after file above the other stuff, although I'm not sure if that matters.
My code may not be the best, but it works. :-)
| Kód: |
$this->rec = mysql_insert_id();
$thisID = $this->rec;
global $opts;
$myrec = $this->rec;
if(!@mysql_connect($opts['hn'],$opts['un'],$opts['pw'])) {
die('<h3>Unable to connect</h3></body></html>');
}
if(!@mysql_select_db($opts['db'])) {
die('<h3>Unable to select database</h3></body></html>');
}
$sql = "SELECT filename FROM myTable WHERE ID = \"$myrec\"";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result))
{
$thisFilename = $row["filename"];
}
mysql_query("INSERT INTO myPages (ID, display, filename)
VALUES ('$thisID', 'no', '$thisFilename')")
or die(mysql_error());
echo "Data Inserted!";
$this->operation = 'View';
return true; |
|
|
Odoslať novú tému
Odpovedať na tému
|
|
|
|