RedCoupe

Change date/time format from MySQL

by on Sep.17, 2010, under Web design / development

Format was: 2010-09-17 12:09:01

But wanted to display like: 17-09-2010 12:09:01

<?php echo date('d-m-Y H:m:s', strtotime($row_Recordset1['datetimeval'])); ?>

Related links:

Leave a Comment :, more...

PHP replace crlf in a textarea with br

by on Sep.09, 2010, under Web design / development

I had a textarea value which was obtained from a MySQL database and it contained many instances of crlf or \n. To display correctly on a web page I wanted to convert those to <br /> so I used the following code:

<?php echo nl2br($myrecorsetvalue); ?>

Obviously you would need to replace the $myrecorsetvalue with whatever recordset variable you are using.

Leave a Comment :, more...

Random rows in MySQL

by on Sep.08, 2010, under Web design / development

A competition has been running on a website and all the entries were stored in a MySQL table.

Had to get a random record to pick a winner once the closing date had passed.

Here’s the SQL I used:

SELECT *
FROM t_tablename
ORDER BY RAND()
LIMIT 1

If I had wanted to pick out 5 random winners, then change the LIMIT value to LIMIT 5.

Leave a Comment : more...

Problem connecting to MySQL on Ubuntu

by on Sep.08, 2010, under Web design / development

Had a problem connecting to my MySQL server which is on a Linux server (Ubuntu) and used the following advice to get round this, so I thought I would share this with you in case anybody has the same problem:

Edit the following file: /etc/mysql/my.cnf

Find the following line:

bind-address = 127.0.0.1

and change it to the actual ip address of the Ubuntu box and save

Then restart MySQL: sudo /etc/init.d/mysql restart

Job done!

Leave a Comment :, more...

Battlefield Bad Company 2

by on Feb.22, 2010, under Xbox360

Can’t wait for BC2 to come out, not long now, I have pre-ordered it. Been playing the demo which is really enjoyable, as long as people join as different classes and work together.

I think its a bit pointless when everybody in a squad or side joins as recon. Don’t take this the wrong way, I too enjoy doing a bit of recon, as long as it assists your side to win overall. I do get a great sense of achievement when getting a head-shot from one side of the map to the other and spotting is good whilst communicating with your attackers and medics etc. Too much camping ruins things as the objectives still need to be reached by planting or defusing charges etc to win the map.

I just hope this doesn’t turn into a spawn die, spawn die, spawn die game as I will get hugely frustrated very quickly. I also hope that the unlocking and levelling up system isn’t unfair and disadvantage players too much when initially starting off. Still, it gives us something to aim for and that’s what adds to the ‘stickiness’ of the game, you just want to keep playing more and more, just a few more points to the next level and unlock a new item.

Its a shame that the XP wont be carried over to the full version, well I suppose thats unofficial as EA haven’t actually commented to my knowledge. Im sure it won’t take too long to catch up anyway.

Anyway, enough rantings, I have high hopes for this and hope that I keep playing it for ages. Hope to see you on there!

Leave a Comment : more...

Xbox 360

by on Apr.22, 2009, under Xbox360

Just got an Xbox 360 60GB once again. Used to have one but used it to fund the purchase of my PS3. I wish I never got rid of the Xbox, oh well lol. Just got some good bargains on Ebay for Mass Effect and Frontlines: Fuel of War, hope they are good ones. Been playing a borrowed copy of Fable 2 which seems like something I could get into. Now on the hunt for cheap copies of Gears of War 2 and Fable 2. Found a good deal at HMV for Halo 3 for £11.99. Can’t buy everything in one go, need to have some patience :-)

Leave a Comment : more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!