...

View Full Version : Need More php Experience



rafiki
08-28-2006, 02:51 PM
Hi ppl im looking for a bit of php experience ive read all the tutorials and made some simple scripts, plz reccomend some simplish scripts i should try and create!

thanks
Rafiki

IvanJ
08-28-2006, 03:06 PM
There's the ever-popular login script. Also, I started out by connecting to a database and maintaining user-state (login session). Stuff like this never gets old. Also, you can look into the different methods of reading XML files.

I haven't had time to mess with it (plus i've moved into a .NET/Java approach) so I haven't spent much time with PHP in a while, but you can look into phpBB. It reeks of PHP.

Good luck.

rafiki
08-28-2006, 05:09 PM
Thanks ivan a little to advanced atm, im just looking for simple scripts that may or may not be used, but have some use and functionality and simpleish to script as a newbie php coder

Spookster
08-28-2006, 05:33 PM
Ok write a script to randomly display images from a directory.

rafiki
08-28-2006, 06:18 PM
Thanks mate, its still a little advanced, so may need a lot of corrections

but would sumthin like this be worthy of trying?


<?php

//hopefully a image rotator

function rand(1,2,3);
{
if rand == 1;
print "<img src="/1.gif">";
if rand == 2;
print "<img src="/2.gif">";
if rand == 3;
print "<img src="/3.gif">";
}
?>

im not really expecting htis to work coz every other 1 i haev seen has been a lot longer coding wise ty anyways

Mwnciau
08-28-2006, 06:54 PM
hmmm :rolleyes:



<?php

//hopefully a image rotator

function rand(1,3);// rand(1,2,3); would cause an error, too many arguments, heres the proper way to use it: rand($min_number, $max_number);
{
if (rand == 1){ // the comparison has to be in brackets and then you have to open the curly brackets {
print "<img src=\"1.gif\">"; // the " you were using closed the opening "... use a \ before to stop the php functions
}// close curly crackets
}
?>

rafiki
08-28-2006, 07:53 PM
Thanks, you got any more ideas for scripts i could write for practice and to get slightly more advanced?
thanks

Mwnciau
08-28-2006, 08:04 PM
What I would do is go through this forum, find a problem then try to fix it, then after look at the solution

rafiki
08-28-2006, 08:12 PM
What I would do is go through this forum, find a problem then try to fix it, then after look at the solution
i was thinking of that but then there are some very advanced scripts needing fixes on this site and i am not at that level of php coding yet!
although anything i feel i could try and fix whilst browsing this site i will give it ago, atm i'd rather say ... here is a scripts thats easy to write and a lot of people would be able to help you with...
thanks for idea though
Rafiki

mlseim
08-28-2006, 08:37 PM
I sort of do the same thing ....

I'll throw in my solution to a question, and then get "spanked" by the seasoned
programmers. But I don't mind. I learn something new each time.

My coding is getting better and better. Some of the problems listed are
sort of beyond my abilities though. But that's what makes this forum so good.

The important thing is to check your ego at the door and accept criticism like
water on a duck's back. Expert programmers like to point out mistakes, but
that will be to your advantage ... take whatever information they give out.

Mwnciau
08-28-2006, 09:18 PM
The other things I did when I was at your level of PHP is think of something that I know is possible in PHP and looked up the functions... Though if you look at the harder subjects on the forums some of them aren't actually that hard, and you kind of get used to them...

P.S What can you do with PHP at the moment? It will help with the suggestions.

rafiki
08-28-2006, 09:49 PM
i'll give that a try but a few pages back (think it was 11) i seen this for thread for redirection
i thought of a jump_id or something like that....
<?php
$id = array ( $id['1'] = "http://google.com"; $id['2'] = "http://yahoo.co.uk"; $id['3'] = "http://codingforums.com";)
if($id == 1)
print "header( 'Location: $id['1']' ) ;"
?>

the outcome should be that
http://members.lycos.co.uk/jaysphp/redirect.php?id=1 would redirect u to the website "google.com" please leave ur views or corrections

thanks
rafiki

Mwnciau
08-28-2006, 10:06 PM
Hmmm people would usually use this (easier):



switch ($id){
case 1:
header('Location: ' . $link1);
case 2: //etc...

or:


header('Location: ' . $link[$id]);

(btw header is a php function so you dont echo it)

rafiki
08-29-2006, 01:18 AM
Thanks for the help Mwnciau
can u think of any other scripts i should be able to write with my little knowledge?

Mwnciau
08-29-2006, 02:23 AM
try this (http://en.wikibooks.org/wiki/Web_Design/Dynamic_Websites/PHP_Challenges)

rafiki
08-29-2006, 01:52 PM
Thanks that should keep me busy for a few days :)

Ill post a link to the webpage when i finished it



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum