Hello,
I have the fallowing:
table with the next columns: id, order_nr, drawing_nr.
i want, when when i write in the field drawing_nr some text, to receive a message that tells - > the text was written and can be found on order_nr x, y, x
id order_nr drawing_nr
1 test1 12345
2 test2 234
3 test3 12345
this value “12345” can be found in order: test1, test3.
down you can find my script, can you tell me what i did wrong?
/**
- Check for an existing record
*/
// SQL statement parameters
$check_table = ‘file’; // Table name
$check_where = “drawing_nr = ‘{drawing_nr}’”; // Where clause
$group_by = order_nr; //group by
// Check for record
$check_sql = ‘SELECT *’
. ’ FROM ’ . $check_table
. ’ WHERE ’ . $check_where
. ’ GROUP BY ’ . $group_by;
sc_select(dataset, $check_sql);
if (false == {dataset})
{
// Error while accessing database
}
elseif ({dataset}->EOF)
{
// IF no record found
$master_field = ‘duplicate’; // Field name on the master application
$master_value = ‘0’; // New value
// Set master value
sc_master_value($master_field, $master_value);
}
else
{
// IF record found
$javascript_title = ‘Attention - Record found !!!’; // Javascript message title
$javascript_message = “This part [ <font color=‘red’><b>{drawing_nr}</b></font> ] was made in the past.<br>You can take/compare the time values from there…<br> Orders: $group_by”; // Javascript message contents
// Display javascript message
sc_ajax_message($javascript_message, $javascript_title);
// Field parameters
$master_field = ‘duplicate’; // Field name on the master application
$master_value = ‘1’; // New value
// Set master value
sc_master_value($master_field, $master_value);
}