Welcome Guest, Not a member yet? Register   Sign In
Help required with update and insert
#31

[eluser]LuckyFella73[/eluser]
I saved your controller in a fresh project. My editor had
problems with your quotes, so I replaced all you quotes
with a standard ' and ".

When calling .../admin/update/63 (random id) I only get
an error message because I don't have you models. No white
page. So I guess you have to check other parts of your code
or general CI setup. You could have a problem with routes or
.htaccess maybe.

I attached the controller (with normal quotes) as a file. Try
to save that maybe and see if it makes a difference.
#32

[eluser]danmontgomery[/eluser]
First thing you should always do when you get a white page is check the apache error log. This problem could have been solved in minutes.
#33

[eluser]the_unforgiven[/eluser]
Ok tried that, so here's my htaccess file

Code:
RewriteEngine On
RewriteBase /ci/

    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
ErrorDocument 404 /index.php
#34

[eluser]the_unforgiven[/eluser]
also routes file looks like

Code:
$route['default_controller'] = "home";  //Set to home as this is a CMS im building so the admin controller is on it's own
$route['404_override'] = '';
#35

[eluser]the_unforgiven[/eluser]
[quote author="noctrum" date="1313601822"]First thing you should always do when you get a white page is check the apache error log. This problem could have been solved in minutes.[/quote]

How would you do this? and what am i looking for?
#36

[eluser]the_unforgiven[/eluser]
I"m on a Mac and i check in Console and this came back

Code:
[17-Aug-2011 13:37:44] PHP Fatal error:  Call to a member function num_rows() on a non-object in /Applications/MAMP/htdocs/ci/application/controllers/admin.php on line 106

Does this mean anything to anyone and how would i fix it?
#37

[eluser]the_unforgiven[/eluser]
Any advise??
#38

[eluser]danmontgomery[/eluser]
It means the result you get back from:

Code:
if ($query->num_rows() > 0)

Isn't an object, which is only going to happen ( assuming you're directly returning $this->db->get() or $this->db->query() ) when you have a syntax error in your query. I would do something like:

Code:
if(! $query)
{
    exit($this->db->last->query());
}

if ($query->num_rows() > 0)
{
// ...

To see what's being run, throw the query into phpMyAdmin and see what the problem is
#39

[eluser]the_unforgiven[/eluser]
Maybe I'm not getting you and please be gentle I'm a noobie, but still getting a blank page
#40

[eluser]danmontgomery[/eluser]
The error message tells you exactly what line the error is on:

Quote:[17-Aug-2011 13:37:44] PHP Fatal error: Call to a member function num_rows() on a non-object in /Applications/MAMP/htdocs/ci/application/controllers/admin.php on line 106

On this line, you'll see a call to num_rows(). num_rows() is being called on a non-object, as the error message says, which can't happen. So, you either need to validate that you're getting back what you think you're getting back before that point (recommended), or kill the script before it gets there so you can see what state you're in.

If you're doing that, and still getting a white page, check the apache error log again. Is it the same problem?

Post your getAllPages() method, while you're at it.




Theme © iAndrew 2016 - Forum software by © MyBB