Jump to content

vicodin

Members
  • Posts

    279
  • Joined

  • Last visited

    Never

Everything posted by vicodin

  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.
  15. 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.
  16. you need to use: $row = mysql_fetch_array($result); echo $row['Your_Column_name_here'];
  17. 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.
  18. Looks like your missing an AddHandler Type in one of your config files.
  19. Ok, makes more sense now... Now why do you need a variable to the results page when it seems the results page is whats executing this class?
  20. I don't get what you mean... Nothing needs to change as far as connecting if its the same database. If your connecting to different databases then you would need to change the database name.
  21. Statement: has been retracted. After fully reading his code Nightslyr is 100% correct.
  22. This seems like an AJAX issue not PHP. Try posting this question on a AJAX forum.
  23. Im guessing you didn't write this your self? Not taking a shot at you but I need a bit more knowledge of how this class works and what its supposed to do so I can try to help you. Can you give us as much info about it as possible?
  24. AJAX isnt easy... There are a bunch of frameworks for PHP and AJAX, if you cant grasp it quickly then look into using a framework. It will ease the learning curve a little.
×
×
  • 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.