MySQL Main Query Types used in PHP to select, insert, update and delete data

MySQL Main Query Types SELECT SELECT * FROM tablename INSERT 1 INSERT INTO tablename (col1, col2, col3,..) VALUES (val1, val2, val3,...) UPDATE 1 UPDATE tablename SET `col1`=`val1`, `col2`=`val2`, `col3`=`val3`,... DELETE 1 DELETE FROM tablename WHERE `col4`=`val6` Note You will use a lot of WHERE clauses as well along with the above. e.g. 1 SELECT * FROM tablename WHERE `id`='15' In PHP Calling to MySQL is really easy in PHP, just use the mysql_query() function.

Connect to mysql database from php

If you need to connect to a mysql database from php you can do it like this: 1 2 3 4 5 6 7 8 <?php $DBH = 'localhost'; $DBU = 'root'; $DBPWD = 'password'; $DBN = 'petstore'; $conn = mysql_connect($DBH, $DBU, $DBPWD) or die ("Error: Could not connect to database."); mysql_select_db($dbname); This allows you to make a connection to the mysql database and gets it ready for you to make queries and manipulate the data.

htaccess file and error 500 internal server error

I have a question for anyone that can answer it: I create an .htaccess file in the root of a subdomain, but if I enter either of these two lines I get an erro 500 Internal Server Error: 1 2 php_flag magic_quotes_gpc off php_flag register_globals off Any suggestions anyone?

Quake 4 – Fatal Error: could not create destination file

If you get an error message similar to this one when trying to run Quake 4… Fatal Error: could not create destination file C:/Program Files (x86)/id Software/Quake 4 Multiplayer Demo/q4mp/gamex86.dll …then you should run the exe as Administrator. So Right-click, “Run as Administrator” and all will be sorted.

phpMyAdmin – Invalid field count in csv input on line 1

I was trying to import a massive csv dataset into phpMyAdmin and it kept throwing error: Invalid field count in csv input on line 1 This is quite annoying as I followed all the usual steps as per normal. To solve this I had to do the following: Import Browse for your CSV file. Select CSV using LOAD DATA (rather than just CSV) Change “Fields terminated by” from “;” to “,” Make sure “Use LOCAL keyword” is selected.

Choosing a programming IDE

This is somewhat of a debatable topic, but it has come up a lot of times without any real final clarity, so I will try and cover it all. Lets begin by explaining exactly what an IDE is and then we can move onto the more debated areas of choosing the right one for you. An IDE stands for “Integrated Development Environment” and is often used by programmers when creating their applications.

Double border in CSS

CSS allows you to add a border to almost all html elements. If you would like a double border you can use CSS like this: style="border:double"

[Exception… “Could not convert JavaScript” nsresult: “0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)”

What the heck is.. uncaught exception: [Exception… “Could not convert JavaScript argument arg 0 [nsIDOMHTMLDivElement.appendChild]” nsresult: “0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)” location: “JS frame :: PATH_TO_MY_JAVASCRIPT_FILE :: THE_METHOD_NAME :: line #” data: no] For me it was just an appendChild() that was causing the problems. You can always try the innerHTML+= way if all else fails 😉

Add a date to a date in Actionscript 2

I needed to work out a date range according to the date 3weeks away from the current date. After a bit of thinking, I found that it’s actually quite easy to achieve. 1 2 3 4 5 6 7 8 9 10 var theDate:Date = new Date(); dateDay = theDate.getDate(); dateMonth = theDate.getMonth(); dateYear = theDate.getFullYear(); var theDate2:Date = new Date(dateYear,dateMonth,dateDay); theDate2.setDate(theDate2.getDate() + 21); dateDay2 = theDate2.getDate(); dateMonth2 = theDate2.getMonth(); dateYear2 = theDate2.

Add a month to selectable date range – Date Chooser – Actionscript 2

I have been working on a project where I need to select a date range starting today and ending a month from now, so the user cannot select anything in the past or over a month from now. This is how I did it: There is an instance of DateChooser on the stage with Instance Name “calDate”. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 var todayDate:Date = new Date(); dateBeginDay = todayDate.

127.0.0.1:4664 and Google Desktop Search

Recently I checked my website stats and saw I had a few hits from “127.0.0.1:4664” and wondered to myself, what the heck is that? Am I looking at my own site from a localhost? Why am I getting backlinks from my local computer to my site. After searching around a bit I found out that port 4664 is used by Google Desktop Search and when I typed in certain queries into Google it also returned items from my desktop search.

Embed pound symbol (£) in flash textfield

If you use a dynamic textbox in Flash and you want to embed the British Pound symbol (£) then you will want to also embed the “Latin I” glyphs with your textfield.

Enable / Disable Cursor Hand in Actionscript 2

If you have a movieclip that by default has the hand cursor showing on RollOver and you don’t really want this, you can disable it by doing the following: 1 2 3 myMC.onRollOver = function() { this.useHandCursor=false; } So the main code here is: this.useHandCursor=false; False disables it and true shows it.

USB Device Not Recognized! in Windows

Believe it or not, this one is super easy to fix! It’s actually a temporary problem with your motherboard, all you need to do is: turn off your computer if it’s a desktop then unplug it from the wall/powersupply if it’s a laptop then remove the battery let it sit for a minute plug it all in again reboot VOILA! No need to uninstall/reinstall drivers or anything!

Calling event functions from movieclips in actionscript 2

In a flash movie I usually have a frame of actionscript that controls all elements in the file to keep everything in one place. Sometimes I have an onPress(etc) function that refers to something happening in the scene when something is pressed, but what happens if we want another element to refer to that event for some reason? Here’s an example of that code without anything “flashy”: 1 2 3 _root.

Sudo install OpenGL & SDL on Ubuntu

A quick and easy way would be to type the following in one line with single spaces in the Terminal. This way of installing OpenGL and SDL libraries only applies to Ubuntu. 1 2 3 4 5 6 7 sudo apt-get install nvidia-glx-new-dev libglew1.4-dev libsdl1.2-dev libsdl-ttf2.0-dev libsdl-image1.2-dev libsdl-mixer1.2-dev

How To Modify Hosts File On Windows

The hosts file is located at the following address: C:\windows\system32\drivers\etc</span> or %systemroot%\system32\drivers\etc</span> But you will need to open Notepad with “Run as Administrator” first and then open it through there otherwise it will give a permissions problem