Welcome Guest, Not a member yet? Register   Sign In
Problems with my CRUD function
#3

[eluser]BrianDHall[/eluser]
In your code:

Code:
function view($id)

This says "this function MUST be called with a parameter, or error".

While this is logically ok, the problem is you are assuming in your function that $id was set somewhere - but it might not have been.

You can set a default value for $id, here:

Code:
function view($id = 1)

To pass a variable to the function the url should be something like website.com/person/view/1 - but if someone rips off the 1 they'll get that ugly error about $id being undefined, so you'll want to make sure its set before you refer to it.


Messages In This Thread
Problems with my CRUD function - by El Forum - 09-14-2009, 03:16 AM
Problems with my CRUD function - by El Forum - 09-14-2009, 06:36 PM
Problems with my CRUD function - by El Forum - 09-15-2009, 07:16 AM
Problems with my CRUD function - by El Forum - 09-15-2009, 07:55 AM
Problems with my CRUD function - by El Forum - 09-15-2009, 08:10 AM
Problems with my CRUD function - by El Forum - 09-15-2009, 08:38 AM
Problems with my CRUD function - by El Forum - 09-15-2009, 11:01 AM
Problems with my CRUD function - by El Forum - 09-16-2009, 02:08 AM
Problems with my CRUD function - by El Forum - 09-16-2009, 02:24 AM
Problems with my CRUD function - by El Forum - 09-16-2009, 02:44 AM
Problems with my CRUD function - by El Forum - 09-16-2009, 02:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB