Clan x86

Technical (Development, Security, etc.) => General Programming => Tutorials, References, and Examples => Topic started by: Joe on August 16, 2005, 10:41:31 AM

Title: [PHP] Basic Blog Tutorial!
Post by: Joe on August 16, 2005, 10:41:31 AM
http://www.javaop.com/~joe/php/blogtut.txt

Aimed at: People who have basic PHP + intermediate HTML knoledge.
Complexity: Simple.

Shows the for statment, arrays, echo, multiple php blocks, and echoing variables.
Title: Re: [PHP] Basic Blog Tutorial!
Post by: rabbit on August 16, 2005, 05:19:43 PM
I'd make the complexity 'simple'.  Intermediate would be manipulation of files, and advanced would be MySQL interaction.
Title: Re: [PHP] Basic Blog Tutorial!
Post by: Sidoh on August 16, 2005, 05:51:14 PM
/me agrees with Rabbit.

That's about as simple as PHP gets.

Also, you don't need to define an index.  You can just do:


$a = array();

$a[] = "First item.";
$a[] = "Second item.";
$a[] = "Third item.";


I wouldn't use the method you're using either (if I would even consider using arrays without the combination of MySQL).  I'd use multidimensional arrays.
Title: Re: [PHP] Basic Blog Tutorial!
Post by: drka on August 17, 2005, 05:51:38 AM
Quote from: rabbit on August 16, 2005, 05:19:43 PM
I'd make the complexity 'simple'. Intermediate would be manipulation of files, and advanced would be MySQL interaction.
interaction with MySQL?

that's kinda simple -_-
Title: Re: [PHP] Basic Blog Tutorial!
Post by: Sidoh on August 17, 2005, 12:28:57 PM
Yeah, but you think everything is simple.  Yet, when you look at your depth of knowledge, it's pretty shallow.
Title: Re: [PHP] Basic Blog Tutorial!
Post by: deadly7 on August 17, 2005, 01:53:20 PM
Quote from: Mangix on August 17, 2005, 05:51:38 AM
Quote from: rabbit on August 16, 2005, 05:19:43 PM
I'd make the complexity 'simple'. Intermediate would be manipulation of files, and advanced would be MySQL interaction.
interaction with MySQL?

