Jump to content

vicodin

Members
  • Posts

    279
  • Joined

  • Last visited

    Never

About vicodin

  • Birthday 09/27/1984

Profile Information

  • Gender
    Male
  • Location
    Long Island

vicodin's Achievements

Member

Member (2/5)

0

Reputation

  1. Yup, they really have brought that language back from dead. Its fantastic for beginners and is pretty powerful too.
  2. 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];
  3. 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";
  4. 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.
  5. 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.
  6. 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 }
  7. When you make your SQL statement use the ORDER BY statement which will allow you to return the data in numeric order and then write a little script to apply what you need to the first 2 pieces of data.
  8. Just a note with sessions... I have notice with PHP sessions cant go between sub domains... So like lets say you login to http://www.mysite.com/home.php and lets say the person who made the site made their home link to http://mysite.com/home.php the session will be lost. So maybe you logged into www.mysite.com but are trying to connect in cURL to mysite.com, I could see the session being lost like that.
  9. Someone correct me if im wrong but im pretty sure most frameworks have that kind of stuff... Look into Symphony or CakePHP framework.
  10. You can make another row to define your priority. So like if the time stamps match then you can sort by their priority number.
  11. 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.
  12. Honestly without looking at the code its literally just guessing... you need to write some functions to debug your code. Like start building functions that make you an error log.
  13. Your gonna need to combine AJAX and PHP to do it... there are plenty of free open source solutions out there you can use.
  14. 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.
×
×
  • 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.