Open noorbakerally opened 4 weeks ago
I am having a problem using Redbean. I have a table photos having the photos definition:
+----------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------------+-------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | account_number | varchar(20) | NO | | NULL | | | photo | text | YES | | NULL | | | isDefault | tinyint(1) | YES | | 0 | | +----------------+-------------+------+-----+---------+----------------+
I have a small PHP script:
<?php require 'rbconnect.php'; $photos = R::findOne('photos'); var_dump($photos); $photos->id = intval($photos->id); $photos->isDefault = intval($photos->isDefault); echo json_encode($photos); ?>
First part of returned result var_dump($photos):
var_dump($photos)
object(RedBeanPHP\OODBBean)#17 (11) { ["properties":protected]=> array(4) { ["id"]=> string(1) "1" ["account_number"]=> string(10) "1234567890" ["photo"]=> string(17) "sample_photo_data" ["isDefault"]=> string(1) "0" } ["__info":protected]=> array(8) { ["type"]=> string(6) "photos" ["sys.id"]=> string(2) "id" ["sys.orig"]=> array(4) { ["id"]=> string(1) "1" ["account_number"]=> string(10) "1234567890" ["photo"]=> string(17) "sample_photo_data" ["isDefault"]=> string(1) "0" } ["tainted"]=> bool(false) ["changed"]=> bool(false) ["changelist"]=> array(0) { } ["model"]=> NULL ["data.bundle"]=> array(0) { } } ["beanHelper":protected]=> object(RedBeanPHP\BeanHelper\SimpleFacadeBeanHelper)#13 (0) { } ["fetchType":protected]=> NULL ["withSql":protected]=> string(0) "" ["withParams":protected]=> array(0) { } ["aliasName":protected]=> NULL ["via":protected]=> NULL ["noLoad":protected]=> bool(false) ["all":protected]=> bool(false) ["castProperty":protected]=> NULL }
Second part of the returned json is: {"id":1,"account_number":"1234567890","photo":"sample_photo_data","isDefault":"0","is_default":0}
{"id":1,"account_number":"1234567890","photo":"sample_photo_data","isDefault":"0","is_default":0}
I am having two ambiguities:
Noor
Sorry for the late reply. Have you tried:
R::getDatabaseAdapter()->getDatabase()->stringifyFetches( FALSE );
I am having a problem using Redbean. I have a table photos having the photos definition:
I have a small PHP script:
First part of returned result
var_dump($photos)
:Second part of the returned json is:
{"id":1,"account_number":"1234567890","photo":"sample_photo_data","isDefault":"0","is_default":0}
I am having two ambiguities:
Noor