that's kinda simple -_-
Ok. Go and code me an admin page that edits MySQL Database tables, adds new columns, and changes the type. Also, make sure you can add entries to the database as well.
Title: Re: [PHP] Basic Blog Tutorial!
Post by: rabbit on August 17, 2005, 05:35:59 PM
Done (http://www.phpmyadmin.net/home_page/).  Sorry if I spoiled it :\
Title: Re: [PHP] Basic Blog Tutorial!
Post by: deadly7 on August 19, 2005, 12:32:45 PM
Yes, but that's not exactly EASY to make.
Title: Re: [PHP] Basic Blog Tutorial!
Post by: rabbit on August 19, 2005, 01:39:08 PM
But I never said it was.
Title: Re: [PHP] Basic Blog Tutorial!
Post by: deadly7 on August 19, 2005, 02:01:18 PM
Quote from: Mangix on August 17, 2005, 05:51:38 AM
Quote from: rabbit on August 16, 2005, 05:19:43 PM
I'd make the complexity 'simple'. Intermediate would be manipulation of files, and advanced would be MySQL interaction.
interaction with MySQL?

that's kinda simple -_-

I was talking to Mangix, rabbit..
Title: Re: [PHP] Basic Blog Tutorial!
Post by: rabbit on August 19, 2005, 11:52:14 PM
Quote from: deadly7 on August 19, 2005, 02:01:18 PM
Quote from: Mangix on August 17, 2005, 05:51:38 AM
Quote from: rabbit on August 16, 2005, 05:19:43 PM
I'd make the complexity 'simple'. Intermediate would be manipulation of files, and advanced would be MySQL interaction.
interaction with MySQL?

that's kinda simple -_-

I was talking to Mangix, rabbit..
Tehn +"@Mangix", cause you were confusing.
Title: Re: [PHP] Basic Blog Tutorial!
Post by: Joe on August 20, 2005, 01:18:31 AM
// SQL database connection
echo("[DEBUG] Connecting to SQL database..<br />\n");
  $SQL_CONNECTION = @mysql_pconnect($CONFIG_SQL_HOSTNAME, $CONFIG_SQL_USERNAME, $CONFIG_SQL_PASSWORD);
if ($SQL_CONNECTION) {
    echo("[DEBUG] Connected to SQL database.<br />\n");
   
    // Open the database
  echo("[DEBUG] Attempting to open database $CONFIG_SQL_DATABASE.<br />\n");
$SQL_DATABASE = @mysql_select_db($CONFIG_SQL_DATABASE, $SQL_CONNECTION);
if($SQL_DATABASE) {
echo("[DEBUG] Now using &CONFIG_SQL_DATABASE.<br />\n");
} else {
echo("[ERROR] Unable to open database $CONFIG_SQL_DATABASE.<br />\n");
$SQL_ERROR = @mysql_error(); echo("[ERROR] $SQL_ERROR<br />\n");
}

} else {
$SQL_DATABASE = null;
  echo("[ERROR] Unable to connect to SQL database.<br />\n");
  $SQL_ERROR = @mysql_error(); echo("[ERROR] $SQL_ERROR<br />\n");
}


Well, its a start, deadly. =)
Title: Re: [PHP] Basic Blog Tutorial!
Post by: deadly7 on August 20, 2005, 12:37:38 PM
Quote from: rabbit on August 19, 2005, 11:52:14 PM
Quote from: deadly7 on August 19, 2005, 02:01:18 PM
Quote from: Mangix on August 17, 2005, 05:51:38 AM
Quote from: rabbit on August 16, 2005, 05:19:43 PM
I'd make the complexity 'simple'. Intermediate would be manipulation of files, and advanced would be MySQL interaction.
interaction with MySQL?

that's kinda simple -_-

I was talking to Mangix, rabbit..
Tehn +"@Mangix", cause you were confusing.
I quoted Mangix for a reason. nub.
Title: Re: [PHP] Basic Blog Tutorial!
Post by: drka on August 22, 2005, 07:45:31 PM
Quote from: Sidoh on August 17, 2005, 12:28:57 PM
Yeah, but you think everything is simple. Yet, when you look at your depth of knowledge, it's pretty shallow.
if you asked me how much i know PHP, i would answer "i know enough".

i dont work too much with PHP since i dont see any use for it.

oh and deadly, google up phpMyAdmin. it's really nice.
Title: Re: [PHP] Basic Blog Tutorial!
Post by: Sidoh on August 22, 2005, 07:57:58 PM
Quote from: Mangix on August 22, 2005, 07:45:31 PM
Quote from: Sidoh on August 17, 2005, 12:28:57 PM
Yeah, but you think everything is simple. Yet, when you look at your depth of knowledge, it's pretty shallow.
if you asked me how much i know PHP, i would answer "i know enough".

i dont work too much with PHP since i dont see any use for it.

oh and deadly, google up phpMyAdmin. it's really nice.

Quite honestly, I've found your knowledge of just about everything you seem to believe to be fluent in to be shallow.
Title: Re: [PHP] Basic Blog Tutorial!
Post by: Quik on August 22, 2005, 08:03:03 PM
Quote from: Mangix on August 22, 2005, 07:45:31 PM
Quote from: Sidoh on August 17, 2005, 12:28:57 PM
Yeah, but you think everything is simple. Yet, when you look at your depth of knowledge, it's pretty shallow.
if you asked me how much i know PHP, i would answer "i know enough".

i dont work too much with PHP since i dont see any use for it.

oh and deadly, google up phpMyAdmin. it's really nice.

Enough for what? I highly doubt you know "enough" of anything, including English.
Title: Re: [PHP] Basic Blog Tutorial!
Post by: Sidoh on August 22, 2005, 11:02:11 PM
/me sides with quik.
Title: Re: [PHP] Basic Blog Tutorial!
Post by: Joe on August 22, 2005, 11:30:17 PM
/me sides with the one with the sexy avatar. Wanna hook up next weekend?
Title: Re: [PHP] Basic Blog Tutorial!
Post by: Sidoh on August 23, 2005, 12:02:52 AM
I've always had a fetish for the letter "X," thus I love Mangix's avatar.

</sarcasm>
Title: Re: [PHP] Basic Blog Tutorial!
Post by: Blaze on August 23, 2005, 02:39:07 AM
<?php

echo " 'and all shall fall, was they run into the wall' ";

?>

I know php, look at me!
Title: Re: [PHP] Basic Blog Tutorial!
Post by: drka on August 23, 2005, 09:00:20 AM
Quote from: Quik on August 22, 2005, 08:03:03 PM
Quote from: Mangix on August 22, 2005, 07:45:31 PM
Quote from: Sidoh on August 17, 2005, 12:28:57 PM
Yeah, but you think everything is simple. Yet, when you look at your depth of knowledge, it's pretty shallow.
if you asked me how much i know PHP, i would answer "i know enough".

i dont work too much with PHP since i dont see any use for it.

oh and deadly, google up phpMyAdmin. it's really nice.

Enough for what? I highly doubt you know "enough" of anything, including English.

if i didnt know english, then i wouldnt be able to write, speak, or understand it.

@sidoh:get avant browser if you dont have it :P
Title: Re: [PHP] Basic Blog Tutorial!
Post by: deadly7 on August 23, 2005, 10:33:50 AM
Quote from: Mangix on August 22, 2005, 07:45:31 PM
Quote from: Sidoh on August 17, 2005, 12:28:57 PM
Yeah, but you think everything is simple. Yet, when you look at your depth of knowledge, it's pretty shallow.
if you asked me how much i know PHP, i would answer "i know enough".

i dont work too much with PHP since i dont see any use for it.

oh and deadly, google up phpMyAdmin. it's really nice.
You said "mysql interaction is easy", at which point I told you to code me something like phpMyAdmin. I have used cPanel for the last 3 years,  i am aware that it exists so shut it.
Title: Re: [PHP] Basic Blog Tutorial!
Post by: drka on August 23, 2005, 12:54:14 PM
it's simple. however to create a program like phpMyAdmin takes time. time which i dont like spending on something that a lot of people will not use. even if it is better than phpMyAdmin.
Title: Re: [PHP] Basic Blog Tutorial!
Post by: Quik on August 23, 2005, 01:08:02 PM
Step 1: Visit http://www.phpmyadmin.net/home_page/
Step 2: Get source.
Step 3: Put your name on it, and release.
Title: Re: [PHP] Basic Blog Tutorial!
Post by: Joe on August 23, 2005, 01:31:02 PM
Step 4: Get busted by the GNU cops (Its not public domain, is it?)
Title: Re: [PHP] Basic Blog Tutorial!
Post by: drka on August 23, 2005, 03:02:06 PM
it's GPL

that's an evil idea quik ;)
Title: Re: [PHP] Basic Blog Tutorial!
Post by: Joe on August 23, 2005, 03:04:38 PM
You, sir, are an evil idea.
Title: Re: [PHP] Basic Blog Tutorial!
Post by: Newby on August 23, 2005, 05:23:38 PM
Avant Browser is goddamn shit. It sits right over IE.
Title: Re: [PHP] Basic Blog Tutorial!
Post by: Sidoh on August 23, 2005, 05:46:21 PM
IE works fine for me, thanks.  I have firefox and have used it plenty, I always end up switching back to IE after a few hours.

Anyway, Mangix.  Especially with your current knowledge, you'd never be able to make something that had near the capability phpMyAdmin has.  Just shut face, there's no use arguing.