Welcome Guest, Not a member yet? Register   Sign In
Scaffolding problem with URL...
#1

[eluser]dr.fux[/eluser]
Hi there!

I am new to CI and wanted try out the scaffolding thing as discribed in the video tutorials and de userguide... so i did the following:

routes.php:
Code:
$route['scaffolding_trigger'] = "wwd_input";

main_controller jasse.php:
Code:
function Jasse()
    {
        parent::Controller();
        $this->load->scaffolding('user');
    }

the database login data is in the config.php and works! i tested...

when i load the page with the secred word (http://localhost/index.php/jasse/wwd_input) the main scaffolding page gets loaded correctly. But when i click on "Create New Record" i get to a wrong url:

IS(wrong): http://localhost/index.php/jasse/jasse/wwd_input/add
SHOULD: http://localhost/index.php/jasse/wwd_input/add

when i load http://localhost/index.php/jasse/wwd_input/add manually, [without clicking the link], i get the right "Scaffolding: Add Data" page. i fill in the form an hit the insert button. unfortunately the form goes to the wrong place again (http://localhost/index.php/jasse/wwd_inp...put/insert)

whats wrong?

thanks for help!
#2

[eluser]Michael Wales[/eluser]
Just for grins, try putting the scaffolding loader in a method named index()

Personally, I've never used scaffolding, but I could where some issue may arise from it being in the constructor.

Code:
function Jasse() {
  parent::Controller();
}

function index() {
  $this->load->scaffolding('user');
}

Also, check to make sure your config.php is correct - particularly this line:
Code:
$config['base_url']    = "http://localhost/";

Access the site with the same URL and let us know how it works.
#3

[eluser]dr.fux[/eluser]
[quote author="walesmd" date="1190833637"]
Also, check to make sure your config.php is correct - particularly this line:
Code:
$config['base_url']    = "http://localhost/";

Access the site with the same URL and let us know how it works.[/quote]

that was it! no http in base_url :S


now i get another error:

Quote:An Error Was Encountered

Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'group = '1', name = '1', prename = '1', adress = '1', plz = '1', city = '1', bir' at line 1

UPDATE user SET mail = '1', pw = '1', group = '1', name = '1', prename = '1', adress = '1', plz = '1', city = '1', birthday = '0000-00-07', mobile = '1', phone = '1', image = '1' WHERE id = '1'

dunno what problem there is... i write no special character to db. should work easy!
#4

[eluser]Michael Wales[/eluser]
group is a reserved word for MySQL. It thinks you are about to say "GROUP BY fieldname," but when you don't it goes "wtf biotch?"

If you weren't using scaffolding and this was your own query, you could surround that field with ticks (`) and everything would work fine - that's definitely something that needs to be suggested, I'll make a post.

In the meantime, either change the name of that field or quit using scaffolding.
#5

[eluser]dr.fux[/eluser]
:-) yeah

unbelievable how fast this was solved!

thx very much!
#6

[eluser]Josh Giese[/eluser]
[quote author="Michael Wales" date="1190833637"]

Also, check to make sure your config.php is correct - particularly this line:
Code:
$config['base_url']    = "http://localhost/";

Access the site with the same URL and let us know how it works.[/quote]

This totally fixed my problem as well. Thank you for suggesting this fix.




Theme © iAndrew 2016 - Forum software by © MyBB