Jump to content

KefkaIIV

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

KefkaIIV's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. [quote author=wildteen88 link=topic=101957.msg404006#msg404006 date=1153932954] For your first question. Yes you can do that, however some developers tend to do [code]echo "<p>" . $quotes[$randomquote] . "</p>";[/code] for readability when creating a script, Theres no need for it, as variables can be parsed within double quotes. However they can't with single quotes. [/quote] What are the periods before and after the variables? And what are they for? [quote] $randomquote = rand(0,count($quotes)-1); [/quote] Does "rand" stand for random? And why does it say "0, count". Why is it in parenthesis? And have a -1 at the end? Sorry, I am new, and trying to grasp all the concepts.
  2. [code]<?php /** * Add this line of code in your page: * <?php include "random_quote.php"; ?> */ $quotes[] = "This is a quote"; $quotes[] = "This is another"; $quotes[] = "quote 3"; $quotes[] = "quote 4"; $quotes[] = "quote 5"; $quotes[] = "quote 6"; srand ((double) microtime() * 1000000); $randomquote = rand(0,count($quotes)-1); echo "<p>" . $quotes[$randomquote] . "</p>"; ?> [/code] [b]Question 1:[/b] Could I change the echo statement to: [quote]echo "<p> $quotes[$randomquote] </p>";[/quote] If not, why? Do the periods have to be before and after the variables? Can I not just quote the whole thing, instead of only the "p"'s? [b]Question 2:[/b] What does this mean: [quote]srand ((double) microtime() * 1000000);[/quote] What does "srand" stand for, and what does the whole line of code do? [b]Question 3:[/b] How do I change the following so it displays more than one quote: [quote]$randomquote = rand(0,count($quotes)-1);[/quote] What would be changed, and why?
  3. [quote author=onlyican link=topic=101737.msg402880#msg402880 date=1153776299] it is possible in php I think this is intermediat level work Where to start Most knowledge needs to be Forms MySQL Sessions / Cookies [/quote] Okay! Thank you very much!  ;) Now where should I start off? I don't know much, lol... :( I should probably start off with the sessions first? For when they register? How would I come about doing that?
  4. Okay, prepare for this. You don't need to give me the code, just point me in the correct directions. I am fairly new at PHP, so I barely know anything. At wifitournament.com - I want to create a PHP script that, instead of having Nintendo tournaments online with the handheld DS on the forums, have this script. Before anyone gives me dumb questions, the program, (just as the forum did), will organize the tournaments. Not host them, of course. I need people to register for this, and when they register, they will see a few options. One of these options would be their stats. An administrator can add the losses, wins, and anything else, medals, ect. - to the appropriate places from the tournaments. The next one would be current tournaments, and when they click on them, they can register and they will be automatically assigned to a random bracket. And, an admin panel. Through this admin panel, the brackets can be updated, the profiles can be changed, ect. Is this possible through PHP? And how much skill and experience are we looking at here? Will this take months? Can anyone help me, or point me in the direction to everything I need here? - Registering system - Profile - Admin CP (Ability to edit brackets and user profiles) - Tournament sign-ups - Ect. And everything else I said. Any help would be appreciated.
  5. Okay, so that code that was displayed, what do I need to change so it will fit?
  6. No. I want the usernames of my forum to be displayed on my homepage. How do I get MySQL to display them? And, make them randomized (Like only 5 out of lets say, 1000 members.)
  7. I do not know what Assembly is. My PHP experience goes for like, +2 weeks. HTML experience goes for like, +1 year. My CSS experience goes for like, +3 months. My MySQL experience goes for like, +0 seconds. Is Assembly worth learning? Or should I just learn the above?
  8. Okay, I am learning PHP, and I simply dread MySQL. Something I wanted to do just popped into my head, which had been a long thought over topic of mine. So bare with me guys, and help me learn how to make this quick script, okay, thanks. [b]T[/b]he goal of the script I want is to display a forum's member list. On the homepage of my website, which is not connected to my "/forum" in any way, I'd like it to have a box at the right, with five names. The names would be the "Usernames" of people from my forum. Now, I know I can just add the usernames to the list, and have it show a random 5, but that would be very difficult for growing forums. Before I ever thought of this idea, I used a script similar to this: [code]<? $bgcolor = '#FFFFCC'; $textcolor = 'black'; // Array Structure:  "Quote","Author" $allqts = array     ("The Black Knight Always Triumphs!",         "Monty Python",     "I swear by my life and love of it that I will never live for the sake of<br>another man, nor ask another man to live for mine" ,         "Atlas Shrugged",     "It is clear that the individual who persecutes a man, his brother,<br> because he is not of the same opinion, is a monster",         "Voltaire",     "I agree that there is a natural aristocracy among men<br>The grounds of this are virtue and talents.",         "Thomas Jefferson",     "Liberty, when it begins to take root, is a plant of rapid growth.",         "George Washington",     "Never argue with an idiot. <br>They drag you down to their level <br>then beat you with experience",         "Dilbert",     "The Answer is 42. What is the question?",         "Hitchikers Guide to the Galaxy",     "Anyone who has never made a mistake has never tried anything new",         "Albert Einstein",     "Progress doesn't come from early risers, progress is made<br>by lazy men looking for easier ways to do things.",         "Lazarus Long <font size=-2>(Time Enough for Love by Robert A. Heinlein)</font>",     "A little learning is a dangerous thing; Drink deep, or taste not the<br>Pierian spring.  There shallow draughts intoxicate the brain, <br>and drinking largely sobers us again",         "Alexander Pope",     "The early bird gets the worm, but the second mouse gets the cheese",         "Anonymous",     "Subjugating the enemy's army without fighting is the true pinnacle of excellence",         "Sun-tzu, The Art of War",     "Work as though you were to live 100 years; pray as if you were to die tomorrow",         "Benjamin Franklin",     "The world is a stage, but the play is badly cast",         "William Shakespeare",     "Truth is generally the best vindication against slander.",         "Abraham Lincoln",     "...mercy to the guilty is cruelty to the innocent...",         "Adam Smith",     "...I wish that I may never think the smiles of the great and powerful<br> a sufficient inducement to turn aside from the straight path<br> of honesty and the convictions of my own mind",         "David Ricardo",     "Democracy is the worst form of government except for all the others",         "Winston Churchill",     "You can only know the highest peaks if you have experianced the lowest valley's",             "Richard Nixon",     "They dress the wound of my people as though it were not serious. <br>'Peace, peace,' they say, when there is no peace.",         "Jeremiah 6:14",     "It is better to remain silent and be thought a fool<br> than to open your mouth and remove all doubt.",         "Jonathan Swift",     "The market system delivers the goods people want,<br>but those who make it work cannot readily explain why it is so.<br>The socialst or communist system does not deliver the goods, <br>but those who operate it can readily explain away its failure.",         "F.A. Hayek, Law, Legislation and Liberty, Vol. II"         ); // Gets the Total number of Items in the array //  Divides by 2 because there is a Quote followed by an Author $totalqts = (count($allqts)/2); // Subtracted 1 from the total because '0' is not accounted for otherwise $nmbr = (rand(0,($totalqts-1))); $nmbr = $nmbr*2; $quote = $allqts[$nmbr];         $nmbr = $nmbr+1; $author = $allqts[$nmbr]; // You can delete this section //  it is only so Search engines can find it if ($PHP_SELF == "/quotes.php") {     echo "<Title>Random Quote Script for PHP</title>";     echo "<meta name=\"Description\" content=\"Random Quote script written in PHP\">";     echo "<meta name=\"keywords\" content=\"Random Quote script written in PHP\">";     echo "This is my random quote script that is written in PHP";     echo "<br>Feel free to use it for whatever you want<br/><br/>"; } /// End Delete $space = "<font color=$bgcolor>.....................................</font>"; $comments = "<br><center><font size='-2'><i><a href='quotes.php'>Random Quote Script by Dave</a></i></font></center>"; echo "<center>"; echo "<Font color=$textcolor><i>"; echo "$quote<br>"; echo "</i></font>"; echo "$space $author"; echo "$comments"; echo "</center>"; IF ($PHP_SELF == "/quotes.php") {     show_source("quotes.php");   } ?>[/code] And I would keep adding more "Usernames" to the array. Of course, I used "Usernames" instead of quotes, as this script does. So, how do I get a MySQL database to fetch usernames, and have it work similar to this, but being from the tables, it adds new members? If I am confused on how MySQL works, please tell me. I am not very intelligent when it comes to MySQL. Any information about this subject would be appreciated, thank you.
  9. I am new to PHP, but all I know is people usually use C++ for making things like that? It'd be interesting if you could make it with PHP. I'd like to learn how then.
  10. Sessions, but I don't see a huge difference.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.