Jump to content

trq

Staff Alumni
  • Posts

    30,999
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by trq

  1. I think it depends what field your interested in. C# is popular in the enterprise because unfortunately, there are still allot of enterprises that rely on Windows, mostly because it's what there users use. Are you interested in Linux? Python really is becoming the new Perl IMO. If you like working in a Linux environment, there are plenty of well paying jobs as a Perl or Python programmer. Python is an awesome tool, and one that I truly believe is going to be around for the long haul. it comes standard on most distros now because so many systems rely on it as a dependency. Of course, if you don't mind working in Windows (I personally can't stand it) C# is probably your better option.
  2. This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=321319.0
  3. This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=321311.0
  4. There are far too many variables to answer that question. Facebook would be considered a web2.0 website wouldn't it? Are you going to need as much resources as facebook? Not likely.
  5. You would need to use two separate queries.
  6. Javascript executes on the client, while php, on the server. The only way to get a variable from the client, back to the server is to make another request. This can either be done by making a new http request and refreshing the entire page or via an Ajax call.
  7. <?php if (isset($_POST['username'])) { $username = mysql_real_escape_string($_POST['username']); if ($result = mysql_query("SELECT group FROM users WHERE username = '$username' && group = 'GroupA' LIMIT 1")) { if (mysql_num_rows($result)) { echo "Welcome Admin!"; } else { echo "You are not authorised."; } } }
  8. This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=321302.0
  9. Did you look at my first reply or are you just choosing to ignore good advice?
  10. A few things. Firstly variables are not interpolated within single quotes, so '$checkadmin' is simply a string. Secondly, strings need to be surrounded by quotes, so GroupA will likley be an undefined constant. Thirdly, mysql_query returns a result resource, this needs to be passed to one of the mysql_fetch_* functions in order to retrieve any actual data. See mysql_fetch_assoc. Fourthly, why not simply query for the data you want in the first place? Lastly, you have no error handling at all. <?php if (isset($_POST['username'])) { $username = mysql_real_escape_string($_POST['username']); if ($result = mysql_query("SELECT Group FROM users WHERE Username = '$username' && Group = 'GroupA' LIMIT 1")) { if (mysql_num_rows($result)) { echo "Welcome Admin!"; } else { echo "You are not authorised."; } } }
  11. $sql = "SELECT * FROM users WHERE username IN('" . implode("','", $users) . "')";
  12. No. You would either need to background it from the start or not. Your question is OS related, not really php.
  13. You cannot schedule jobs with php. You need to use your servers scheduler (Cron on Linux, Scheduled tasks) on windows to execute whatever script you want.
  14. I think you might have misread the ops question.
  15. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=321234.0
  16. It's not simply that black and white.
  17. trq

    like to learn

    I would start by learning hp first. Your not going to be able to program php (if that is what your wanting to do) without it.
  18. including a remote file via include or require only makes a http request for the file. this means you only actually receive the output of the included file, not the functions or variables contained within it. There is no way to do this without users actually downloading code that you provide..
  19. That is a shortcut of.... ($document).ready(function() {});
  20. This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=321218.0
  21. This topic has been moved to PHP Coding Help. http://www.phpfreaks.com/forums/index.php?topic=321214.0
  22. You can't store php in a database and have it executed. Not efficiently or securlly anyway. So, place holder like this... $THEME[bordercolor] would need to be replaced with something like {bordercolor}. All you need to then is store the template in the database just like anything else. When you retrieve it, you simply replace your placeholders with there data. eg; $bordercolor = '#ddd'; $sql = "SELECT template_data WHERE template_name = 'foo' LIMIT 1"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { $row = mysql_fetch_assoc($result); $template = str_replace('{bordercolor}', $bordercolor, $row['template_data']); echo $template; } } That's the basics of it. You might end up needing to use preg_replace as replacements become more complex. I'll say it again though. Templates & template engines are IMO a waste of resources.
  23. Are you using the complete <?php ?> tags?
×
×
  • 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.