New Image Blog
How to get an auto increment value after a MySQL INSERT 
Wednesday, July 22, 2009, 10:47 AM - MySQL & PHP
Posted by Administrator
The following PHP code snippet will retrieve the largest row index value for a table. It can be used immediately after a MySQL INSERT to get the index value of the new row.

$sql = "SELECT MAX(index) FROM table";
$result = mysql_query($sql);
$row = mysql_fetch_row($result);
$get_max_index = $row[0];

Note: Substitute 'index' and 'table' in the first line with your own column and table names.
add comment ( 4 views )   |  0 trackbacks   |  permalink   |   ( 2.9 / 823 )
Warning: Cannot modify header information 
Friday, July 10, 2009, 10:24 AM - PHP Configuration
Posted by Administrator
I found many websites documenting this PHP warning, most did not help, but then I found this;

Edit the following config files:

/etc/php5/apache2/php.ini
/etc/php5/cgi/php.ini
/etc/php5/cli/php.ini

These paths may depend on your distribution. I am using Ubuntu 9.04 Server Edition. Note too that you may only have a single php.ini config file on your server.

Find the line that states 'output_buffering = Off' and modify it to be 'output_buffering = on'.

Restart apache from the terminal using the command 'sudo /etc/init.d/apache2 restart'

That should be all...

If this works for you let me know, else let me know how you got it working.

2 comments ( 33 views )   |  0 trackbacks   |  permalink   |   ( 2.9 / 745 )
Welcome! 
Thursday, July 9, 2009, 04:33 PM - Welcome
Posted by Administrator
Well, here it is... our new blog. Marking our tentative steps into the emerging (Some might say already quite established) field of Web 2.0.

Mind you, the concept of '2.0' is not really new to me at all. I have been bashing out super dynamic code for quite some time now, and the New Image ClipR CRM/Support web service is finally reaching a level of relative maturity.

There are several reasons for us deciding to launch this blog;

Primarily, the aim is that it will be a valuable source of information for our clients. We have just launched (Yesterday in fact) our new 'Web development/hosting' website, with it's vast array of available hosting technologies. Some of these techniques can be quite daunting for the first time user, so I have decided to use this blog to document my past experiences to help you avoid some headache.

Why would I want to add all these 'fancy' features if I knew they were going to cause said headache in the first place? Simply, the effort I put into setting up Subversion, for example, was well worth it when I consider the wasted time I spent trying to manage projects via FTP in the past (Granted, I do still use FTP to some extent).

Secondly, and this is more personal, this blog will allow me to collect bits of information together and structure them into a form that I can use at a later stage. If you are like me you may spend many hours researching new techniques or methods that you may require to get the job done. However, months later, when another project requires a similar solution that 'new' technique may have become a bit rusty. Now, using this blog, I can store my ideas in a single place (And you can also share them, or let me know if they are rubbish!).

Lastly, I often hack on little programs in my spare time. I would like to use this blog as a starting block to share these with you, and perhaps at some point forge a small little community of like minded friends.

Well, that is it for now, but please don't forget to check out our new website (Click here to go there now). Personally, I feel that the web hosting 'philosophy' is a stroke of genius ;) but I will cover that later...
add comment ( 1 view )   |  0 trackbacks   |  permalink   |   ( 2.8 / 565 )

| 1 |