00:00
00:00
Newgrounds Background Image Theme

Our goal is for Newgrounds to be ad free for everyone! Become a Supporter today and help make this dream a reality!

Php: Main

112,828 Views | 562 Replies
New Topic Respond to this Topic

Response to Php: Main 2005-11-14 22:15:55


At 11/14/05 10:01 PM, Greeley wrote: I still need to understand strings, arrays, and some functions abit more. I'll understand it all over time.

Strings are one of the most simple concepts a human can comprehend. Since PHP doesn't have a method of discerning between single characters (char) and multi-character strings (string) then everything that contains quotes is a string. Well, that's a nice general rule to use.

You know, in C/C++ 'b' is a char while "hello" is a string.

Arrays are pretty easy also. Using predefined functions isn't much different than using simple constructs such as echo. If you're building your own functions I find it a lot simpler than building them in other languages such as C/C++.

In php, while defining your own function there is no return type that must be specified; however, I also make a note showing the return type so I know how to use the function in later programs.

If you're used to a C language you can think of the function keyword as the return type. You declare a function in php like this:

function func_name(argument list) {
function code
}

Here is a basic function that just renames echo to show_output and turns the construct into a function which an optional return parameter.

function show_output($string, $return = 1) {
if ($return == 0) {
return$string;
} else {
echo $string;
}
}

Okay, this is a nice feature because we can have a void return type if the statement is echoed or we can have a string return type if return is set to false.


Merkd.com - It Pays to Play

Earn real money by betting and investing; or, sponsor, challenge, compete,

recruit, communicate, network, earn money playing games, and much more.

Response to Php: Main 2005-11-14 22:18:25


I'm writing a tutorial on how to write your own functions so no one else take it please!


Merkd.com - It Pays to Play

Earn real money by betting and investing; or, sponsor, challenge, compete,

recruit, communicate, network, earn money playing games, and much more.

Response to Php: Main 2005-11-15 21:44:57


Thankyou for the help man... I never really knew what a string was exactly but you are right... it's quite the easiest thing and I was using them without even knowing what they were called!

Response to Php: Main 2005-11-20 18:40:09


Someone write some more tutorials so I can learn some more from the newgrounds users. :P

Response to Php: Main 2005-11-20 19:14:30


At 11/20/05 06:54 PM, PillowBiter wrote: This shit is way too basic, I'm going to write a real one in a bit.

Learning Basics is essential before going onto harder stuff!

Response to Php: Main 2005-11-20 23:12:36


At 11/20/05 06:54 PM, PillowBiter wrote: This shit is way too basic, I'm going to write a real one in a bit.

What do you mean a "real one"?

Learning Basics is essential before going onto harder stuff!
At 11/20/05 07:14 PM, Greeley wrote: Learning Basics is essential before going onto harder stuff!

Exactly. If you don't understand the basics, and you go on to harder stuff, you're screwed.

Response to Php: Main 2005-11-21 00:42:07


At 11/20/05 11:12 PM, GamesCool wrote: Exactly. If you don't understand the basics, and you go on to harder stuff, you're screwed.

Exactly, and that is why I hate it when people post in forums asking how to make a portal because they are getting in WAY over there heads.

Response to Php: Main 2005-12-01 02:37:14


Umm i will make a forum with all these link in it so it wont get lsot and it wont keep getting posted over and so i can edit it just puyst every single tut ina reply and ill host it then ill host AS main then all the rest

Response to Php: Main 2005-12-01 15:38:26


At 12/1/05 02:37 AM, keifer_kjm wrote: Umm i will make a forum with all these link in it so it wont get lsot and it wont keep getting posted over and so i can edit it just puyst every single tut ina reply and ill host it then ill host AS main then all the rest

I could do the same thing by hosting it on my site, but I'm not sure what that would acheive. No one would find it from the BBS.

Also, I will be adding more tutorials in the near future, so it wont get lost.

Response to Php: Main 2005-12-01 15:42:18


Someone should do a tutorial on making PHP Polls. (for voting)

Response to Php: Main 2005-12-02 00:03:08


But just incase ya know i do have my ownwebsite im working on it wihtFlashKid And AuthorBlues

Response to Php: Main 2005-12-02 00:09:33


I dont see any PHP : Using a mySQL Database ^^
I think I'll make one since I'm bored and it's the only thing I know in PHP :P

Response to Php: Main 2005-12-02 00:10:35


At 12/1/05 03:42 PM, JeremysFilms wrote: Someone should do a tutorial on making PHP Polls. (for voting)

I'll try to put one together if I can find enough time. Can anyone else make it?

Response to Php: Main 2005-12-02 00:11:42


At 12/2/05 12:09 AM, -KhAo- wrote: I dont see any PHP : Using a mySQL Database ^^
I think I'll make one since I'm bored and it's the only thing I know in PHP :P

Awesome! I can't wait to see it. It will really help a lot of people.

Response to Php: Main 2005-12-02 02:16:42


At 12/1/05 03:42 PM, JeremysFilms wrote: Someone should do a tutorial on making PHP Polls. (for voting)

Eh, you just need to know some very basic html forms, learn how to use echo in php, and also learn how to use a database :P
Seriously though, I think it can be simply done with forms and echo, and probably the post method.


BBS Signature

Response to Php: Main 2005-12-02 09:30:51


At 12/2/05 02:16 AM, -Toast- wrote:
Seriously though, I think it can be simply done with forms and echo, and probably the post method.

