Jump to content

TOA

Members
  • Posts

    623
  • Joined

  • Last visited

Contact Methods

  • Website URL
    http://www.toalabs.com

Profile Information

  • Gender
    Male
  • Location
    Minnesota, U.S.A

TOA's Achievements

Member

Member (2/5)

7

Reputation

  1. What you're describing is the basic functionality of a Learning Management System. They have content authoring programs that can embed quizzes and everything. The two I can think of off the top of my head are Lectura and Articulate. (Note, I have used Articulate in the past, but it's been a few years so their offerings may have changed.) If I remember correctly, you can host/run them from your own site. Don't re-invent the wheel if you don't have to. Hope that helps.
  2. Wordpress provides this to you in the loop as the_id() I think, but double check that. But to answer your question, here's how you'd do it: set meta_value = '5' where meta_key = '_price' AND post_id=(select post_id from postmeta where meta_key = '_sku' and meta_value = 'GF-1370') But use the post_id wordpress gives you, it's a much cleaner query
  3. I hate the way wordpress does tables, but I digress...You'll need to use the post_id to update the price, price is not actually in that record set meta_value = '5' where meta_key = '_price' AND post_id='4356'
  4. I believe what you want is CURLOPT_RETURNTRANSFER
  5. TOA

    Classes

    Global will work, but is not advised. Inject the dependency. Again, using globals is not advised.
  6. Delete line 24 and replace line 25 with this: $select = mysql_query("SELECT racun FROM clanovi_njihovi_racuni WHERE datum_unosa=CURDATE()"); curdate() is not a php function, it's a mysql function.
  7. Again I say, step back and start at the beginning. You're trying to run before you crawl. This has everything to get you started. http://www.php.net/manual/en/language.oop5.basic.php
  8. You're getting that error because the getName function is not defined in the user class. Sorry, I should have been clearer about that. You'll need to define that method and give it the needed functionality to return the author's name. And for what it's worth, author is a better name than user, it's clearer. You should really step back and learn the basics though. It seems like you might be getting ahead of yourself.
  9. Well besides the posts by ignace and KevinM1, which gave you alot of what you needed, Symphony has a pretty good article about moving from procedural to OOP, but I have to postface it with: OOP requires a different kind of thinking, so this will only get you so far into the OOP world. This is just a good place to get your feet wet. That being said, my first comment is: is a user a type of comment? Not in my mind, so you'd need a User object to pass into your comment object (dependency injection) which then gets assigned to the private $author property. Does that make sense? Always ask yourself 'is this a type of that' and if the answer is No, then it is a good place for a new class. So it would look like this $User = new User; $comment = new Comment($User); // now to get the author of the comment, we'd echo $comment->author; // although this would cause an error because the property is private. We'd need to change it to public or create getters/setters Now to expand on that, we can convert your procedural code to be like this: if ($_POST) { // create our data pieces $user = new User($_POST ['name']); $commentContent = $_POST ['commentcontent']; $comment = new Comment($user, $commentContent); //not quite sue what this means /** * To answer this question, this is writing the data to a file called comments.html */ $handle = fopen("comments.html","a"); fwrite($handle, "<b>" . $comment->author->getName() . "</b>:<br/>" . $comment->getContent() . ",<br/>"); fclose($handle); } BTW, this is just an example. Hope it helps you get started.
  10. Colons are just an alternate syntax : http://php.net/manual/en/control-structures.alternative-syntax.php The '? :' combo is called ternary operator and is essentially an inline if statement: http://php.net/manual/en/language.operators.comparison.php
  11. That shouldn't be the case if both thankyou.php and email_success.php exist. Try full php opening tags: <?php instead of <? It might be that your server doesn't recognize shorttags..
  12. instead of $name = $GET_POST['fullname']; $email = $GET_POST['email']; $message = $GET_POST['message']; try $name = $_POST['fullname']; $email = $_POST['email']; $message = $_POST['message']; And it would be a good idea to read up on GET and POST in the manual.
  13. It would be mysqli_num_rows($query), not $dbc. The call to num_rows is made to the result set. And by getting a COUNT(), it will always return a result so checking for num_rows won't work. Either change your select, or fetch the results and check for > 0 there.
  14. Use your page id instead of $user in the api call
  15. $teacher is referring to (my best guess) $object1. And you need to start your echo with the object your calling - ie: $object2->age, not $firstname->age $teacher = new person('Boring','12345','12345'); $student = new person('Me','Myself',99); echo $student->age;
×
×
  • 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.