Archive for June, 2009
PHP Error: Call to a member function fetch_assoc() on a non-object in
Posted on 23. Jun, 2009 by Dragos.
If you get this error: Call to a member function fetch_assoc() on a non-object in … , it means that you have an error in your mysql syntax. Supposing that $mysqli is your database connection object, put echo $mysqli->error; just before the line you’re getting the error on. $mysqli=new mysqli(HOST,USER,PASS,DB); $mQuery=$mysqli->query(‘select `data` from `this_table` where [...]
Continue Reading
JavaScript: How to get the index (position within a group) of an object with jQuery?
Posted on 20. Jun, 2009 by Dragos.
I’ve spent some time today figuring out how to obtain that index and finally I’ve just puzzled it out. Let’s say we have a group of objects all containing the class=”house”. Now if we are referencing to the first element within the group and we’d like to find out it’s index (well it’s obvious in [...]
Continue Reading
JavaScript: What if jQuery animation doesn’t fire/start?
Posted on 19. Jun, 2009 by Dragos.
I’ve been working on an image gallery (that I will publish here for all to see and use) and I ran into an issue that I’ve never experienced before: jQuery stopped firing the animation of an object. I looked at the expression, everything was fine. However not the expression was the problem, but the variables [...]
Continue Reading
Coding: Don’t make mistakes when resizing objects! Preserve the initial ratio correctly!
Posted on 17. Jun, 2009 by Dragos.
I was tempted many times to do quick adjustments to my code, without taking into consideration some basic mathematical principles. For examples if a box is first of all 100px tall and 60px wide, and then I notice that this box does not fit the place where it was intended to be placed, what I [...]
Continue Reading
PHP: Get all files and folders from a directory (folder)
Posted on 16. Jun, 2009 by Dragos.
To get all files and folders from a directory (folder) I found scandir to be the perfect solution. scandir scans a directory and returns an array containing all files and directories under the parent directory we’re looking in. The code below will try to remove a directory, if the element is a directory or delete [...]
Continue Reading
Coding: How to get code suggestions and function completion in Netbeans?
Posted on 15. Jun, 2009 by Dragos.
I was struggling myself in finding how to get the code suggestions feature work in Netbeans. I knew it was there and sometimes I accidentally triggered it, but I could never figure out what combination of keys I had to hit in order for the suggestions box to appear. So I decided to open a [...]
Continue Reading
Javascript: How to validate email address with JavaScript?
Posted on 13. Jun, 2009 by Dragos.
Here’s a piece of code I found while I was browsing the JQuery UI pages to easily validate email addresses. The code below represents a general validation function, that requires two parameters:1. the string value of an obkect and 2. the regular expression to check the string against function checkRegexp(o,regexp) { if ( !( regexp.test( [...]
Continue Reading
JavaScript: Get anchor from URL
Posted on 10. Jun, 2009 by Dragos.
To get the anchor from an URL (this is the text after the # character) in JavaScript you can use the following code: var url=’http://iwebdevel.com/some-post#comment-1′; //if you need to take the current url of the window use: var url=window.location; var anchor=url.hash; //anchor with the # character var anchor2=url.hash.substring(1); //anchor without the # character If you’re [...]
Continue Reading
JavaScript: Where do I Find All Properties for All HTML Elements ?
Posted on 08. Jun, 2009 by Dragos.
You think you’re good at JavaScript? Ok. Here’s a question that’ll test your JavaScript wisdom: How many properties does a DIV element have? Your answer is 5? Because there is the name, id, class, style or title property. Maybe your answer is a little bit more than 5, but would you be surprised if I [...]
Continue Reading
WordPress: Easily Reset Your Account Password Using MySQL and PHP
Posted on 08. Jun, 2009 by Dragos.
I’ve just forgot my admin password on my local testing blog, and what is worse – my local machine is not configured to send external email. Oh yeah, got to reinstall wordpress again, what a pity. No way! There are two ways of resetting your password using two easy methods. You’ll need basic knowledge of [...]


