How to fix Error Number: 1054 Unknown column 'Array' in 'where clause'Unknown Column In Where ClauseError: Unknown column 'Array' in 'where clause'How to fix “Headers already sent” error in PHPPassing 2 strings through array to the where clause in codeigniterUnknown column 'Array' in 'where clause' SQL=SELECT * FROM #__content WHERE Array = '4'Multiple search field codeigniter database error unknown column 'array' in 'where clause'Running query inside loopError when trying to fetch data from a database using CodeIgniterError Number: 1054 Unknown column in where clauseError while executing Query in Codeigniter

Party going through airport security at separate times?

Computer name naming convention for security

Did depressed people far more accurately estimate how many monsters they killed in a video game?

What was this character's plan?

Did Rabbi Akiva accept arguments from ignorance?

Did right-wing politician Franz Josef Strauss ever explain why he gave a 3 billion loan to East Germany in 1983?

What does the multimeter dial do internally?

US citizen traveling with Peruvian passport

What are the consequences for a developed nation to not accept any refugees?

Performance issue in code for reading line and testing for palindrome

Swapping "Good" and "Bad"

Would a Nikon FG 20 film SLR camera take pictures without batteries?

Optimization models for portfolio optimization

A sequence that changes sign finally at infinity?

Why AI became applicable only after Nvidia's chips were available?

Is there a method for differentiating informative comments from commented out code?

What factors could lead to bishops establishing monastic armies?

Was it ever illegal to name a pig "Napoleon" in France?

Reference request: quantifier elimination test

Run Bash scripts in folder all at the same time

How does one acquire an undead eyeball encased in a gem?

Why do airports remove/realign runways?

Writing an ace/aro character?

Appropriate conduit for several data cables underground over 300' run



How to fix Error Number: 1054 Unknown column 'Array' in 'where clause'


Unknown Column In Where ClauseError: Unknown column 'Array' in 'where clause'How to fix “Headers already sent” error in PHPPassing 2 strings through array to the where clause in codeigniterUnknown column 'Array' in 'where clause' SQL=SELECT * FROM #__content WHERE Array = '4'Multiple search field codeigniter database error unknown column 'array' in 'where clause'Running query inside loopError when trying to fetch data from a database using CodeIgniterError Number: 1054 Unknown column in where clauseError while executing Query in Codeigniter






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















this is my error :




A PHP Error was encountered Severity: Notice Message: Array to string
conversion Filename: templates/sidebar.php Line Number: 24 Backtrace:



File:
A:SitesPHP_CIhasan-loginapplicationviewstemplatessidebar.php
Line: 24 Function: _error_handler



File: A:SitesPHP_CIhasan-loginapplicationcontrollersAdmin.php
Line: 14 Function: view



File: A:SitesPHP_CIhasan-loginindex.php Line: 315 Function:
require_once A Database Error Occurred



Error Number: 1054 Unknown column 'Array' in 'where clause'



SELECT user_menu.id, menu FROM user_menu JOIN
user_access_menu ON user_menu.id = user_access_menu.menu_id
WHERE user_access_menu.role_id = Array ORDER BY
user_access_menu.menu_id ASC



Filename: A:/Sites/PHP_CI/hasan-login/system/database/DB_driver.php
Line Number: 691




I use php codeigniter. but when I delete the part where the program runs smoothly. maybe an error in the where. how to fix this error?



this is my code :



<?php
//error_reporting(0);
$role_id = $this->session->userdata('role_id');
$queryMenu = "SELECT `user_menu`.`id`, `menu`
FROM `user_menu` JOIN `user_access_menu`
ON `user_menu`.`id` = `user_access_menu`.`menu_id`
WHERE `user_access_menu`.`role_id` = $role_id
ORDER BY `user_access_menu`.`menu_id` ASC
";
$menu = $this->db->query($queryMenu)->result_array();
var_dump($menu);
die;
?>









