Jump to content

Check out our Community Blogs


Member Since 08 Nov 2011
Offline Last Active May 07 2012 07:12 AM

Topics I've Started

Hand coding vs. Druapl; help?

28 February 2012 - 07:17 AM

I'm stuck in the middle of a tight situation. I'm currently building a website for my Computer Science teachers friend, who I believe used to be a teacher for my school district. The website is supposed to be an interactive calendar for their vacation home. The objective is for them to be able to add/edit/delete events on the calendar, so they can plan their family visits on a website.

The situation is that my Computer Science teacher recommends using Drupal for this project, by using Drupal's modules, and skipping all of the coding. I don't like the idea of Drupal because I, as a developer, enjoy writing code.

I have lack of knowledge of Drupal, aside from it's easy to use, and there can be absolutely no coding at all (unless you choose to). Would it be wort it to use Drupal? Or would it be better (ex: experience) for me to write it all, and coded?

Thank you in advanced, CodeCall,


Delete MySQL Field - HTML Table

26 February 2012 - 02:58 PM

Hello all of CodeCall reading this;

First of all, I'd like to apologize if this is a tutorial that may have already been posted in the past, for I have not read back through the pages. If so, in my defense, it may be good to have another recent post for this, for new users not having to search/go through many, many pages. This is also my first tutorial, so I hope it's easy to understand and it helps if you were looking for something like this, or it would be of use to you. :) NOW, on to the tutorial:

Notepad and Notepad++ - Your choice
First off, I'd recommend downloading the latest version of Notepad++ so you can follow along with the tutorial, and not just copy/paste it into your page. Doing it this way, you will learn to write PHP - not learn how to copy and paste other code.

If you'd rather not download and install, you can do this in Notepad ( XP: Start > Run > Notepad, Vista+: Start -> Search bar -> Notepad). If you'd like to use Notepad++, you can download it from the official website here, by clicking this link.

On To The Code
As we go through the code, I will explain what I am doing, use comments in the code, explaining and breaking down what every piece does :)

Connect to the database (database.php)

$connect = mysql_connect("localhost","db_user","dbpassword"); // this is selecting which database you want to use, with a variable (for later in the code), and using the mysql_connect function to let the code know you want to connect

if (!$connect) // using and if statement to see if the connection is incorrect, and display a mysql_error() message, which lets the user know what the issue is, and then exit the code with die()
die('Could not connect: ' . mysql_error());

mysql_select_db("database_name", $connect); // this is selecting the database itself from $connect... which is the variable we created at the beginning of the script... make sure you replace "database_name" with your database, as well as the information provided in $connect

// finally, we end the PHP script for database.php

display.php - displaying the results

include("database.php"); // include the database file with the include() function.... make sure if you make an includes folder (for those who do) to set the path: include("/path/database.php");

$infoGrab = mysql_query("SELECT * FROM your_table"); // this is taking everything (*) from whichever table you want, from the selected database in database.php, which we included.

echo "<p><b>Information to Delete</b></p>"; // displaying a title (optional), above the table
echo "<table border = '1' cellpadding = '10'>"; //starting off the table
echo "<tr><b><i><th><font color='purple'>Field One:</font></b></i></th> <th><b><i><font color='blue'>Field Two:</font></b></i></th> <th><b><i><font color='green'>Field Three:</font></b></i></th> <th><b><i><font color='red'>Delete File</b></font></i></th></tr></b></i>"; // this is setting the table labels (above the data), with style/color (<b>, <i>, <font> are optional tags)

while ($Row = mysql_fetch_array($infoGrab)) { //while variable $Row = getting data from $infoGrab, which was selecting everything from your selected table
$ID = $Row['id']; // use the ID (should be PRIMARY and AI - auto increment) for specific deleting
$secondVariable = $Row['field_two']; // the second field and variable (after the ID variable)
$thirdVariable = $Row['field_three']; //the third field
$fourthVariable = $Row['field_four']; // the fourth variable

echo "<tr>
<td><b><i><font color='purple'>{$secondVariable}</font></b></i></td> // showing the field after ID
<td><b><i><font color='blue'>{$thirdVariable}</font></b></i></td> //showing the next field
<td><b><i><font color='green'>{$fourthVariable}</font></b></i></td>"; //showing the next field
echo "<td><a href='deleted.php?id='{$ID}'><img src='images/delete.png' width='25' height='25' /></a></td>"; //showing the delete button (feel free to use the delete icon attached, or use plain text instead of <img src>


//end the script

deleted.php - deleting the item

if (isset($_GET['id']) && is_numeric($_GET['id'])) { // if the ID is set (isset) and is a number (is_numeric)
$ID = $_GET['id']; // variable ID is getting the ID from the form

$Delete = mysql_query("DELETE * FROM table WHERE id='{$ID}'"); // deleting the specific ID ($ID)

// next you can pretty much echo (display) any successful delete message you want...

echo "<p>Deleted successfully.</p>"; // any message
echo "<p><a href='../index.php'>Return Home</a></p>"; // link or text optional

} else { //something goes wrong(?), display error
echo "<p>Error code #7</p>"; // you can use any error message or 'code' you want

// ending the if and else so we don't get a buggy unexpected $end

// ending the script

Thanks, readers!
I hope you enjoyed the tutorial, and I hope it comes of use to what you may be looking for. :)


Html5 - rome

25 February 2012 - 06:59 AM

Hey all... I know this isn't the HTML5 forum (before you tell me :P)... but it's more of a recreational website that I was shown, not too much about coding. From what I was told, and from what it looks like, the whole project was made in HTML5, as well as using WebGL. I was actually shown this website by a software engineer, of nearly 20+ years, who currently programs medical equipment for a living. I am an administrator on his website, and I talk to him often. I'll give you a little background knowledge as well, but feel free to skip to the URL if you'd like. :)

{Read Before Skipping To URL}
The only downside to this, is that you need a powerful graphics card, and Google Chrome - as the project was partnered up with Google. As you can find at the bottom "Made with friends from Google", or something along the lines of that. You can move your mouse up and down, move it from left to right, and click to interact and move the camera view.

{{Done Rambling}} :P

URL: Three Dreams of Black - ROME

Sorry for the big post about this, but it really is incredible to see what can be done.


Ski/Snowboard, anyone?

24 February 2012 - 03:43 PM

Do you ski? Do you snowboard? As some of you may have seen (at the side of the posts), I live in CO... So naturally I board :P It's just a part of Colorado, skiing and boarding.

Does anyone here ski or snowboard where they are from? :) Reason I'm posting this is because I'm actually on a mobile device coming down from boarding - bored in the car.... Post up! I'm interested in what other fellow programmers are interested in... :)


JavaScript help?

23 February 2012 - 09:15 AM

Dear JS Gurus;

I need a little help with JavaScript - since I do not have experience with it and I am just learning it now... I need help making a script that enlarges and image on a mouse over event.

I've done a little research over Google, but didn't find anything that I was really looking for. I'm building a website where I am taking only JPG's from a MySQL database, and displaying them with HTML image source (<img src>), because the file path is stored, it is not a BLOB.

{Quick Question: Will I need a separate thumbnails file folder for this? Or is it possible to use the <img src> to shrink the image to (for example) 25 x 25, and then enlarge it with JavaScript?}

If you find a useful link that could have what I am looking for, it would be greatly appreciated! Any other help would also be appreciated (such as snippets, code help, etc).

Thanks in advanced, I hope someone can help me here...

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download