addblock problem

Permalink
Add article the problem of the block
error: mysql error: [1048: Column 'arHandle' can not be null] in EXECUTE ("insert into CollectionVersionBlocks (CID, CVID, BID, arHandle, cbDisplayOrder, isOriginal, cbIncludeAll) values ​​('1036 ', '2', '2680 ', NULL, 0, 1, '1') ")

arhandle can not be NULL.
arHandle? in which the data come.
<? php
$ bt = BlockType :: getByHandle ('reviews');
$ b = $ c-> addBlock ($ conn_id, $ arHandle, $ data);
$ bt-> controller-> mainCollection = $ c;
$ bt-> controller-> setCollectionObject ($ c);
$ bt-> controller-> title = 'Comments';
$ bt-> controller-> requireApproval = true;
$ bt-> controller-> authenticationRequired = false;
$ bt-> controller-> displayCaptcha = false;
$ bt-> controller-> displayGuestBookForm = true;
$ bt-> controller-> notifyEmail = 'info@xyzkadin.com';
$ bt-> render ('templates / article-review / view');
?>
Where is the problem where I'm doing wrong.

 
Remo replied on at Permalink Reply
Remo
$arHandle isn't initialized in your code. How should that script be able to add a new block in the database if that parameter is empty? Every block needs to be part of an area!
goksaltak replied on at Permalink Reply
I'm not an expert in concrete5. exactly what you need to do with the code.
Remo replied on at Permalink Reply
Remo
First of all: What are you trying to achieve? Do you want to display a block from code or do you want to add a block to a page with code?
goksaltak replied on at Permalink Reply
I'm trying to add a block comment on articles. as you said, I'm trying to add a block of all the articles.
Remo replied on at Permalink Reply
Remo
Where did you put that code you've posted?
mhawke replied on at Permalink Reply
mhawke
Please make sure your php code is correct first. Remove the spaces after the $ signs in your variable names. For example:

$ bt should be $bt
$ b should be $b
$ c should be $c
$ conn_id should be $conn_id
$ arHandle should be $arHandle
$ data should be $data
goksaltak replied on at Permalink Reply
put into themes/domainname/articleread1.php.

but I just do not have the image shows the functionality of any article. does not form action code. consequently does not work.

I hope you have the answer you want.
goksaltak replied on at Permalink Reply
Mhawke, I have already done so, it would generate appeared here.
mhawke replied on at Permalink Reply
mhawke
Sorry about that.

Enclose code samples in [code][/code]