How work with bit column and checkbox

QuestionsHow work with bit column and checkbox
Alejandro Torres asked 5 years ago

Hi. I have this code:

$col = array();
$col[“title”] = “<center>Soporte</center>”;
$col[“name”] = “Soporte”;
$col[“fixed”] = true;
$col[“width”] = “100”;
$col[“editable”] = true;
$col[“formatter”] = “checkbox”;
$col[“edittype”] = “checkbox”;
$col[“editoptions”] = array(“value”=>”true:false”);
$cols[] = $col;

When press button Save this error appears:

Couldn’t execute query. Data too long for column ‘Soporte’ at row 1…..

UPDATE….Soporte=’false’ WHERE….

The command fails for quote in false word.

The command: UPDATE….Soporte=false WHERE….   (without quotes works)

How i can remove that quotes?

Thank You

 

 

 

 

4 Answers
Abu Ghufran Staff answered 5 years ago

Try setting:

$col[“isnum”] = true;

By this it will assume that column does not need quotes for comparison.

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Alejandro Torres answered 5 years ago

Thank you. I tried the indicated thing, but unfortunately it did not work. Is there another alternative?     $col = array();     $col[\”title\”] = \”<center>Soporte</center>\”;     $col[\”name\”] = \”Soporte\”;     $col[\”isnum\”] = true;     $col[\”fixed\”] = true;     $col[\”width\”] = \”100\”;     $col[\”editable\”] = true;     $col[\”formatter\”] = \”checkbox\”;     $col[\”edittype\”] = \”checkbox\”;     $col[\”editoptions\”] = array(\”value\”=>\”true:false\”);     $cols[] = $col;

Abu Ghufran Staff answered 5 years ago

Can you also try by replacing true:false to 1:0

$col[“editoptions”] = array(“value”=>”1:0”);

also check what query is being build after adding isnum.

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Alejandro Torres answered 5 years ago

When press button Save this error appears, the desplegated error is:

Couldn’t execute query. Data too long for column ‘Soporte’ at row 1…..

UPDATE Proyectos SET Soporte=’1’ WHERE Id = 1

with quotes in ‘1’.

I changed the table structure. The column changed from bit to tying(1). It’s works

Thank you

 

 

 

 

Your Answer

6 + 15 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?