The poll results still have to be stored somewhere, either in a database or a text file.


BBS Signature

Response to Php: Main 2005-12-02 12:01:22


At 12/2/05 09:30 AM, Afro_Ninja wrote: The poll results still have to be stored somewhere, either in a database or a text file.

Isn't it a bit what I said?

At 12/2/05 02:16 AM, -Toast- wrote:
and also learn how to use a database :P

BBS Signature

Response to Php: Main 2005-12-02 12:25:34


At 12/2/05 12:01 PM, -Toast- wrote:
At 12/2/05 02:16 AM, -Toast- wrote:
and also learn how to use a database :P

Sorry, didn't see that. Flat files were worth a mention anyway =)


BBS Signature

Response to Php: Main 2005-12-02 13:06:26


What are flat files? Never heard about it...


BBS Signature

Response to Php: Main 2005-12-02 13:21:26


At 12/2/05 01:06 PM, -Toast- wrote: What are flat files? Never heard about it...

Flat files are basicaly text files that are stored on the server, and you can store data in them. They are not really secure unless you put it above the root directory on the server, otherwise they could be opened by anyone.

A database is a better secure and more usable option.

Response to Php: Main 2005-12-04 20:41:44


i need help with special characters.. =(

what im doing is sending data from flash to a php script then from the php save the data to a txt file then get flash to load that data back from the txt file

it works 90%... =(
it sends fines
but dosnt save fine
ergo it cant lad to well

this is the data that im sendin
'<font color="#DCC81C"><b>"+name.name+"</b></font
><br>'

the problem is when php gets that info it turns the " into \" and then that screws it up for flash =(

any way what im asking is, is there a way of stopping " turning into \"?

Response to Php: Main 2005-12-04 21:25:22


When, you pull the data out, before you output it for flashes use, try stripslashes()

Response to Php: Main 2005-12-05 16:41:09



BBS Signature

Response to Php: Main 2005-12-05 16:52:45


PHP: GENERAL CODE:

BEGINNER (2)
PHP: Beginners tutorial by GamesCool
PHP: Website Progress/Percentages by Greeley

INTERMEDIATE (3)
PHP: file uploads by Pilot-Doofy
PHP: securing file uploads by Pilot-Doofy
PHP: Using explode and implode functions by GamesCool

PHP: SPECIFIC PROJECTS:

BEGINNER (1)
PHP: Create a random quotes script by GamesCool

INTERMEDIATE (1)
PHP: Random quote image by GamesCool

PHP: USEFUL RESOURCES:

BEGINNER (1)
PHP: Rapid Website Development by Sir-Davey

Total number of tutorials: 8

Response to Php: Main 2005-12-14 07:32:06


Starting to grow, a bit lol.

I might make a PHP: Tutorial later. :-)


"Actually, the server timed out trying to remove all your posts..."

-TomFulp

Response to Php: Main 2005-12-14 14:56:28


At 12/14/05 07:32 AM, IWantSomeCookies wrote: Starting to grow, a bit lol.

I might make a PHP: Tutorial later. :-)

Cool. I hope you do decide to make one.

At 12/14/05 07:37 AM, Zendra wrote: It's good things are listed. But maybe a nice idea for the sticky we might get here: how about there's also a list - which is updateable - about the PHP Main topic. So people can see what kinda of tutorials have been made and there's a better listing.

If you do it within a Newgrounds topic, you can't edit posts. Afro-Ninja informed me that moderators cannot edit posts, so it wouldn't be possible to update a list like that. If they make a sticky it can just link to PHP: Main.

Response to Php: Main 2005-12-14 20:27:00


At 12/14/05 03:36 PM, Zendra wrote:
At 12/14/05 02:56 PM, GamesCool wrote: If you do it within a Newgrounds topic, you can't edit posts. Afro-Ninja informed me that moderators cannot edit posts, so it wouldn't be possible to update a list like that. If they make a sticky it can just link to PHP: Main.
I am talking about a that it's in the sticky, where it's updateable. So one or a moderator can edit the list of new tutorials, so it's all listed easy for new users.

He basically means it'll be like the rules sticky. Or maybe even like the new to flash stick in the flash forums. It gives a list of tutorials and stuff. That way it'd be way easier to learn. I think that'd be a good idea. I'm going to try and make up a tutorial some time tonight. Just something basic once again. Gotta start little.

Response to Php: Main 2005-12-14 20:33:43


At 12/14/05 08:27 PM, Greeley wrote: He basically means it'll be like the rules sticky. Or maybe even like the new to flash stick in the flash forums. It gives a list of tutorials and stuff. That way it'd be way easier to learn. I think that'd be a good idea. I'm going to try and make up a tutorial some time tonight. Just something basic once again. Gotta start little.

OK, that sounds good. I'm not sure how we can get that done, but it would be pretty cool.

At 12/14/05 08:27 PM, Greeley wrote:

I'm going to try and make up a tutorial some time tonight. Just something basic once again. Gotta start little.

Great! Your last tutorial about the percentages was very good. It doesn't matter if the tutorial is basic, we just want to keep on adding any kind of tutorial.

Response to Php: Main 2005-12-14 20:36:33


This is looking pretty good. I got a few tutorials in mind, including Paypal and PHP, WHM and PHP, and maybe PHP GTK basics(Yes, PHP supports GTK) if I get it installed on my computer and actually look into it. I have had a bitch of a time with it. So, nobody take those ones.

Response to Php: Main 2005-12-15 00:14:49