[ If you read this and feel you are getting a bit lost in the small technical Mumbo Jumbo sections - don't fret - There is a story in this...So keep reading ]
Well it’s certainly been an exciting Easter Break!
I had all the intentions of getting a huge chunk of my new website up and running but that sort of came unstuck.
The site is coded up to the point of accepting registrations and being able to edit/update your profile.
It is all working wonderfully well on my development box…
[Oh, I like to write my own projects for a bit of fun just in case you haven't caught on yet.]
But then…
I decided I’d throw it up on my webhosting and see how it flies and to show some folk my upcoming masterpiece.
So I did just that, I created my hosting account – changed the DNS settings and it instantly popped up on the webpage. So things were looking grand.
But then…
I got that very sad error message that I didn’t have execute script permissions on my database!!!!
Just to enlighten you if you are sitting thinking….”What does executing things have to do with this…”.
Well all my database “stuff” is written as Stored Procedures, which means – the functions that talk to the database are actually a part of the database itself. Not to worry if that’s confusing… It’s something I will be showing you later if you are interested…
Apart from it being a very useful programming feature, it does give you some added security. In short, it’s how it should be done.
So getting back to my dismay when I saw that hosting company had it disabled!!!!!!!!!!! What The!!!!! I promptly contacted support and they said “Yes, you can’t”. Most helpful.
After asking Why, I promptly joined up with another hosting company. And it all worked like a treat!
But then…
After I had successfully registered, I decided I had better update my profile. That’s what the instructions suggested I do. But this was the part where some new technique was being used. And… well a bit of it didn’t work!
By the way, remember that the script works flawlessy on my system.
Going back a week in time!
I’m using a PHP Framework called Codeigniter which I quite like even if it does have a few shortcomings. Hey nothing is perfect but it is good to know what those imperfections are and how to fix/cope with them…
I knew it wasn’t going to do what I wanted it to with returning multiple data sets from the stored procedure. Which in another language means – I ask the Database two questions and should get back two answers.
In it’s current state, CodeIgniter only liked to deal with one answer at a time.
So I modified it to work. How I did that was to go right back to basics and so I wrote an installation script to create a new table and stored procedures based upon what I was using. Then I created a number of sample php scripts so I had a known starting point. It all worked nicely…
From that I created the changes needed in CodeIgniter to make it all happy and it was. It uses the same function calls deep down in it’s database class…
Back to now.
So having encountered this “Database deafness” on the second question, I loaded my original test scripts up on the same hosting account using the same Database etc.
Guess What???
Everything Worked!
Head scratching time.
I contacted the new webhosting company explaining my dilemma and they asked to see some code to replicate the problem. Of course they would! So I created a new page up on the site explaining everything…
So why am I smiling?
I still don’t have it working, but I did end up creating a wonderful script that works like a little framework of it’s own allowing you to create your code snippets with an accompanying HMTL file with some blurb and it creates the webpage display the “instructions: then it shows the actual PHP Code cause it reads in the actual file and then it executes and displays the results.
Now that has major applications for so many things. It’s a great tool to use to demonstrate some of the finer points of PHP and how you can make it work for you. Actually some of it came from another script we are working on in our PHP Class. That was good timing!
So what started out as some rough knockup code only I could love and appreciate, turned into something anyone can read it and follow along all built with a nice modular system.
You can see the results…
The result of all that is viewable up on the new website. Well the site itself is still under construction..
It’s located at Demonstration of Stored Procedures using MySQLi
So I’ve now got a lovely way to demonstrate my code, allowing the world to see it. There is link at the bottom regarding the Forum I’ve posted on about this so the conversation can continue there.
I’m still stuck though.
Everything works except for the CodeIgniter script on the webhosting account, where it has to work!
It’ll be a simple problem but I have gone to all the trouble to “write it out” and see what falls out. It’s just this time I would appreciate some other eyes to view the problem and see what they can see that I cannot! It does happen sometimes!
So while I got stopped dead in my tracks on what I wanted to do, I’ve actually created something nice and useful.
If you do want to see/hear how I made the script, just come along to one of my classes. I am meant to have the details up on the webatories.com site. So I had best go and fix that bit up.
Webatories.com
There is a LOT planned for this website – so feel free to register and you’ll be kept notified on it’s progress.
http://www.webatories.com
[Update]
It’s fixed – The problem was I had made some changes to the members database table which were being installed with a separate SQL file through phpmyadmin. And guess what – I hadn’t run it in this particular installation.
Long story short – when the Stored procedure was attempting to read back the results from the members table it encountered an error due to the table missing some fields. But the error is “silent”.
The affect is it never returns anything… which is exactly what was happening. So there you go…. It was simple and writing it out finally led to the solution. Also a good rest helped as well.
On the "off chance" that you actually liked this post,
how about liking us on Facebook?...
Powered By Facebook Like Post Plugin
















