Welcome Guest, Not a member yet? Register   Sign In
Video Tutorial - Problem
#1

[eluser]felixk[/eluser]
Hi!
I've followed the videotutorial "Make a blog in 20 minutes".
I have done exacly like the guy instructs and read threw my code many times, and also checked error-logs, my database connection etc.

This is my controller:
Code:
<?php

class Blog extends Controller {

    function Blog()
    {
        parent::Controller();
                
    }
    
    function index()
    {
        $data['title'] = "My blog Title";
        $data['heading'] = "My blog Heading";
        $data['query'] = $this->db-get('entries');
        
        $this->load->view('blog_view', $data);
    }
}
?>

This is my viewer:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html &gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;&lt;?php echo $title; ?&gt;&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
<h1>&lt;?php echo $heading; ?&gt;</h1>
&lt;?php foreach($query->result() as $row): ?&gt;
<h3>&lt;? echo $title; ?&gt;</h3>
<hr />
&lt;?php endforeach; ?&gt;
&lt;/body&gt;
&lt;/html&gt;

I've typed this in my autoload.php:
Code:
$autoload['libraries'] = array('database');

The scaffolding works, but when I'm going to index.php or index.php/blog I'm getting this error message:
Quote:Fatal error: Call to undefined function get() in C:\wamp\www\codeigniter\CodeIgniter_1.7.1\system\application\controllers\blog.php on line 15

The same error also happens when I'm following other tutorials... Something is all messed up here.

Help me, please!
#2

[eluser]patrickpopowicz[/eluser]
Take a look at Line 15 of your controller, you're missing a '>' character.
Code:
$data['query'] = $this->db-get('entries');
#3

[eluser]jdfwarrior[/eluser]
[quote author="ppopowicz" date="1247075963"]Take a look at Line 15 of your controller, you're missing a '>' character.
Code:
$data['query'] = $this->db-get('entries');
[/quote]

hehe ya beat me to it..
#4

[eluser]umefarooq[/eluser]
ya it is a nice catch.
#5

[eluser]Dam1an[/eluser]
I recommend you get yourself a nice IDE with real time syntax checking, will make finding stuff like this much easier Smile
#6

[eluser]shinkenshin[/eluser]
Hi all,

I have a problem with the same tutorial, but with "scaffolding".

I have followed exactly the tutorial, but when I open the scaffolding page the top of the page is like in the video, while the bottom shows the following error:

Code:
A PHP Error was encountered
Severity: Warning

Message: Unknown: 2 result set(s) not freed. Use mysql_free_result to free result sets which were requested using mysql_query()

Filename: Unknown

Line Number: 0

If i click on "Create New Record" the result is a 404 page (in web-browser style, not CI style).

It seems that the problem is generated by the lack of a call mysql_free_result but the video does not say that I have to do it.

Any idea?

Kenshin
#7

[eluser]felixk[/eluser]
Thank you! You're my hero(s)! Big Grin

I saw that I had some other errors as well! Tongue haha.
But I just put my code toghether quite fast, since i reinstalled CodeIgniter.

Peace!
#8

[eluser]shinkenshin[/eluser]
Update:
I solved the problem of error 404... I had forgot to set the correctly the variable $config['base_url'].

So now the application work correctly, but the mysql_free_result warning still remain.

This is my controller:
Code:
&lt;?php
  class Blog extends Controller{

      function Blog(){
          parent::Controller();
          
          $this->load->scaffolding('entries');
      }
      
      function index(){
         $data['msg']='Hello World';
         $data['todo']=array('fare demo base','fare demo DB','fare tutorial avanzati','test autorizzazione e sessioni');
        
         $this->load->view('blog_view',$data);
      }
  }
?&gt;

and this is the view:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
&lt;html&gt;
&lt;head&gt;
  &lt;title&gt;&lt;/title>
&lt;/head&gt;
&lt;body&gt;
&lt;?php echo $msg . '<br/>'; ?&gt;
<ol>
&lt;?php foreach ($todo as $item): ?&gt;
<li>&lt;?php echo $item;?&gt;</li>
&lt;?php endforeach; ?&gt;
</ol>
&lt;/body&gt;
&lt;/html&gt;

This is the URL that open the page with the warning:
http://localhost/CodeIgniter_1.7.1/index...affolding/

Thank's in advance for any help.

Kenshin
#9

[eluser]shinkenshin[/eluser]
...anybody here?
Please, help a newbie to keep the right way... Smile

Why using scaffolding CI don't call automatically the mysql_free_result?

In this video is not made and does not show warning messages... :-S
#10

[eluser]GSV Sleeper Service[/eluser]
I'm fairly sure that scaffolding will be dropped soon. Those are only warnings, just switch warnings off by using error_reporting()




Theme © iAndrew 2016 - Forum software by © MyBB