To capture the error of a PHP query against a MySQL database, use this syntax: $result=mysql_query($query); if (!$result) { die(‘Invalid query: ‘ . mysql_error()); }
How to Capture Errors With PHP MySQL Queries
Securing phpMyAdmin
phpMyAdmin is a web-based tool for managing MySQL databases. The installation mainly consists of extracting the distribution and editing the database authentication information. In this article we will secure phpMyAdmin using a change of the directory name and a .htaccess file. First off, let’s extract the package: [root@srv-5 webroot]# ls php* phpMyAdmin-2.6.4-pl3.tar.bz2 [root@srv-5 webroot]# tar […]
Listing Available MySQL Databases and Tables
To determine what databases and tables are stored in your MySQL database, log in using the mysql client: [usr-1@srv-1 ~]$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 6 to server version: 4.1.12 Type ‘help;’ or ‘\h’ for help. Type ‘\c’ […]
SQLite Autoincrement
An autoincrement field is already included with SQLite. Select ROWID from a table to get the unique row identification. Here is some REALBasic code that selects the ROWID along with the other columns in the table and displays it in a ListBox: UtilSet.LBAP.DeleteAllRows db= New REALSQLdatabase dbFile = GetFolderItem(“mcj.rsd”) db.DatabaseFile=dbFile If db.Connect() then rs = […]
Dumping SQLite Table Structure
SQLite is a small, embeddable SQL database engine. Its licensing allows it to be included in commercial products and modified without publishing the source code. REALbasic uses SQLite as its included database engine. REALbasic has a query tool; however, it is nice to have the full-blown sqlite client. Let’s download the tarball and configure, compile, […]
Using MCJ to Practice SQL Commands – Part 1 – Initial Startup
Mountain Climbing Journal (MCJ) is a journal application that includes a SQL Tool to query the database using an embedded SQLite database engine. MCJ is a single executable. In this example we are using the GNU/Linux version, but there are versions for Microsoft Windows and Mac OS X as well: [usr-1@sv-1 sqlart]$ ls mcjl [usr-1@sv-1 […]
Using MCJ to Practice SQL Commands – Part 2 – Creating Some Records
Mountain Climbing Journal (MCJ) is a journal application that includes a SQL Tool to query the database using an embedded SQLite database engine. In Part 1 we created an initial database. Now, let’s add some records. The empty cup-like icon that is yellow, below, is what is used to add a blank record. It turns […]
Using MCJ to Practice SQL Commands – Part 3 – Some Queries
Mountain Climbing Journal (MCJ) is a journal application that includes a SQL Tool to query the database using an embedded SQLite database engine. In Part 2 we created some records. Now, let’s do some queries. Our first query will be to select all fields in all records in the journal table: select * from journal […]
Importing a CSV file to a SQLite Database
SQLite has a build in import command for importing records from text files. We used a tab for a field separator: $ sqlite3 database.db SQLite version 3.1.3 Enter “.help” for instructions sqlite> .separator “\t” Now that we have set our field separator, we can import: sqlite> .import ex.txt tablename sqlite>
Setting MySQL System Variables on the Fly
Many MySQL system variables can be set on the fly at the command line, without restarting the server. This is a great thing at times, like when that new code which was so thoroughly “tested” winds up consuming five times the database connections as the old version. Oops! Well, within the limits of the resources […]
Updating Tables with SQL
As we mentioned in Using MCJ to Practice SQL Commands, the MCJ has the ability to run queries directly. We had a bunch of configuration and compile options that now should run with type for the build tab2. We can change all of the chroot types to prechroot with the SQL command: update journal set […]
Adding NFS Users
Add the hostname of the client you want to be able to access your NFS server to /etc/exports. To list the current allowed users: [root@mondo log]# exportfs /share u-1.signalq.com /share srv-3.signalq.com /share srv-44.signalq.com After adding the name to /etc/exports: [root@mondo log]# exportfs -a We added housey, now: [root@mondo log]# exportfs /share u-1.signalq.com /share srv-3.signalq.com /share […]
Point and Print in Samba
If you’re using a samba server to provide print services to Windows clients, why not take it one step further by offering point and print functionality. If you set this up, users *might* even be able to install printers themselves! At the very least it will save you time when you slave over their workstations […]
Default Admin Page for CUPS
Agatha broke her CUPS configuration when upgrading her Gentoo workstation. Simply deleting the old printer and creating a new one works. The thing about CUPS is that it just rocks, and only breaks, to our memory, during an upgrade. The configuration for the daemon is in /etc/cups/cupsd.conf. The cool web-based admin tool makes it really […]
Creating a SAN with iSCSI – Part 1 – Setting up the Target on GNU/Linux
[See This article for a newer procedure.] An iSCSI target is the server piece of an iSCSI SAN. The client piece/driver is called the initiator. We will be running the target on a GNU/Linux box with a 2.4.27 kernel, and will run the initiator on a Windows 2000 server. For our iSCSI target, we will […]
Creating a SAN with iSCSI – Part 2 – Setting up a Windows Initiator – Initial Install
We are going to create a drive that appears to the Windows 2000 operating system as a regular hard disk drive; however, this drive is actually a filesystem on a GNU/Linux box that is exported via TCP/IP using the iSCSI protocol. We created the server to do this in this article. Now, we need to […]
Creating a SAN with iSCSI – Part 3 – Setting up a Windows Initiator – Finish Install
You will see another license agreement box: If you agree, click Agree. You will be notified that the iSCSI initiator is installing: A box regarding the digital signature of the package will pop up: Click Yes if you wish to continue. If the iSCSI initiator installs successfully, you will see this box: A box with […]
Creating a SAN with iSCSI – Part 4 – Setting up a Windows Initiator – iSCSI Setup
You will see a dialog box saying the installation is complete: Click close. Open the Microsoft iSCSI Initiator program. There should be a shortcut on your desktop. If not, it is also in control panel. Open the Add Target Portal tab: The server we want is at 10.50.100.70. Click on the advanced button: The user […]
Creating a SAN with iSCSI – Part 5 – Setting up a Windows Initiator – Creating the Drive
You will see the name of the target in the box: Click Log On to connect to the drive and make it active. You will see a dialog: For now, just leave automatic restore option unchecked. Click OK. Now the available target box has the target listed as connected: Click OK and go into the […]
Creating a SAN with iSCSI – Part 6 – Setting up a Windows Initiator – Finishing Up
Our drive is detected properly now, and we have 3 gigs of unallocated space: Format the disk: If you want the drive to automatically be available at boot, check the box: Let’s copy a file over to our iSCSI drive: This drive is treated just like a hardware drive would be, but it is all […]

