PHP FAQ--Read before posting!

free web hosting
Free Web Hosting, No Ads > Have your say > General Talk

PHP FAQ--Read before posting!

God
Alright, here's my list of FAQs. Most of it I just copied from other threads in this forum.

General PHP Questions:
What is PHP? What is it used for? How do I use it?
PHP is the most common and most supported server-side scripting language. This means that the server executes your code and sends the result to your browser. It is usually used to generate dynamic content, such as you see in forums and content management systems. phpBB, IPB, vBulletin, PHPNuke, PostNuke, and practically every other system like them use PHP. To use it, you must first create a file named something.php. You can change the first part of the name, but not the extension. Then, you put your PHP code and/or HTML in that file. That's all!

What's the best way to learn PHP?
I would suggest buying a book and reading the whole thing, but that's expensive and time-consuming. I would specifically recommend PHP and MySQL Web Development, Third Edition. If you don't meet those requirements, here are a couple of good tutorial sites:
[list]-They have a very basic tutorial and an excellent function reference.
W3Schools-Another basic tutorial.
PHPBuilder-They have a bunch of tutorials (in the articles tab), a bunch of code snippets, a forum, and a bunch of other stuff.
PHPFreaks-They have tutorials made by both themselves and their users, code snippets, fulls scripts, and a forum. Plus anything else I didn't mention.
PHP Resource Index-This site has a bunch of tutorials and PHP Classes.
[list]

MySQL PHP Questions:
How do I connect to MySQL with PHP?
First, make sure you have a database, user, and password. Then, you can sue the following code to connect to MySQL and select your database:
CODE
$db_handle = mysql_connect("localhost", "__username", "__password") or die("Error: Could not connect to MySQL!");

