PHP - CodeIgniter - Invalid argument supplied for foreach

0 votes

I'm attempting to use CodeIgniter to create a website, but PHP is giving me trouble. I'm confident that it is so obvious and cannot be flawed. But I'm new to CodeIgniter and have no idea where issues come from.

    <html>  
    <head>  
        <title><?=$page_title?></title>  
    </head>  
    <body>  
        <?php foreach($result as $row):?>  
        <h3><? echo $row->title; ?></h3>  
        <p><? echo $row->text; ?></p>  
        <?php endforeach;?>  
    </body>  
</html> 

I've a bug from this file :

A PHP Error was encountered

Severity: Warning

Message: Invalid argument supplied for foreach()

Filename: views/helloworld_view.php

Line Number: 6

Can someone please help me with this? 

Jul 25, 2022 in PHP by Kithuzzz
• 38,000 points
1,038 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In PHP

0 votes
1 answer

Invalid argument supplied for foreach() on line 25. Error in my php and mysql

Hello @viven , This should be a simple fix ...READ MORE

answered Aug 4, 2020 in PHP by Niroj
• 82,840 points
4,303 views
0 votes
0 answers

PHP CodeIgniter 4 - Form Submission - error "Can't find a route for 'registrations/index'"

The route is created in appConfigRoutes.php, and ...READ MORE

Aug 6, 2022 in PHP by Kithuzzz
• 38,000 points
1,681 views
0 votes
1 answer

What are the best way to allow plugins for a PHP application?

Hii, Here is an approach I have  used, it's ...READ MORE

answered Apr 1, 2020 in PHP by Niroj
• 82,840 points
752 views
0 votes
1 answer

What is the best way to allow plugins for a PHP application?

Hello @kartik, I've used, it's an attempt to ...READ MORE

answered Apr 15, 2020 in PHP by Niroj
• 82,840 points
729 views
0 votes
1 answer

How do I let PHP to create subdomain automatically for each user?

Hello @kartik, We setup wildcard DNS like they ...READ MORE

answered Apr 20, 2020 in PHP by Niroj
• 82,840 points
5,612 views
0 votes
1 answer

How foreach change original array values in php?

Hello @kartik, Do the following: foreach ($fields as $key ...READ MORE

answered Aug 14, 2020 in PHP by Niroj
• 82,840 points
8,729 views
0 votes
2 answers

Define a SQL query? What is the difference between SELECT and UPDATE Query? How do you use SQL in SAS?

HI.. SQL is Structured Query Language, which is ...READ MORE

answered Aug 8, 2020 in PHP by anonymous
10,540 views
0 votes
1 answer

Vertically centering text in a div

Try this code: .smallUnitBox { ...READ MORE

answered Sep 3, 2018 in Blockchain by digger
• 26,740 points
829 views
0 votes
1 answer
0 votes
0 answers

Anyone can help me out to understand the semantic of (document.getElementBYId("demo").innerHTML="Hello") ?

Hello guys, Can Someone helps me to find ...READ MORE

Jan 17, 2020 in Web Development by anonymous
• 37,520 points
935 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP