Misc Links
Forum Archive
News Archive
File DB
 

Ads
 

Advertisement
Age of Valor - Ultima Online Free Shard
AoS/SE/ML/Custom - advanced code, dedicated staff, peerless bosses, non overpowered customs + much much more
 

Latest Forum Topics
Vmware Shifts Pricing Strategy
Posted by Red Squirrel
on Sep 02 2010, 7:09:04 pm

Badass Chipmunk
Posted by Triple6_wild
on Sep 01 2010, 1:06:15 am

Evony Farming And Building Helper Tool
Posted by Red Squirrel
on Sep 01 2010, 4:40:12 pm

I Just Thought Of A Cool Invention
Posted by rovingcowboy
on Aug 31 2010, 12:21:50 am

Shocks Dangerous?
Posted by Triple6_wild
on Aug 30 2010, 10:26:12 pm

 



Send spam to: website@xeonlive.com nick@xeonlive.com georgiapeach1241@aol.com
Php how-to for starters
Taking web design to the next extreme
By Red Squirrel


More on variables
$_GET and $_POST alone don't contain any value, however, if you add a name at the end, that name can contain a value. For example $_GET[act] contains a value. But $_GET alone does not. $_GET[act2] contains another etc... When a variable has not been assigned a value, it is equal to nothing, it is just empty data, or null. Usually referred as "" when using an if statement and such.

In some more complicated scripts, you want to use more then the $_GET and $_POST. To add a value to your own variable you simply need to go like this:

$variablenume = "value";

Because of the quotes, value is static text, but you can also go like this:

$variablename = $_POST[name];

This would simply give $variablename the same value as $_POST[name], so if you plan to use that often, it saves you from typing the longer one.

You can also combine variables like you can to text with echo:

$variablename = "age: ".$_POST[age];

Variables are not only restricted to text, but also numbers. What's nice about php is that numbers and text mix well and you don't have to worry about converting back and forth. If you have a form with a text field called "a" and a text field called "b" you can do the addition like this:

$answer = $_POST[a]+$_POST[b];

And $answer would be equal to whatever the typed in numbers would add up to. Typing text in this case could lead to unwanted results, but unlike C++, it would not make the script go wild, it would just give 0 in most cases.

There is allot to learn about php because there are many functions that can do cool stuff, but I won't cover it all, however, there's one more thing that may be good to know, and it will be explained on the next page.


Next Page
spacer
34149 Hits Pages: [1] [2] [3] [4] [5] 28 Comments
spacer


Latest comments (newest first)
Posted by halojoy on June 06th 2005 (21:36)
Yes, it is nice with scripts that does note produce notices.
isset is a good way to avoid this,
if you do not want to add a lot of code that sets 'empty' values for variables

Another way is to TURN OFF reporting of NOTICE
you add this, at top (beginning) of your php pages:
CODE
<?php

// Report ALL, but not NOTICE
error_reporting ( E_ALL & ~E_NOTICE );

// You will still get WARNINGS and other real ERRORS
// Notice is not an error, just a note
// To not have to add it in all your pages you can make it a line in 'config.php' ,
//  if you have such a file, that is included by php pages
?>
I use E_ALL = reporting with notices only when working with my code
When I am finished and put my code on website, I Turn Notice OFF, using that line.
I do not want to scare my visitors laugh.gif

spacer
Posted by Red Squirrel on November 11th 2004 (13:13)
You need to run it off a webserver that has php installed.

So you would type http://serverhost/script.php


spacer
Posted by Red Squirrel on October 10th 2004 (15:32)
It means you have a syntax error in your mysql query, unfortunatly mysql is not very helpful at telling WHAT the error is, so you'll have to figure that part out. Post the query and maybe I can look at it and find the problem.
spacer
Posted by jewboy419 on October 10th 2004 (14:34)
pressanykey.gif i am doing a php on euoropean lycos and i get an error when using this code: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near" the first line of the code... can' anyone help!!!
spacer
Posted by sintekk on October 10th 2004 (10:18)
QUOTE (Red Squirrel @ Jul 6 2004, 08:41 PM)
Tripod actually has php amd mysql? That's cool, I did not know that.

Only the European lycos, the US one still believes that everybody that wants a website with them just wants to make a Hillary Duff fan page laugh.gif

...now only if there was a free ColdFusion host out there sad.gif...

spacer
View all comments
Post comment


Top Articles Latest Articles
- What are .bin files for? (592341 reads)
- Big Brother and Ndisuio.sys (143053 reads)
- PSP User's Guide (127666 reads)
- Text searching in linux with grep (115018 reads)
- SPFDisk (Special Fdisk) Partition Manager (101077 reads)
- Dynamic Forum Signatures (version 2) (4640 reads)
- Successfully Hacking your iPhone or iTouch (14321 reads)
- Ultima Online Newbie Guide (25017 reads)
- BBcode editor: PHP - The sensible approach (17877 reads)
- The Hitch Hikers guide to "the mouse" (15273 reads)
corner image

This site best viewed in a W3C standard browser at 800*600 or higher
Site design by Red Squirrel | Contact
© Copyright 2010 Ryan Auclair/IceTeks, All rights reserved