$db_db = mysql_select_db("__database_name", $db_handle or die("Error: Could not select the database!");

You will need to edit this and set __username, __password, and__database_name to the username, password, and database name for you.

How do I execute a query in PHP?
Once you have connected to MySQL (see above), you can then execute mysql queries using the following statement:
CODE
$result = mysql_query("MYSQL QUERY HERE", $db_handle);
This will store the results of the query into $result. If there was an error, $result will be set to false. If there was no error, but no rows were returned, then $result will have no rows in it (Brilliant, eh?). If rows were returned, then $result will contain those rows.

Okay, I've executed my query, now what?
Now, you need to get those rows from the variable. There are several built-in functions which will help you with this:
First, mysql_num_rows will return the number of MySQL rows included in a result variable. Example:
CODE
$num_rows = mysql_num_rows($result);

Second, you can get those rows using the mysql_fetch_row or mysql_fetch_array functions. To see the differences, refer below. To use these functions, you will need to set up a loop which will access each row. You can use a for loop, with 1 as the initial condition and the result of mysql_num_rows as the ending condition. Example:
CODE
$num_rows = mysql_num_rows($result);

for($i = 1; i < $num_rows; i++) {

   $row = mysql_fetch_row($result);

   //Do something with $row

}

The other way, and for me the simpler way, is to use a while loop with the call to mysql_fetch_row included in the condition:
CODE
while( $row = mysql_fetch_row($result)) {

   //Do something with $row

}


What's the difference between mysql_fetch_row and mysql_fetch_array?
There's only one difference: the type of array which is returned. Otherwise, they function exactly the same. mysql_fetch_row will return an array containing the values of the current row as the values in the array. Thus, you will have to access them using their numerical indexes. Example:
CODE
$row[0];

$row[1];

.

.

.

mysql_fetch_array will return the array with either numerical indexes, as above, with the column name from MySQL as the keys, or with both. This depends upon the second argument. It has three possible values: MYSQL_NUM, MYSQL_ASSOC, and MYSQL_BOTH. Example:
CODE
$row = mysql_fetch_array($result, MYSQL_NUM); //Will return an array with numerical indexes.

$row = mysql_fetch_array($result, MYSQL_ASSOC); //Will return an array with keys.

$row = mysql_fetch_array($result, MYSQL_BOTH); //Will return an array with both numerical indexes and keys.




Obviously, there isn't much right now. That's because it takes alot of time to write alot. biggrin.gif I'll add mroe as I get the time.

Links:
[list]
http://www.wdvl.com/Authoring/Languages/PHP/Date_Time/
QuoteMaster
http://www.phpbuilder.com/snippet/detail.p...=snippet&id=177
Capitalize first word of every sentence
http://www.phpbuilder.com/snippet/detail.p...snippet&id=1037
Quick Sort Function
http://www.phpbuilder.com/snippet/detail.p...e=snippet&id=10
Add commas to #'s
http://www.phpbuilder.com/snippet/detail.p...=snippet&id=542
MyPHP Google PageRank
http://www.tapouillo.com/firefox_extension.../sourcecode.txt
Dynamically Created PREV/NEXT Page Links
http://www.phpbuilder.com/snippet/detail.p...=snippet&id=862
Complete recursive directory listing
http://www.phpbuilder.com/snippet/detail.p...=snippet&id=249
CodeWalkers
http://codewalkers.com/
PHPBuilder.com - The Resource For PHP Developers
http://www.phpbuilder.com/[list]

Please only respond to this post if it directly relates to this FAQ. Examples include suggestions, comments, and disagreements. DO NOT post questions about PHP in here. I'll just delete them, since I don't want this thread to get off-track. Thanks.

 

 

 


Reply

Hazaa
QUOTE
Alright, here's my list of FAQs.  Most of it I just copied from other threads in this forum.

What is PHP? What is it used for? How do I use it?
PHP is the most common and msot supported


Dude, I've noticed a typo, change msot supported to most supported.

Delete this when sorted.

-Hazaa-

Reply

God
QUOTE
QUOTE
Alright, here's my list of FAQs.  Most of it I just copied from other threads in this forum.

What is PHP? What is it used for? How do I use it?
PHP is the most common and msot supported


Dude, I've noticed a typo, change msot supported to most supported.

Delete this when sorted.

-Hazaa-


Nah I'll leave it there as an example of what a GOOD thing to post here is. biggrin.gif

Reply

y04chs067
LOL.If anyone wants some ebooks on PHP/MySQL,PM me..I can give you some..

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : php, faq, read, posting

  1. About Posting Form
    (2)
  2. Trap17 Gets Supernatural: Topics Disappear!
    We post byt we cannot see it and others cannot read it! Why? (7)
    To whom it may concern, Dear sir, Strange things happen after the rollback thunder and it still
    makes things disappear. No logic at all. Today I posted a topic about Safari we browser . The link
    is there on the forum list but I just cannot open my own post. Elf? UFO? Rollback? Whatever it
    is, it gave me the following error: Board Message CODE Sorry, an error occurred. If you are
    unsure on how to use a feature, or don't know why you got this error message, try looking
    through the help files for more information. The error returned was: Sorry, some r....
  3. Compatibility/major Question
    Please read I WILL BUY If I Get Help (5)
    Ok, so Im like 13 and almost 14, and I'm wanting to buy a site from you. Ive read everything
    there is, and I do know html and other stuff like javascript. I want to go for your 7.77 a month
    deal which would only be 102 dollars canadian per year. I see how you guys have this awesome Cpanel,
    Rvskin, and fantastico deluxe. I really think you have great deals, and of course your trying to
    make money, which no one should have a problem with because you dont scam people and have worked
    hard to create an amazing group of corporations! -------Now to the Question------- ....
  4. Can't Read E-mail
    (0)
    Hello everyone, Thus, I have a problem with reading email messages.When click on''Go to my
    inbox''can't browser is open, writes to me''Do not send''... Had a
    similar or this issue, there is a right applications or something so I could enter into inbox ..
    Thanks in advance everyone. /unsure.gif" style="vertical-align:middle" emoid=":unsure:" border="0"
    alt="unsure.gif" />....
  5. Free Web Hosting Application [screened] [approved]
    by miikerocks: request for site (PLEASE READ) (6)
    PRESENT CREDITS : Forum Username : miikerocks Email Address: mike_simpson_@hotmail.com My
    Desired Trap17 SUBdomain Name is: www.FreeLoads.org Introduce Yourself: Your hobbies, interests,
    talents, etc. Let the forum know you better. • For hobbies I like to be nice to people,
    well help people out. I like to go on the computer, and one of the things I LOVE is to make
    websites. Ever since grade 3 I have been searching and searching for a way to make a .com for free,
    now I find you guys. THANK YOU SOOOO MUCH!!! I have talents and interests in sport....
  6. Cpanel Raw Acess Log
    how to read them (1)
    US; rv:1.8.1.15) Gecko/20080623 Firefox/2.0.0.15" 194.8.75.239 - - "GET /si/news.php?view=4
    HTTP/1.0" 200 5175 "http://sonesayi.com/si/news.php?view=4" "Mozilla/5.0 (Windows; U; Windows NT
    5.0; en-US; rv:1.8a) Gecko/20040416 Firefox/0.8.0+" 194.8.75.239 - - "POST /si/news.php?view=4
    HTTP/1.0" 200 5175 "http://sonesayi.com/si/news.php?view=4" "Mozilla/5.0 (Windows; U; Windows NT
    5.0; en-US; rv:1.8a) Gecko/20040416 Firefox/0.8.0+" This is just 2 lines of the log I downloaded
    for my site. First off how do I tell what time zone is it in and is there a way to change i....
  7. Topic Not Posting [resolved]
    (3)
    Hi, I just tried posting a topic under the Web Design section, something like, "CMS for Video,
    Embedding Flash" and after I posted it, it wasn't there. It gave me credits for posting it I
    think, but when I tried to access it it gave me the error: QUOTE Sorry, some required files are
    missing, if you intended to view a topic, it's possible that it's been moved or deleted.
    Please go back and try again. The text of the post was: QUOTE Hello, I'm looking for a
    good CMS that allows dynamically adding embedded flash objects (like youtube videos), as ....
  8. Domain Name Changed
    Please Read (4)
    On my free web hosting application, I requested that my subdomain be (bangms.trap17.com). When I
    logged in to my Credit System Control Panel and registered a subdomain name, I decided I wanted to
    change my subdomain to (ampdms.trap17.com). I think this is the reason why my page can't be
    displayed when I try to see my site (ampdms). I'm just letting you know so you can cancel the
    bangms subdomain and add my new subdomain name (ampdms).....
  9. Reset My Site Pelase
    read for more info (6)
    Can you just reset my cpanel / website FTP and all to how it was when I got it new please? Don't
    change any passwords, just make it so it's like brand new again. thanks --why? because I have
    some files in public_HTML that I am trying to delete even after I give it 777 it says permission
    denied so please reset /smile.gif" style="vertical-align:middle" emoid=":)" border="0"
    alt="smile.gif" />....
  10. Ftp Access Has Stopped Working All Of A Sudden [resolved]
    read (5)
    heres the login information i use add : ftp.sub-domain.qupis.com user: my username pass: my pass
    port: 21 i already opened a ticket and it seem pending at the moment but does anybody know a
    solution... im already having problems with php files. im getting a password error but i can open
    my account via web easily....
  11. Hackers Hijack A Half-million Sites: Phpbb Forum Users Must Read
    (8)
    Since January, hackers have hit hit over 500,000 website, with everything you could possible
    imagine; viruses, trojans, malware etc etc. As for the types of websites, sadly to say, these
    websites who are getting hit are running PHPBB forum and the worse part is htey don't mention
    which version of the phpbb forums are getting hack. So it is safe to say any version below 3.0 is
    hackable and maybe even 3.0 itself. As for some of the stuff that is being transmitted are old and
    new, but one trojan has been identified and it is the Zlob Trojan or rather variations to th....
  12. The Great Gatsby And The American Dream
    Warning, Long Read and Essay (4)
    F. Scott Fitzgerald’s The Great Gatsby is much like an onion. On the surface there is the hard outer
    layer, but to really understand it, one has to dig into the fresh insides. On the surface of The
    Great Gatsby Fitzgerald portrays a romantic love between a man and a woman, but inside the real
    meaning is much deeper. Fitzgerald depicts the 1920’s as a time of decay social and moral values,
    evidence of this is the greed and the pursuit of pleasure. Jay Gatsby’s constant parties epitomized
    the corruption of the American Dream as the desire for money and worldly pleasures ov....
  13. Can You Read In Your Dreams?
    Another hidden talent discussed here? (24)
    Okay so the topic is pretty straight forward. "Can you read in your dreams?" So what brings this
    topic up? I heard recently that when you are asleep and in dream land, that it is supposed to be
    impossible for you to actually read anything intelligible ( like signs or instructions). It has
    something to do with the different parts of the brain and how they are functioning when you hit
    sleep mode. Anyways I found this really confusing because part of my problems in figuring out
    whether I am asleep or awake sometimes is that I can read in my sleep and it's regular words....
  14. Living Everyday Happily And Meaningfully
    when you are getting down, please read this and think deeply (5)
    Do you feel sad? Whenever you are down or face problems please don't be sorrow for your sake.
    It is not only you in this world. Let's think about others. There are millions of people who
    try to survive. Many disability people and some people who are suffering illness are trying to
    overcome. They all have never given up. So, you should thank God. You should live everyday
    happily and meaningfully by helping other people. /smile.gif" style="vertical-align:middle"
    emoid=":)" border="0" alt="smile.gif" /> Sometimes, we all are busy with our work and work as R....
  15. Free Wap! Omg!
    Yep! Read for more details (4)
    This isn't that new, but there is a way for people to get free WAP these days. This is
    accomplished by using a proxy, and it works for me and my friends. WAP is basically the internet
    browser , and nothing else. So don't get excited with texts and VCAST because its just not that.
    Heres the "catch" -Uses your Minutes! Peak Times -You can use it all weekend/nights without
    getting fined. -Its absolutely free -Just register and edit your phone and your done!
    http://www.zaksenterprises.com/ Just remember to register for a free WAP! Read over all t....
  16. Who Is The Best Writer Did You Ever Read And His Or Her Book
    (10)
    i read lots of books but i cant forget MARIO PUZO THE GODFATHER. this is very serious book that
    read. the second book is DAN BROWN's DAVINCI CODE. the third one is JACK LONDON WHITE TOOTH........
  17. Read File (.txt) On Another Website Using Jsp?
    (3)
    in my jsp program,i need to read a file (.txt) on another website,how can i do this? thanks a lot.
    shorten title ....
  18. Eragon
    Anyone else read it? (53)
    I've just finished reading Eragon and now I'm moving on to read Eldest, and I gotta say,
    what a great book! It's a fantasy novel by Christopher Paolini about a young boy about 15
    years old who finds a blue stone. It turns out to be a dragon inside and he and his dragon, Saphira,
    travel the world seeking revenge for the death of his family. The story unfolds as he forms
    alliances and enemies and travels to exotic locations. I'll not say anything else in case
    someone is only a little way into the book because I don't want to spoil anything. So, has....
  19. Dvd Drive Problem
    It Wont Read Anything! (10)
    Recently my DVD drive was playing everything, today i put a dvd disk in, it says nothing comes up
    with no auto play or nothing loads at all. so i go to my computer and load from there, it dont load.
    It says please insert disk... Im like WTF so i put a cd disk in and the same exact thing happened. i
    tried about 7 different disks including cd and dvd disks and burned ones too. Nothing at all, So i
    go to google and check around for tuts on fixing this, it gives me this registry thing. Like delete
    lowerfilter and upperfilter in this folder. I do it, Still nothing happens, so....
  20. Halo Books
    anyone read em? (20)
    The halo books are actually pretty good books there about 300 pages long each and their a good break
    from video games the first one in the series is titled halo:fall of reach which is about how the
    chief was trained and who started the spartan program and wat the chiefs real name is and his fellow
    spartans book 2 is called halo:the flood which is a more detailed version of halo1 it talks about
    wat the marines were doing while the chief was off killin everything and stuff like that more
    backstory the third book is called halo:first strike this is about wat happens between....
  21. Have You Read The Rules?
    TOS, privacy policy, hosting rules... (27)
    Dear hosted members, We have noticed that many members are knowingly or unknowingly breaking some
    basic rules of posting and hosting at T17. This has resulted in a lot of spam posts which in turn
    lead to more unnecessary work for moderators and admins, 'defacement' of the foums and
    sometimes even banning of the concerned member. The rules are there and you are also there. But
    have you read them? Usually, if you have read the rules and understood them, it is not expected
    that you break them voluntarily. This however can be expected of some unscrupulous eleme....
  22. Join My Runescape Clan
    read here if interested (4)
    http://s9.invisionfree.com/runekillerclan/index.php?act=idx ....
  23. Read-only Folders In Xp
    Can't change Read-Only attribute in XP (13)
    Hi, I am working with a firma. We use WinCvs which is a software similar to perforce. I downloaded
    the developement to C: (eg. c:/development) The folder c:/development and the folders under it have
    Read-Only permisions. I need to remove that restriction. I press right-button, i unchecked the
    read-only check-box and i apply to this folder and folders under it. Whe it finisehd i click ok. Whe
    i press the right button again i discovered that the folder has still the read-only attribute. So it
    seems nothing changed. something similar happen to you? How can i uncheck the ....
  24. Im Making A Mmorpg >>
    Have a read... (14)
    can you give your ideas for my new game. if you want to help me even more then send me a private
    message Thanks Tyjotr __________________________________________________ HybridHero - the new 3d
    MMORPG (coming soon)....
  25. Read This At Any Cost Before Posting Here
    THE CPANEL DOCUMENTATION (8)
    Most of you might have problems regarding web Hosting. We give literally ALL THE CONTROLS to our
    Clients. Unlike OTHER HOSTS , WE do NOT Block Critical Features and let our members explore through
    them. ALL the ERRORS you might get can be corrected or is a result of misconfiguration at the
    Cpanel. We have the same amount of control as you have. We give you everything. So if you DO NOT
    understand how to go with Cpanel, READ THE FOLLOWING DOCUMENTATION CAREFULLY! Edit: Changed
    the cPanel documentation link.....
  26. **** Read Before You Post! ****
    THIS MAY AFFECT YOUR HOSTING CREDITS (47)
    These rules were re-written by Dooga THESE RULES ARE IMPORTANT! FAILING TO READ THESE NOTES
    WILL RESULT IN YOUR HOSTING CREDITS TO BE DEDUCTED! This forum is a forum to post tutorials
    that YOU have written. You are NOT allowed to post a tutorial copied from another site,
    regardless of any reference you make! (However, you may PARAPHRASE it with correct
    referencing). Your tutorial is going to be moderated (that means, anything you post won't be
    viewable until a moderator has accepted it). Do not re-post your tutorials if they don't show
    up&....
  27. Avg Anti-virus Question
    Users please read (14)
    So I was updating my free version today and it told me that I had 5 things in my vault. I was
    wondering if emptying it would be the good thing to do. I mean do I just keep the virus' in
    there? Or do I empty it and are they then deleted?....
  28. Beside novel or friction, what do you read?
    Wonder what books trap17 people read. (5)
    Anyone read sth like "The Goal", SuZe Orman's books, or cook book?....
  29. Last Book You Read?
    (192)
    What was the last book you read? me was "Out of Avalon" the book had different stories about Avalon.
    Before, After, During King Arthur's Lifetime....
  30. Read This Before Applying For Hosting!
    HIGHLY IMPORTANT! (56)
    DISCARD THIS PAGE : WE HAVE CREATED A FORM GENERATOR HERE
    http://www.trap17.com/forums/click-here-de...ting-t9222.html READ THE FOLLOWING INSTRUCTIONS
    CAREFULLY BEFORE APPLYING Once you have the necessary Hosting credits ( check at :
    http://www.trap17.com/forums/ ), You can request here by making a new topic and putting in the
    following details. BEFORE ACCEPTING YOUR APPLICATION, WE GO THROUGH YOUR EACH AND EVERY
    POSTS! SEE TO IT THAT YOU HAVE GOOD QUALITY POSTS. BUILDING A GOOD COMMUNITY IS OUR FIRST
    PRIORITY! Its very easy once you get st....

    1. Looking for php, faq, read, posting

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for php, faq, read, posting

*MORE FROM TRAP17.COM*
Similar
About Posting Form
Trap17 Gets Supernatural: Topics Disappear! - We post byt we cannot see it and others cannot read it! Why?
Compatibility/major Question - Please read I WILL BUY If I Get Help
Can't Read E-mail
Free Web Hosting Application [screened] [approved] - by miikerocks: request for site (PLEASE READ)
Cpanel Raw Acess Log - how to read them
Topic Not Posting [resolved]
Domain Name Changed - Please Read
Reset My Site Pelase - read for more info
Ftp Access Has Stopped Working All Of A Sudden [resolved] - read
Hackers Hijack A Half-million Sites: Phpbb Forum Users Must Read
The Great Gatsby And The American Dream - Warning, Long Read and Essay
Can You Read In Your Dreams? - Another hidden talent discussed here?
Living Everyday Happily And Meaningfully - when you are getting down, please read this and think deeply
Free Wap! Omg! - Yep! Read for more details
Who Is The Best Writer Did You Ever Read And His Or Her Book
Read File (.txt) On Another Website Using Jsp?
Eragon - Anyone else read it?
Dvd Drive Problem - It Wont Read Anything!
Halo Books - anyone read em?
Have You Read The Rules? - TOS, privacy policy, hosting rules...
Join My Runescape Clan - read here if interested
Read-only Folders In Xp - Can't change Read-Only attribute in XP
Im Making A Mmorpg >> - Have a read...
Read This At Any Cost Before Posting Here - THE CPANEL DOCUMENTATION
**** Read Before You Post! **** - THIS MAY AFFECT YOUR HOSTING CREDITS
Avg Anti-virus Question - Users please read
Beside novel or friction, what do you read? - Wonder what books trap17 people read.
Last Book You Read?
Read This Before Applying For Hosting! - HIGHLY IMPORTANT!
advertisement



PHP FAQ--Read before posting!



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE