Jump to content

trq

Staff Alumni
  • Posts

    30,999
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by trq

  1. It is a normal get or post request.
  2. This topic has been moved to Editor Help (Dreamweaver, Zend, etc). http://www.phpfreaks.com/forums/index.php?topic=340604.0
  3. Assuming $result is the result of a call to mysql_query. No. You would need to loop through that result. <?php $sql = "SELECT a, b FROM table;"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { echo '<script>'; echo 'var a = [];'; while ($row = mysql_fetch_assoc($result)) { echo " a[{$row['a']}] = '{$row['b']}';" } echo '</script>'; }; }
  4. append appends a child to a parent. You would need to put all your divs in a wrapper and append your new div (which your not currently creating) to that. <div id="stage"> <div id="delete_news_3">3</div> <div id="delete_news_7">7</div> <div id="delete_news_8">8</div> </div> Then: $('.delete_news_button').click(function() { $('.news_id').each(function() { // loop through each news_id form element var id = $(this).val(); // get the current id var div = $('<div />'); // this creates a new div div.attr('id', id); // assign the id to the new array $('stage').append(div); // append to the stage wrapper. }); });
  5. That tutorial is indeed a VERY bad example of OOP. While it might use a few classes, the entire approach isn't OOP at all. The book you said you have 'Objects, Patterns & Practice' is probably the best resource getting around.
  6. This topic has been moved to Installation in Windows. http://www.phpfreaks.com/forums/index.php?topic=340597.0
  7. There already exists classes built into php for doing this. See mysqli or pdo.
  8. It's no different to outputting any html markup. <?php $a = array('foo' => 'bar', 'bob' => 'boo'); echo '<script>'; echo 'var a = [];'; foreach ($a as $k => $v) { echo " a[$k] = $v;"; } echo '</script>';
  9. What are you trying to do? And please, post completed markup, not php.
  10. if your using jQuery, stick with it. $('.delete_news_button').click(function() { var id = $('.news_id').val(); $('#delete_id_'+id).append(id); }); It's hard to give a working example without knowing what the news_id element your trying to refer to actually is. The above assumes it's an input of some type.
  11. Why are you using http to call files on your own server?
  12. Depending on your distro the /etc/sudoers file should be pretty well commented. You can give certain user access to sudo specific commands. You will also need to allow this user to execute sudo without being prompted for a password. There is a good example here: http://www.gratisoft.us/sudo/sample.sudoers which is the first Google result I found. echo shell_exec($cmd);
  13. You should be getting a fatal error. Your call to header() is in between the } and else, this is invalid.
  14. shell_exec returns the output of the command as a string. That second command you posted makes no sense, and the first one, your server won't have permission to execute. You would need to grant your servers process access via sudo.
  15. http://www.phpfreaks.com/forums/index.php?board=41.0
  16. It should definitely exist, I should imagine it would actually be a fair amount of work to remove. Check your php.ini to see that it's not disabled.
  17. Have you got error reporting enabled? Speaking of handling errors. Your not bothering to check your query even works before using it's result.
  18. This topic has been moved to PHP Installation & Configuration. http://www.phpfreaks.com/forums/index.php?topic=340530.0
×
×
  • 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.