share|improve this question



















  • 3





    The first line tells you the problem, $role_id is an array and you are trying to use it as a string. You need to extract the appropriate value from it (perhaps $role_id[0] but without seeing more of your code it's impossible to tell) to use in your query.

    – Nick
    Mar 25 at 23:29

















1















this is my error :




A PHP Error was encountered Severity: Notice Message: Array to string
conversion Filename: templates/sidebar.php Line Number: 24 Backtrace:



File:
A:SitesPHP_CIhasan-loginapplicationviewstemplatessidebar.php
Line: 24 Function: _error_handler



File: A:SitesPHP_CIhasan-loginapplicationcontrollersAdmin.php
Line: 14 Function: view



File: A:SitesPHP_CIhasan-loginindex.php Line: 315 Function:
require_once A Database Error Occurred



Error Number: 1054 Unknown column 'Array' in 'where clause'



SELECT user_menu.id, menu FROM user_menu JOIN
user_access_menu ON user_menu.id = user_access_menu.menu_id
WHERE user_access_menu.role_id = Array ORDER BY
user_access_menu.menu_id ASC



Filename: A:/Sites/PHP_CI/hasan-login/system/database/DB_driver.php
Line Number: 691




I use php codeigniter. but when I delete the part where the program runs smoothly. maybe an error in the where. how to fix this error?



this is my code :



<?php
//error_reporting(0);
$role_id = $this->session->userdata('role_id');
$queryMenu = "SELECT `user_menu`.`id`, `menu`
FROM `user_menu` JOIN `user_access_menu`
ON `user_menu`.`id` = `user_access_menu`.`menu_id`
WHERE `user_access_menu`.`role_id` = $role_id
ORDER BY `user_access_menu`.`menu_id` ASC
";
$menu = $this->db->query($queryMenu)->result_array();
var_dump($menu);
die;
?>









share|improve this question



















  • 3





    The first line tells you the problem, $role_id is an array and you are trying to use it as a string. You need to extract the appropriate value from it (perhaps $role_id[0] but without seeing more of your code it's impossible to tell) to use in your query.

    – Nick
    Mar 25 at 23:29













1












1








1








this is my error :




A PHP Error was encountered Severity: Notice Message: Array to string
conversion Filename: templates/sidebar.php Line Number: 24 Backtrace:



File:
A:SitesPHP_CIhasan-loginapplicationviewstemplatessidebar.php
Line: 24 Function: _error_handler



File: A:SitesPHP_CIhasan-loginapplicationcontrollersAdmin.php
Line: 14 Function: view



File: A:SitesPHP_CIhasan-loginindex.php Line: 315 Function:
require_once A Database Error Occurred



Error Number: 1054 Unknown column 'Array' in 'where clause'



SELECT user_menu.id, menu FROM user_menu JOIN
user_access_menu ON user_menu.id = user_access_menu.menu_id
WHERE user_access_menu.role_id = Array ORDER BY
user_access_menu.menu_id ASC



Filename: A:/Sites/PHP_CI/hasan-login/system/database/DB_driver.php
Line Number: 691




I use php codeigniter. but when I delete the part where the program runs smoothly. maybe an error in the where. how to fix this error?



this is my code :



<?php
//error_reporting(0);
$role_id = $this->session->userdata('role_id');
$queryMenu = "SELECT `user_menu`.`id`, `menu`
FROM `user_menu` JOIN `user_access_menu`
ON `user_menu`.`id` = `user_access_menu`.`menu_id`
WHERE `user_access_menu`.`role_id` = $role_id
ORDER BY `user_access_menu`.`menu_id` ASC
";
$menu = $this->db->query($queryMenu)->result_array();
var_dump($menu);
die;
?>









share|improve this question
















this is my error :




A PHP Error was encountered Severity: Notice Message: Array to string
conversion Filename: templates/sidebar.php Line Number: 24 Backtrace:



File:
A:SitesPHP_CIhasan-loginapplicationviewstemplatessidebar.php
Line: 24 Function: _error_handler



File: A:SitesPHP_CIhasan-loginapplicationcontrollersAdmin.php
Line: 14 Function: view



File: A:SitesPHP_CIhasan-loginindex.php Line: 315 Function:
require_once A Database Error Occurred



Error Number: 1054 Unknown column 'Array' in 'where clause'



SELECT user_menu.id, menu FROM user_menu JOIN
user_access_menu ON user_menu.id = user_access_menu.menu_id
WHERE user_access_menu.role_id = Array ORDER BY
user_access_menu.menu_id ASC



Filename: A:/Sites/PHP_CI/hasan-login/system/database/DB_driver.php
Line Number: 691




I use php codeigniter. but when I delete the part where the program runs smoothly. maybe an error in the where. how to fix this error?



this is my code :



<?php
//error_reporting(0);
$role_id = $this->session->userdata('role_id');
$queryMenu = "SELECT `user_menu`.`id`, `menu`
FROM `user_menu` JOIN `user_access_menu`
ON `user_menu`.`id` = `user_access_menu`.`menu_id`
WHERE `user_access_menu`.`role_id` = $role_id
ORDER BY `user_access_menu`.`menu_id` ASC
";
$menu = $this->db->query($queryMenu)->result_array();
var_dump($menu);
die;
?>






php where-clause where-in mysql-error-1054






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 25 at 23:27









Nick

48.2k14 gold badges24 silver badges44 bronze badges




48.2k14 gold badges24 silver badges44 bronze badges










asked Mar 25 at 23:26









Hasan ZahirHasan Zahir

254 bronze badges




254 bronze badges







  • 3





    The first line tells you the problem, $role_id is an array and you are trying to use it as a string. You need to extract the appropriate value from it (perhaps $role_id[0] but without seeing more of your code it's impossible to tell) to use in your query.

    – Nick
    Mar 25 at 23:29












  • 3





    The first line tells you the problem, $role_id is an array and you are trying to use it as a string. You need to extract the appropriate value from it (perhaps $role_id[0] but without seeing more of your code it's impossible to tell) to use in your query.

    – Nick
    Mar 25 at 23:29







3




3





The first line tells you the problem, $role_id is an array and you are trying to use it as a string. You need to extract the appropriate value from it (perhaps $role_id[0] but without seeing more of your code it's impossible to tell) to use in your query.

– Nick
Mar 25 at 23:29





The first line tells you the problem, $role_id is an array and you are trying to use it as a string. You need to extract the appropriate value from it (perhaps $role_id[0] but without seeing more of your code it's impossible to tell) to use in your query.

– Nick
Mar 25 at 23:29












2 Answers
2






active

oldest

votes


















0














This is codeigniter, you can use the OOB functions given in codeigniter query builder page, by the way you should try this one:



 <?php
$role_id = $this->session->userdata('role_id');
$queryMenu = "SELECT `user_menu`.`id`, `menu`
FROM `user_menu` JOIN `user_access_menu`
ON `user_menu`.`id` = `user_access_menu`.`menu_id`
WHERE `user_access_menu`.`role_id` = ?
ORDER BY `user_access_menu`.`menu_id` ASC
";
$menu = $this->db->query($queryMenu,array($role_id))->result_array();
var_dump($menu);
die;
?>





share|improve this answer























  • Thank you so much this command worked for me : $menu = $this->db->query($queryMenu,print_r($role_id))->result_array();

    – Hasan Zahir
    Mar 25 at 23:50











  • Good job & good luck sir!

    – Jan Lois
    Mar 25 at 23:53


















0














use printr on the $role_id variable, i suspect its an array and this is why you are getting this error.






share|improve this answer























  • Thank you so much this command worked for me : $menu = $this->db->query($queryMenu,print_r($role_id))->result_array();

    – Hasan Zahir
    Mar 25 at 23:51













Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55347811%2fhow-to-fix-error-number-1054-unknown-column-array-in-where-clause%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














This is codeigniter, you can use the OOB functions given in codeigniter query builder page, by the way you should try this one:



 <?php
$role_id = $this->session->userdata('role_id');
$queryMenu = "SELECT `user_menu`.`id`, `menu`
FROM `user_menu` JOIN `user_access_menu`
ON `user_menu`.`id` = `user_access_menu`.`menu_id`
WHERE `user_access_menu`.`role_id` = ?
ORDER BY `user_access_menu`.`menu_id` ASC
";
$menu = $this->db->query($queryMenu,array($role_id))->result_array();
var_dump($menu);
die;
?>





share|improve this answer























  • Thank you so much this command worked for me : $menu = $this->db->query($queryMenu,print_r($role_id))->result_array();

    – Hasan Zahir
    Mar 25 at 23:50











  • Good job & good luck sir!

    – Jan Lois
    Mar 25 at 23:53















0














This is codeigniter, you can use the OOB functions given in codeigniter query builder page, by the way you should try this one:



 <?php
$role_id = $this->session->userdata('role_id');
$queryMenu = "SELECT `user_menu`.`id`, `menu`
FROM `user_menu` JOIN `user_access_menu`
ON `user_menu`.`id` = `user_access_menu`.`menu_id`
WHERE `user_access_menu`.`role_id` = ?
ORDER BY `user_access_menu`.`menu_id` ASC
";
$menu = $this->db->query($queryMenu,array($role_id))->result_array();
var_dump($menu);
die;
?>





share|improve this answer























  • Thank you so much this command worked for me : $menu = $this->db->query($queryMenu,print_r($role_id))->result_array();

    – Hasan Zahir
    Mar 25 at 23:50











  • Good job & good luck sir!

    – Jan Lois
    Mar 25 at 23:53













0












0








0







This is codeigniter, you can use the OOB functions given in codeigniter query builder page, by the way you should try this one:



 <?php
$role_id = $this->session->userdata('role_id');
$queryMenu = "SELECT `user_menu`.`id`, `menu`
FROM `user_menu` JOIN `user_access_menu`
ON `user_menu`.`id` = `user_access_menu`.`menu_id`
WHERE `user_access_menu`.`role_id` = ?
ORDER BY `user_access_menu`.`menu_id` ASC
";
$menu = $this->db->query($queryMenu,array($role_id))->result_array();
var_dump($menu);
die;
?>





share|improve this answer













This is codeigniter, you can use the OOB functions given in codeigniter query builder page, by the way you should try this one:



 <?php
$role_id = $this->session->userdata('role_id');
$queryMenu = "SELECT `user_menu`.`id`, `menu`
FROM `user_menu` JOIN `user_access_menu`
ON `user_menu`.`id` = `user_access_menu`.`menu_id`
WHERE `user_access_menu`.`role_id` = ?
ORDER BY `user_access_menu`.`menu_id` ASC
";
$menu = $this->db->query($queryMenu,array($role_id))->result_array();
var_dump($menu);
die;
?>






share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 25 at 23:34









Jan LoisJan Lois

1899 bronze badges




1899 bronze badges












  • Thank you so much this command worked for me : $menu = $this->db->query($queryMenu,print_r($role_id))->result_array();

    – Hasan Zahir
    Mar 25 at 23:50











  • Good job & good luck sir!

    – Jan Lois
    Mar 25 at 23:53

















  • Thank you so much this command worked for me : $menu = $this->db->query($queryMenu,print_r($role_id))->result_array();

    – Hasan Zahir
    Mar 25 at 23:50











  • Good job & good luck sir!

    – Jan Lois
    Mar 25 at 23:53
















Thank you so much this command worked for me : $menu = $this->db->query($queryMenu,print_r($role_id))->result_array();

– Hasan Zahir
Mar 25 at 23:50





Thank you so much this command worked for me : $menu = $this->db->query($queryMenu,print_r($role_id))->result_array();

– Hasan Zahir
Mar 25 at 23:50













Good job & good luck sir!

– Jan Lois
Mar 25 at 23:53





Good job & good luck sir!

– Jan Lois
Mar 25 at 23:53













0














use printr on the $role_id variable, i suspect its an array and this is why you are getting this error.






share|improve this answer























  • Thank you so much this command worked for me : $menu = $this->db->query($queryMenu,print_r($role_id))->result_array();

    – Hasan Zahir
    Mar 25 at 23:51















0














use printr on the $role_id variable, i suspect its an array and this is why you are getting this error.






share|improve this answer























  • Thank you so much this command worked for me : $menu = $this->db->query($queryMenu,print_r($role_id))->result_array();

    – Hasan Zahir
    Mar 25 at 23:51













0












0








0







use printr on the $role_id variable, i suspect its an array and this is why you are getting this error.






share|improve this answer













use printr on the $role_id variable, i suspect its an array and this is why you are getting this error.







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 25 at 23:30









ChrisChris

7835 silver badges16 bronze badges




7835 silver badges16 bronze badges












  • Thank you so much this command worked for me : $menu = $this->db->query($queryMenu,print_r($role_id))->result_array();

    – Hasan Zahir
    Mar 25 at 23:51

















  • Thank you so much this command worked for me : $menu = $this->db->query($queryMenu,print_r($role_id))->result_array();

    – Hasan Zahir
    Mar 25 at 23:51
















Thank you so much this command worked for me : $menu = $this->db->query($queryMenu,print_r($role_id))->result_array();

– Hasan Zahir
Mar 25 at 23:51





Thank you so much this command worked for me : $menu = $this->db->query($queryMenu,print_r($role_id))->result_array();

– Hasan Zahir
Mar 25 at 23:51

















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid …


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55347811%2fhow-to-fix-error-number-1054-unknown-column-array-in-where-clause%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to preserve electronics (computers, tablets and phones) for hundreds of years Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) The network's official Twitter account is up and running again. What content…How might modern humans leave a message for 50,000 years?How would an aquatic race develop computers?How do we make computers care for human life?Keeping supplies for 1000 yearsWhat will cell phones become in 100 years?What body armor protects against a laser?Could a society attain 1800s technology if limited to using copper and bronze?Electricity power (magic) and electronicsScavenging metal resources in post-apocalypse after 100 yearsWhy would precursors create devices that can survive and still work after hundreds of years?

155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해

Convert JSON to MapSimplest way to convert a string representing JSON array into Java array List of key value pairsHow to take String JSON values into HashMapConvert a JSON String to a HashMapCreating BSON object from JSON stringJSONObject - How to get a value ?Better Map ConstructorReading JSON from Url javaUpdate columns if input values are not null otherwise ignore and keep the existing values of column in databaseHow to store object represented as Json string into Couchbase Lite?Go JSON into MapHow do I efficiently iterate over each entry in a Java Map?Sort a Map<Key, Value> by valuesHow to round a number to n decimal places in JavaCan comments be used in JSON?How do I read / convert an InputStream into a String in Java?How can I pretty-print JSON in a shell script?What is the correct JSON content type?How can I deserialize JSON to a simple Dictionary<string,string> in ASP.NET?Why does Google prepend while(1); to their JSON responses?Parse JSON in JavaScript?