Jump to content

vicodin

Members
  • Posts

    279
  • Joined

  • Last visited

    Never

Posts posted by vicodin

  1. Your gonna put the name like this...

     

    <input maxlength="5" name="rankClass[]" size="2" type="text" />

     

    Now when PHP recieves that data it will be in an array.

     

    so it will be like this

    $_POST["rankClass"][0];
    $_POST["rankClass"][1];
    ...
    $_POST["rankClass"][49];

  2. You mean like this?

     

    echo "<td>2";
    while ($row=mysql_fetch_row($resultMonday))
                       { $start = $row[0]; $endTime = $row[1]; $dance = $row[2];
                          echo $start ."-".$end ." " $dance \n";
                          } 
                          $reset=mysql_data_seek ($resultMonday,0);</td>\n";
    

  3. I totally agree with you in this case phpSensei but since he is learning OOP I think its good for him to start small and work his way up. Im guessing this is his first language he is learning and C++ on your own is pretty rough if you don't have a back ground in something else. I tried C++ first on my own and failed miserably so I switched to Python and picked up OOP much better there. Everyone is different though.

  4. No a switch statement is to compare 1 variable... So like lets say we had variables $x,$y,$z

     

    the code would go as follows:

    switch($x){
    case "":
    //if $x == "" then do this:
    echo 'Its blank';
    break;
    
    case "1":
    //if $x == "1" then do this:
    echo "It says 1";
    break;
    
    case "2":
    //If $x == "2" then do this:
    echo "ITs says 2";
    break;
    }
    

     

    A switch only allows us to compare variable $x to what ever is in our cases.... So you would need to make 3 different switch statements and then do an If statement anyway to see if they matched what you needed.

  5. Vinny first and foremost you need to put in some validation into that script. Please google PHP sql injection security and PHP XSS security and PHP input validation. Right now as your script stands I could take over your server,get every single bit of information out of your MySQL server, write what ever I wanted to your SQL server and redirect all your site visitors to any website of my choosing. Once you get that taken care of if you read that whole page from google its very detailed in what you need to do. Just as a hint you will want to put this part of the code right before you input all the info into MYSQL

     

    
    if (!$resp->is_valid) {
        // What happens when the CAPTCHA was entered incorrectly
        die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
             "(reCAPTCHA said: " . $resp->error . ")");
      } else {
    
    
    // This is where your would input everything into MYSQL
    }
    
    

  6. As someone pointed out before my example is just a very basic database connection script but you only need to call that once. Once you make the connection it stays open till your entire PHP script is finished running. It then closes all by it self which is a feature built into PHP. It is good practice to close the connection by code though.

  7. Your gonna want to create a loop which counts to 4 and when it hits 4, put in a </tr><tr><td>.$key.</td>

    <?php
      $file = "widget.csv";
    @$fp = fopen($file, "r") or die("Could not open file for reading");
    $outputArray = array();
    $count = 0;
    
    while(($shop = fgetcsv($fp, 1000, ",")) !== FALSE)
    {
        $outputArray[array_shift($shop)] =  array_filter($shop);
    }
    print_r($outputArray);
    echo "\n<br />";
    //display
    echo "<table>";
    foreach ($outputArray as $alphabetical=>$value){
        echo "<th><b>" . $alphabetical ."</b></th>";
        echo "<tr>";
    foreach ($value as $key){
        if ($count == 4){
        echo '</tr><tr><td>'.$key.'</td>';
        $count = 0;
        }Else{
        echo "<td>" . $key . "</td>";
        }
    $count++;    
    }
        echo "</tr>";
    $count = 0;
    }
        echo "</table>";
    
        echo "\n<br />";
    
    ?>
    
    

     

    That should do what you need but I haven't tested it.

  8. Nightslyr is giving you some good advice... You will never be able to think out an OOP problem with out learning the theory behind it... I tried to teach my self OOP through example and I just never really got it. I picked up a few books on it and it was just like a light went off and I understood it.

  9. What i think is happening is that image gets stored in a temp directory and then is processed into the PDF. The script will fail if it cant get to the temp directory. Trying giving you entire web directory full permissions for anyone. Of course just do this temporarily till you can see if it works. If it works then you need to hunt down the temp directory and give it the correct permissions... If not then I am not sure. Dont forget to change your permissions back after testing.

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