Jump to content

IThinkMyBrainHurts

Members
  • Posts

    51
  • Joined

  • Last visited

  • Days Won

    1

IThinkMyBrainHurts last won the day on April 20 2015

IThinkMyBrainHurts had the most liked content!

Profile Information

  • Gender
    Male

IThinkMyBrainHurts's Achievements

Newbie

Newbie (1/5)

3

Reputation

  1. I believe PHP is a progression of C++, that said C++ and Java are very similar in coding style. Also C++ uses a whole lot of the same function names as PHP, which stems from the original C libraries. Java is very portable but, mmm very slow, C++ beats it hands down, hence why the majority of games are written in C++. As Requinix say's,it depends on what you want to do. If you're writing system programs, drivers, serious number cruncher's, simulators etc then it's C++ all the way. On the other hand if you want to write something once and quickly then Java is your bag, it's more akin to a bag of tricks. This bag of tricks is very adaptable and is being used for some very adaptable applications. From having a look at the job market recently, there seems to be a whole lot more C# job adverts than Java, in my area!?
  2. Hi, I'm after compiling a list of responsive menus that only use CSS, no JS allowed!!! Ideally they're to handle at least 3 levels, but 2 levels passable Cheers and hope you lot find this list useful too...
  3. lol, cheers, just advert answering anyway
  4. In your chatbox code, you set $id with something uninitialized / non-existent, so that will be null. $id=$rows['id']; Then you build the delete link, again with a null value. $dellink="<a href=\"delete.php?id=" . $id . "\"> Delete </a>"; Then you add the same link to all the items: while($row=mysql_fetch_array($result)){ //list the comments echo $row['name'] . "<br>" . $row['comment']."<br /> . $dellink .<br><hr>"; } In reality the link should be constructed in the loop where you can actually access the id! So something like this: while($row=mysql_fetch_array($result)){ echo $row['name'] . "<br>" . $row['comment']."<br /><a href=\"delete.php?id=" . $row['id'] . "\"> Delete </a><br><hr>"; }
  5. You are aware of the LIMIT keyword in databases?
  6. I don't get why you're caching them to file at all! Especially why get them all, store them again and then show some, why not just get some and dump 'em out to the client, much more efficient on the DB, file and PHP parser...
  7. The original is simplest in my view, however a wrapper class for this specific query could look like this (untested): class my_xyz_query{ private $id = null; private $name = null; private $parms = null; public function__construct($name="",$id=""){ $this->parms=array(); $this->parms[] = array(':id',$id,PDO::PARAM_INT); $this->parms[] = array(':name',$name,PDO::PARAM_STR); } public function set_name($name){ $this->name=$name; } public function set_id($id){ $this->id=$id; } public function get_parms(){ $this->parms[0][1]=$this->id; $this->parms[1][1]=$this->name; return $this->params; } }
  8. Well if you can't do it at that level then you'll have to either use the lookup method mentioned before or refactor it before storing in the txt file db thing you're using! A txt file, how are you parsing that? Is that optimal???
  9. Wouldn't this only get the Body section and not the whole page? var x = $("body").html();EDIT:Here's how to get the lot, depending on how much: http://stackoverflow.com/questions/982717/how-do-i-get-the-entire-pages-html-with-jquery
  10. You could build a separate array of keys and use that for access. However you'd have to build it. Which leads to... I may have another way but would be easier to see the get_posts() function! However, when you say cache, are you storing all these in a session variable? Else, you're retrieving it all again anyway...!?
  11. If that's all in a class then you'd access the variable using $this->storeID Oh, please edit your post and use code tags to wrap your code!!!
  12. 1. All worked for me, no errors 2. Followed latest URL and the the PHP in the HTML file wasn't being parsed! That probably means your server isn't configured to parse PHP within HTML files! - Simple solution, rename files to .php - Add the right AddType config, see examples here: http://stackoverflow.com/questions/6295141/server-not-parsing-html-as-php
  13. Can I see the latest index.php please?
  14. Is that in a loop, else $optid is redundant... AFAIK str_repeat() just repeats a string, nothing special.
×
×
  • 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.