Categories
PHP

Stripping the Query String from a URL in PHP

[sourcecode language='php']
list($shorturl) = explode('?','http://www.website.com.com?page=7');
echo $shorturl;
[/sourcecode]

Categories
Operating Systems

Just-In-Time debugger errors after uninstalling Visual Studio

Uninstalling Visual Studio can leave your system struggling with  Just-In-Time debugger errors that can prevent applications from starting.

To resolve it, try deleting the following registry keys.

The usual warnings about editing the registry apply; if you don't understand the risks, don't do it.

  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug\Debugger
  •  HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\DbgManagedDebugger
Categories
PHP

Arrays in PHP

Some day I'll get around do writing some stuff on arrays in PHP.  In the meantime, here are some links to another site with some outdated but still quite useful information on arrays in PHP.

Categories
Database MySQL PHP

Pulling a single value from the database

Sometimes you just want to pull a single value from the database without a whole lot of work.  Here's how to do it in a single line;

MySQLi

// Assumes that a mysqli connection ($db) has been made to the database
$value = $db->query("SELECT value FROM table WHERE condition = 'met'")->fetch_row()[0];

MySQL (Deprecated)

// Assumes that a connection exists to the database (mysql_connect()) and a database is selected (mysql_select_db())
$value = mysql_result(mysql_query("SELECT value FROM table WHERE condition = 'met'"), 0);
Categories
Operating Systems

Find out when Windows was installed on a machine

To tell when the operating was installed on your Windows XP/2003 system, go to a command prompt (Start – Run – "cmd" – OK), then enter the following command;

[sourcecode language='php']

systeminfo | find /i "install date"

[/sourcecode]