Jump to content

matthew9090

Members
  • Posts

    135
  • Joined

  • Last visited

    Never

Posts posted by matthew9090

  1. I could do with some advice because i am thinking of game programming. I already know php, html, javascript but they aren't for games. But i'm thinking of either c, c#, c++ or lua and maybe java. Does anyone know which one is best? I know java can be slow and lua is not normally for the actual game code .I'm thinking c++. Also i could do with some books as well which will be good if it covers graphics and how to use graphic libraries. I'm only 13 but i would like to start learning now.

     

  2. but now if i do

    <?php
    while (($files = readdir($dir2)) !== false)
      {
       if (is_dir($files))
       {
          if ($files != "." && $files  != "..")
          {
             echo $files . "<br />";
          }
       }
       elseif (is_file($files))
       {
          echo $files . "<br />";
       }
      }
    ?>
    

     

    then it only comes up with 1 directory and 1 file, but last time it came up with everything

  3. how would you display folders on top of files

     

    part of my code:

    while (($file = readdir($dir)) !== false)
      {
        if (!strstr($file, ".")) //get folders
             {
                echo "<a href='index.php?dir=$dir/$file'>" . $file . "</a><br />";
             }
          if ($file!="." && $file!=".." && strstr($file, "."))
          {
             echo $file . "<br />";
          }
    

  4. lets say i have this string: dir/dir/dir/dir/dir

     

    how would i remove everything after the last '/' sign so it outputs this: dir/dir/dir/dir (and removes the '/' symbol aswell)

     

    <?php
    //something like this
    $str = "dir/dir/dir";
    $replace = //do something
    echo $replace;
    ?>
    

     

    EDIT: i found the solution

    <?php
    $str = "dir/dir/dir";
    $replace = dirname($str);
    ?>
    

     

     

  5. go into phpmyadmin or whatever you use and see what the database name is then do this:

     

    mysql_connect("hostname", "user", "pass") or die("could not connect");
    mysql_select_db("database_name") or die("could not connect to the database");
    

     

    if your using a local server the connect normally looks like this:

     

    mysql_connect("localhost", "root", "");

  6. just do something like this:

     

    <html>
      <head>
         <script type="text/javascript">
               //ajax function
               function ajaxFunction() {
    
               }
         </script>
      </head>
      <body onload="ajaxFunction()">
    
      </body>
    </html>
    

  7. i've got this javascript code

    <script type="text/javascript">
    function show(str) 
    {
    document.getElementById('div').innerHTML=str;
    }
    </script>
    

     

    and html code:

    <a href='http://link.com' onMouseOver="show('text')">text</a>
    <div id="div">
    
    </div>
    

     

    i'm using the google chrome browser and it doesn't come up with anything.

     

    when i go to the inspect element on chrome it comes up with: index.php:103Uncaught TypeError: string is not a function. What does it mean!

     

  8. does the text need to be in quotes

     

    <?php
    $fileHandler = fopen("someFile.txt", 'w') or die ("could not create file");
    $text = "<<<END
    what the heck?
    this should work!
    _END";
    fwrite($fileHandler, $text) or die ("could not write to file");
    fclose($fileHandler);
    echo "File 'someFile.txt' written successfully";
    ?>
    

  9. Yes.

     

    foreach ($people as $human)
        $human->die();

     

    Peace, one cycle at a time :)

     

    lol. i want a manision and all the money in the world

     

    foreach($human as $matthew) {
    $matthew->give->alltheremoney;
    }
    
    $matthew->mansion;
    

  10. this might work which i quickly wrote:

     

    <?php
    $chars = "123456789"; //numbers 1-9 and copy as many times as you want for dublicate numbers
    $chars .= "123456789"; 
    $chars .= "123456789"; 
    $chars .= "123456789"; 
    $chars .= "123456789"; 
    $chars .= "123456789"; 
    $chars .= "123456789"; 
    $chars .= "123456789"; 
    $chars .= "123456789"; 
    $chars = str_shuffle($chars);
    $chars = substr($chars, 0, ;
    //connect here
    mysql_connect("host", "user", "pass");
    mysql_select_db("db");
    $sql = mysql_query("SELECT * FROM table WHERE number='$chars'"); //change the table name to fit your db
    if (mysql_num_rows($sql)>0)
    {
       header("Location: this_page.php");
    }
    else
    {
       //insert
    }
    ?>
    

×
×
  • 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.