Jump to content

TomKrush

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

About TomKrush

  • Birthday 11/06/1989

Contact Methods

  • Website URL
    http://zehira.com

Profile Information

  • Gender
    Male
  • Location
    Chicago Illinois

TomKrush's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I had the same question when I was faced with the responsibility of creating a large application. You have to play with many methods of building. I finally went with the MVC pattern. Using design pattern are wonderful and should be largely looked into. You will become a better and faster programmer by knowing what they are and how to use them effectively.
  2. If you get past the idea of XHTML and HTML is just comes down to structure. I prefer XHTML because it has a strong syntax. I think using also XHTML makes web developers feel like we have a fresh start. The 90's were full of weird implementations of web technologies, and today, it feels more like we have a firm base on the web.
  3. Also another important note, in the future remember that the server slows down when you import many files. So your example was a 100 comments. Well that is going to import comments.php 100 times as you know. I would hate to imagine how many files you import on each execution of the code. Speed and efficient code is so important especially when you systems become large.
  4. PHP makes it really easy to avoid this problem. mysql_real_escape_string($inputValue);
  5. You can load in the class and start the object before the database connects as long as your __construct doesn't need the database. I tend to import all my classes connect to the database and finally execute the rest of the code.
  6. This problem is most likely a php.ini problem. Sometimes servers disable file scripts from other systems.
  7. I know my snippet code isn't using microtime. But the concept is there. All you need to use is the function number_format(); <?php $number = 3.14159265; $formattedNumber = number_format($number, 2); echo "Number: ".$number; echo "<br/>"; echo "Formatted: ".$formattedNumber; ?>
  8. I was thinking there was a predefined function to do this but I guess not. Below is a simple method using array_merge and array_unique. <?php $arLetters = array("a", "c", "d", "e", "Z", "U"); $arNewLetters = array("a", "g", "p", "n", "Z"); $newArray = array_merge($arLetters, $arNewLetters); $newArray = array_unique($newArray); print_r($newArray); ?> If you would like it to be a function here you go. <?php //Merges two arrays and makes sure each value is unqiue function array_merge_unique($array1, $array2) { //Makes sure both arrays are of the type array if(!is_array($array1) || !is_array($array2)) { return 0; } return array_unique(array_merge($array1, $array2)); } $arLetters = array("a", "c", "d", "e", "Z", "U"); $arNewLetters = array("a", "g", "p", "n", "Z"); $newArray = array_merge_unique($arLetters, $arNewLetters); print_r($newArray); ?>
  9. Im running Safari got But the code is gathering accurate data. It reads that Im using webkit and everything. But it does mention Mozilla. Here's yours Yours Says that your using Internet Explorer 6 (upgrade to firefox!! lol) and your on Windows XP. So I'd imagine I just described your machine. Hopefully someone with better Knowledge can explain why there's Mozilla in the front of the User Agent.
  10. Not to be jerk or anything but you technically should be using CSS. I understand if you don't understand CSS. But if you don't you should probably look into. You will run into much less problems with design that way.
  11. Instead of using html_enitity_decode() try html_entities. I say this because you have a character example '&'. Your code tells the the form to put a & inside. But the form outputs a &. It is slightly annoying. But what the form needs to see so it executes correctly is &amp;. The logic of that will make much more since when you see it in the form.
  12. If you are using the original install of PHP on your Mac then Uploading is disabled. You will need to edit your php.ini. Also file permissions must be set so you can write to the directory.
  13. All you need to read the browser is the User Agent. PHP includes a method for Apache servers using the global $_SERVER. <?php $userAgent = $_SERVER["HTTP_USER_AGENT"]; //Parse out the browser from here ?> Edit: I didn't realize this but PHP also offers a function called get_broswer(); But it will only work with certain PHP configurations. <?php $browser = get_browser(null, true); print_r($browser); ?>
  14. First off, your not a noob. We all started off somewhere. All you need to make this work is a some sort of variable that you can pass through to the script. So no matter what link your user clicks on he or she will always be sending a message to the php script. In this example I used a get var in the url query. I have it so each link has a section variable. The code below works in both php 4 and php 5 environments. The only thing that would need to be change is the HTTP_GET_VAR. PHP 5 doesn't use HTTP_GET_VARS anymore so it would need to be replaced with $_GET. <table> <tr> <td><a href="?section=home">Home</a></td> <td><a href="?section=about">About</a></td> <td><a href="?section=contact">Contact</a></td> </tr> <tr> <?php $section = $HTTP_GET_VARS["section"]; //$_GET if your using php5 if($section == "home") { include("home.php"); } if($section == "about") { include("about.php"); } if($section == "contact") { include("contact"); } ?> </tr> </table>
  15. It seems you can retrieve the file. To parse it I'd recommend DomDocument. You can find more documentation of it on http://docs.php.net/dom Using xml_parser_create is much dirtier to work with. The only disadvantage of DomDocument is you need strict xml. <?php $document = new DomDocument(); $document -> loadXML($string); $element = $document -> getElementById("someID"); ?>
×
×
  • 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.