Misc Links
Forum Archive
News Archive
File DB



Latest Forum Topics
wow 56 k modems are
Posted by Red Squirrel
on Oct 14 2013, 11:52:23 pm

I Need A Program
Posted by rovingcowboy
on Sep 23 2013, 5:37:59 pm

having trouble witn lan
Posted by rovingcowboy
on Sep 23 2013, 5:40:56 pm

new problem for me
Posted by rovingcowboy
on Sep 23 2013, 5:54:09 pm

RBC Royal Bank
Posted by Red Squirrel
on Aug 13 2013, 6:48:08 pm


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
395481 Hits Pages: [1] [2] [3] [4] [5] 28 Comments

Latest comments (newest first)
Posted by halojoy on June 06th 2005 (22: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:

// 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

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

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

Posted by Red Squirrel on October 10th 2004 (16: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.
Posted by jewboy419 on October 10th 2004 (15: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!!!
Posted by sintekk on October 10th 2004 (11: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...

View all comments
Post comment

Top Articles Latest Articles
- What are .bin files for? (669062 reads)
- Text searching in linux with grep (161180 reads)
- Big Brother and Ndisuio.sys (150471 reads)
- PSP User's Guide (139547 reads)
- SPFDisk (Special Fdisk) Partition Manager (117240 reads)
- How to Use MDADM Linux Raid (188 reads)
- What is Cloud Computing? (1225 reads)
- Dynamic Forum Signatures (version 2) (8769 reads)
- Successfully Hacking your iPhone or iTouch (18714 reads)
- Ultima Online Newbie Guide (35906 reads)
corner image

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