This topic is locked
[SOLVED]

 Error Type 256 Description Error Unknown column

7/18/2013 9:48:05 AM
PHPRunner General questions
O
onlline author

Hi ,
I using numer in the field example 101, 105, 106 the scripts works 100% fine
If ussing the letters example ROM101, ROM105, ROM106 occurs the following error

Error Type 256

Description Error Unknown column 'ROM101' in 'where clause'
/////////////////////////////////////////////////// [color="#FF0000"]Before Record Add

$rs = CustomQuery("SELECT StatusRom, UsedByCustomer FROM roms WHERE NumberRom = ".$values['NumberRom']);
$record = db_fetch_array($rs);
if($record['StatusRom'] == 'Ocupada')

{

$message = 'A sala esta sendo usada pelo cliente '.$record['UsedByCustomer'];

return false;

}

///////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

CustomQuery("UPDATE roms SET CurrentDate = '', StatusRom = 'Ocupada', UsedByCustomer = '".$values['NameCustomer']."' WHERE NumberRom =".$values['NumberRom']);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////// [b][color="#FF0000"]After Record Delete
///////////////////////////////////
CustomQuery("UPDATE roms SET StatusRom = 'Liberada', UsedByCustomer = '', CurrentDate = '".now()."' WHERE NumberRom = ".$deleted_values['NumberRom']);
//////////////////////////////////////////////////////////////////////////////////////////////////////
Thanks in advanced

C
copper21 7/18/2013

Not sure if this is going to help, but it looks like where you have your "Values" fields you are missing some things.
Try
$rs = CustomQuery("SELECT StatusRom, UsedByCustomer FROM roms WHERE NumberRom = ".$values['NumberRom']."");
$message = 'A sala esta sendo usada pelo cliente '".$record['UsedByCustomer']."'';
CustomQuery("UPDATE roms SET CurrentDate = '', StatusRom = 'Ocupada', UsedByCustomer = '".$values['NameCustomer']."' WHERE NumberRom = ".$values['NumberRom']."");
CustomQuery("UPDATE roms SET StatusRom = 'Liberada', UsedByCustomer = '', CurrentDate = GETDATE() WHERE NumberRom = ".$deleted_values['NumberRom']."");
It looks like you were missing ." at the end of your field names. It should look like ".$values['NumberRom']." for numeric fields and '".$values['NameCustomer']."' for fields with characters. When setting a date, use GETDATE() if you are using SQL Server or NOW() if you are using MySQL.
Brian

Sergey Kornilov admin 7/19/2013

If NumberRom is a text field you need to add single quotes around this field value in SQL query. Here is an example:

UPDATE roms SET CurrentDate = '', StatusRom = 'Ocupada', UsedByCustomer = 'Some customer' WHERE NumberRom ='ROM106'
O
onlline author 7/19/2013



Not sure if this is going to help, but it looks like where you have your "Values" fields you are missing some things.
Try
$rs = CustomQuery("SELECT StatusRom, UsedByCustomer FROM roms WHERE NumberRom = ".$values['NumberRom']."");
$message = 'A sala esta sendo usada pelo cliente '".$record['UsedByCustomer']."'';
CustomQuery("UPDATE roms SET CurrentDate = '', StatusRom = 'Ocupada', UsedByCustomer = '".$values['NameCustomer']."' WHERE NumberRom = ".$values['NumberRom']."");
CustomQuery("UPDATE roms SET StatusRom = 'Liberada', UsedByCustomer = '', CurrentDate = GETDATE() WHERE NumberRom = ".$deleted_values['NumberRom']."");
thank you
the attention but the error remains
It looks like you were missing ." at the end of your field names. It should look like ".$values['NumberRom']." for numeric fields and '".$values['NameCustomer']."' for fields with characters. When setting a date, use GETDATE() if you are using SQL Server or NOW() if you are using MySQL.
Brian

O
onlline author 7/19/2013



If NumberRom is a text field you need to add single quotes around this field value in SQL query. Here is an example:

UPDATE roms SET CurrentDate = '', StatusRom = 'Ocupada', UsedByCustomer = 'Some customer' WHERE NumberRom ='ROM106'



Hi,
I'm using events before new record is added , the error occurs only when I type letters
Thanks in advanced