•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 427,379 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,013 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 5818 | Replies: 19
![]() |
•
•
Join Date: Sep 2004
Location: Delaware, USA
Posts: 417
Reputation:
Rep Power: 5
Solved Threads: 0
Alright, PHP Beginner here. I was just wondering, does anybody know of any good PHP books out there and if so, can you recommend one to me that has both help with PHP and MySQL?
I know some parts of PHP, such as the opening and closing tags (<?php and ?>) and the include, require_once, require and all of them and the if statement. But thats about it. I think this could count good for a beginner:
[PHP]
<?php
include("world.html");
// NOT A REAL CODE
if ($HTTP_POST_VARS = . '2' . == This part is for the expression);
{ Statement would go inside of
this place right here with the brackets surrounding it
}
?>
[/PHP]
Well, that should tell a little about what I know. Anybody think they could tell me if thats a good start for a beginner. The above is not intended to be a piece of code, just what I know.
I know some parts of PHP, such as the opening and closing tags (<?php and ?>) and the include, require_once, require and all of them and the if statement. But thats about it. I think this could count good for a beginner:
[PHP]
<?php
include("world.html");
// NOT A REAL CODE
if ($HTTP_POST_VARS = . '2' . == This part is for the expression);
{ Statement would go inside of
this place right here with the brackets surrounding it
}
?>
[/PHP]
Well, that should tell a little about what I know. Anybody think they could tell me if thats a good start for a beginner. The above is not intended to be a piece of code, just what I know.
•
•
Join Date: Feb 2003
Location: London, England
Posts: 281
Reputation:
Rep Power: 7
Solved Threads: 6
Not exactly....
a) $HTTP_POST_VARS are out dated, use $_POST now; and
b) If you use comments to show things in REAL code, people will pick up what you're doing far faster than if you confuse them with fake code.
For example, you could so something like...
[php]
<?php
/* We'll start by showing the top of the page. We've already created the TOP of the page and saved in in a file called header.html (in the same directory as this file). We can use the include() function to 'include it' at the top of our page as follows: */
include('header.html');
// Now we will check, did the user find the secret page?
// We can do this using an IF block as follows:
if( $_GET['found_secret'] == 'yes' )
{
// Here we can do what we want for our 'secret page'.
// The user can get here by adding ?found_secret=yes to the
// end of the page's URL. This part of the code, the bits
// between the curly brackets, is only 'read' by the PHP engine
// if the above statement is true.
echo 'You found our secret <br />';
}
// Output footer...
include('footer.html');
?>
[/php]
This could form a thrid or fourth tutorial in PHP, introducing IF blocks.
a) $HTTP_POST_VARS are out dated, use $_POST now; and
b) If you use comments to show things in REAL code, people will pick up what you're doing far faster than if you confuse them with fake code.
For example, you could so something like...
[php]
<?php
/* We'll start by showing the top of the page. We've already created the TOP of the page and saved in in a file called header.html (in the same directory as this file). We can use the include() function to 'include it' at the top of our page as follows: */
include('header.html');
// Now we will check, did the user find the secret page?
// We can do this using an IF block as follows:
if( $_GET['found_secret'] == 'yes' )
{
// Here we can do what we want for our 'secret page'.
// The user can get here by adding ?found_secret=yes to the
// end of the page's URL. This part of the code, the bits
// between the curly brackets, is only 'read' by the PHP engine
// if the above statement is true.
echo 'You found our secret <br />';
}
// Output footer...
include('footer.html');
?>
[/php]
This could form a thrid or fourth tutorial in PHP, introducing IF blocks.
•
•
Join Date: Oct 2004
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
dear sir,
i am a beginner who just got great interest in anything related to computer.I got a website thuz marcarnar.com built for me by my friend;all because of the zeal in me towards having one.My friend travelled abroad inturn left me back to my inexperience idea about continiung working on my website.He introduced php to me as the best programme for making a web and i believe him but there isnt any idea for me to continue this.....what am i suppose to do........?I explore ur website but despite different kinds of programming terms i cant understand make me more confuse.
kindly be of help
MarCarNar Alan.
i am a beginner who just got great interest in anything related to computer.I got a website thuz marcarnar.com built for me by my friend;all because of the zeal in me towards having one.My friend travelled abroad inturn left me back to my inexperience idea about continiung working on my website.He introduced php to me as the best programme for making a web and i believe him but there isnt any idea for me to continue this.....what am i suppose to do........?I explore ur website but despite different kinds of programming terms i cant understand make me more confuse.
kindly be of help
MarCarNar Alan.
•
•
Join Date: Sep 2004
Location: Delaware, USA
Posts: 417
Reputation:
Rep Power: 5
Solved Threads: 0
•
•
Join Date: Sep 2004
Location: Delaware, USA
Posts: 417
Reputation:
Rep Power: 5
Solved Threads: 0
•
•
Join Date: Feb 2003
Location: London, England
Posts: 281
Reputation:
Rep Power: 7
Solved Threads: 6
Well you'll have to tell me what level of experience you have... for example, would you recognise what the hereafter inserted code block does?
[php]<?php
echo 'Hello, world!';
?>[/php]
[php]<?php
echo 'Hello, world!';
?>[/php]
•
•
Join Date: Sep 2004
Location: Delaware, USA
Posts: 417
Reputation:
Rep Power: 5
Solved Threads: 0
•
•
Join Date: Sep 2004
Location: Delaware, USA
Posts: 417
Reputation:
Rep Power: 5
Solved Threads: 0
I wonder if this will work, can somebody give a test run and tell me:
[PHP]
<?php
// Process out the header portion of the page
include("header.htm");
// Connect to the database - DO NOT forget to change the user and
// password parts to your right information
$link = mysql_pconnect ("localhost", "mysql_user", "mysql_passowrd")
or die("Could not connect: " . mysql_error());
// Now lets create the database, if it is done successfully, it will say so, if
// not it will tell that it was not.
if (mysql_create_db("my_db")) {
print("Database created successfully\n");
}
else {
printf ("Error creating database: %s\n", mysql_error());
}
// Process out the footer portion of the page
include("footer.htm");
?>
[/PHP]
The above code should create a database, I didnt make this code, I actually copied it, but if it works, I want to change it around some and then see if it works.
[PHP]
<?php
// Process out the header portion of the page
include("header.htm");
// Connect to the database - DO NOT forget to change the user and
// password parts to your right information
$link = mysql_pconnect ("localhost", "mysql_user", "mysql_passowrd")
or die("Could not connect: " . mysql_error());
// Now lets create the database, if it is done successfully, it will say so, if
// not it will tell that it was not.
if (mysql_create_db("my_db")) {
print("Database created successfully\n");
}
else {
printf ("Error creating database: %s\n", mysql_error());
}
// Process out the footer portion of the page
include("footer.htm");
?>
[/PHP]
The above code should create a database, I didnt make this code, I actually copied it, but if it works, I want to change it around some and then see if it works.
•
•
Join Date: Oct 2004
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
sir,
I am in no level at all.I am as good as not knowing anything but wanna know;because i am a learner,i see myself as a learner and ready to learn at anytime from anybody knowledgeable than me......I am just learning how to use the frontpage to design a web but php is my ultimate choice.
MarCarNar
I am in no level at all.I am as good as not knowing anything but wanna know;because i am a learner,i see myself as a learner and ready to learn at anytime from anybody knowledgeable than me......I am just learning how to use the frontpage to design a web but php is my ultimate choice.
MarCarNar
•
•
Join Date: Sep 2004
Location: Delaware, USA
Posts: 417
Reputation:
Rep Power: 5
Solved Threads: 0
Ha ha, alright, cool.
Need Website Work... PM Me or EMail Me at mdstreetsoulja@gmail.com ... I am AVAILABLE!
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Other Threads in the PHP Forum
- Previous Thread: how to directly send data to print
- Next Thread: configure phpmailer


Linear Mode