. . . I get the following error. . . (I don't know whether to call this a bug report or a support request, since it could well be a misconfiguration on my part)
warning: mysqli_real_escape_string() expects parameter 2 to be string, array given in C:\wamp\www\includes\database.mysqli.inc on line 323.
I don't have a clue what's going on, don't know anywhere near enough about php / sql to diagnose this.
I do know that the page display in views works and when I pass the title of the node as an argument the views preview correctly filters the results down to the node body I want.
I also have view references working in several other places on the same site.
If I set the view reference up without arguments the full list is correctly displayed on the page, as soon as I try an argument to limit the referenced view to the node I want I get the error above. . .
So I'm pretty sure that either theres a bug in the handling of view references with arguments or I'm doing something wrong.
Any help would be greatly appreciated
Comments
Comment #1
danielb commentedSo are you saying that view references work with arguments, except for one particular view?
Can you give me any info regarding your field settings, argument values, and view settings?
Also what version of views?
Comment #2
austintnacious commentedI'm using Views 6.x-2.0!
None of the other view references that are working on the site link to views that use arguements.
This is my first time using arguements and so far I haven't found documentation that helps me even slightly.
I think I have the arguement set up correctly.
The views page display I'm trying to link to with view reference has a path of the following format. . .
http://localhost/path/to/content-type/%/google-checkout-button (where % would be the title of the relevant node as converted to a URL by pathauto).
When I try to pass the title of the relevant page as an arguement in the views preview area the arguement seems to work, it narrows the view down to the button for the page I want.
The error comes up when I try to edit the page which includes the view reference. In the content type admin page I can tell the view ref field to allow arguments but when I try to edit one of the relevant nodes to link to the view ref with the arguement I get the error mentioned. I've tried various ways of wording the arguement and I can't say I'm sure I'm formatting the argument correctly.
If I change the settings for the view ref field to not allow arguements (with views set to show all values if arguement is not present) then all the nodes are presented on the page.
I guess I'm about to move on and do this with individual page display view references for each page but I'd realy prefer to do it more programmatically using arguements. . .
Comment #3
austintnacious commentedAlso, If I test the view reference having set the argument in views to "provide a default if the argument is not present" which successfully limits the view to the node I want.
Then that node is accurately presented on each of the pages using the view reference.
I can also construct the URL for the node I want to appear via the view ref and successfully get the node I'm interested in to appear.
So far so good. I'm somewhat confident that the view with the argument is correct.
Either my setup of the argument for the view ref CCK field is wrong, or the format I'm using for the argument on the node edit page is wrong or there's a bug in the way view ref is handling the argument.
What makes me suspect a bug is that I can successfully get the results I want outside of the context of view reference and that no matter what format I try to use for the argument on the node edit page I get the same error. . .
warning: mysqli_real_escape_string() expects parameter 2 to be string, array given in C:\wamp\www\includes\database.mysqli.inc on line 323.Any help is greatly appreciated.
Comment #4
danielb commentedOK I am using an older version of views, 6.x-2.0 version has only been out for 3 days.
I just tried to recreate what you said using views 6.x-2.0-rc5, and it worked fine for me. I can't imagine why it would be different in 6.x-2.0, so when I get a chance to upgrade to view 2.0 I will test this out.
possibly... how are you doing it? I just tested it with a node called Privacy Policy, so I just typed Privacy Policy in and it worked.
Comment #5
austintnacious commentedor the format I'm using for the argument on the node edit page is wrong
how are you doing it?
Well, I've tried everything I can think of!
I've tried cutting and pasting the node title (essentially I'm trying to attach a google checkout button to a product node type I've created, the product nodes and their GC button nodes have the same node title so I'm trying to use the argument with the view reference to make the correct button appear on the page).
I've tried formatting the argument the way pathauto converts the title, e.g. if title is "Games For The New Years" I've tried "games-new-years"
I've tried both of the above options with double and single quotes.
I've tried using tokens(?) like "[title-raw]" and "%title" and "%title%".
Nothing works yet!
Comment #6
danielb commentedYeah should be the plain node title to make it work, no quotes or any other characters (pathauto and tokens aren't supported)
If you have time to try to help me make this work, are you able to try making a simple view with Node ID as the argument and try to test that with View Ref?
Also try your original view perhaps with PHP arguments turned on (they are processed a different way) but you do not actually have to specify your arguments as PHP or do anything differently.
If you want to give up on this module there is also 'Insert View' or 'View Field' modules that perform a similar function using different methods which support token arguments.
Comment #7
austintnacious commentedHey, so I tried turning on PHP arguments in the View Ref field settings and then tried inputting just the Node title and the node title on the node edit page in the following format. . .
"
print "Games For The New Years";"I know next to nothing about PHP so I don't really know if this is doing the right thing or not.
Regardless, I get the same error. . .
warning: mysqli_real_escape_string() expects parameter 2 to be string, array given in C:\wamp\www\includes\database.mysqli.inc on line 323.Incidentally, with the argument field turned on, when I edit and save a node, receive the error and go back to edit the node, my previous entry for the argument is not remembered along with all the other fields, i.e. the aregument field is empty.
Also, I get the same error I get the same error whether I put a string in the argument field or not, a blank argument cause the same error.
I'd love to help you work this out / fix it but at the moment I'm cramming to launch this site by Tuesday and I have a long way to go.
If it's still a problem by Wednesday and assuming I have indeed completed this project then I'll be happy to help.
I guess for the moment I'm going to have to work something else out.
Do you have any ideas?
The reason I was trying it this way was because I could not find a CCK field module that allows me to input full xHTML.
It seems like the only place to do that is in the node body but I don't like that solution.
I want the google checkout button at the top of the page but I don't want the GC code to become part of the teaser and mess up the product listing page.
If that makes sense. . .
Comment #8
austintnacious commentedOK!
I just can't leave things alone.
I really want(ed) this to work!
I tried as you suggested above to set up another view ref linking to a page display which uses a node ID as the argument.
The views page display seems to work OK, I can limit the items returned to the body of the one node I'm interested in using the "Preview" feature in the Views UI.
I removed my old view ref field and added a new view ref field linked to the new page display with the arg field enabled and allowing PHP.
I get the same error whether I input just the NID or the NID in a PHP print statement or leave the field blank. . .
warning: mysqli_real_escape_string() expects parameter 2 to be string, array given in C:\wamp\www\includes\database.mysqli.inc on line 323.Thanks for the help at this point I need to move on. I'll take a quick look at 'Insert View' and 'View Field' and I'll check back with you here on this issue mid-week. . .
Comment #9
danielb commentedI will try to investigate this further tonight.
Comment #10
austintnacious commentedHey, I looked at both Insert View and Viewfield.
Decided to go with Insert View for the moment.
FYI, I have the inserted view working with the arguments using the following syntax. . .
[view:view_marketplace_product_listing=page_1=Games For The New Years]All working good!
Still would prefer to be working with View Reference tho'!
I'll get back with you mid-week!
Cheers!
Comment #11
danielb commentedoh man, I thought just to make sure I'd better download the module off this site and install it, instead of using my development version. And bingo I get the same error as you.
I keep stuffing the CVS updates somehow and get an old version of a file...
Comment #12
danielb commentedFixed in 2.x-2.7, sorry about everything.
Comment #13
danielb commentedComment #14
austintnacious commentedGlad you got it worked out.
I had to move on to another solution.
Still using View Reference in other ways / contexts, maybe revert back to using it for the current purpose later, once the dust settles.
Thanks for getting it sorted out.
Comment #15
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.