Jump to content

GingerRobot

Staff Alumni
  • Posts

    4,082
  • Joined

  • Last visited

Everything posted by GingerRobot

  1. Umm, i'd use a combination of date() and strtotime() Something like: $date = '2008-09-17'; echo date('d-m-Y',strtotime($date)+60*60*24*30);
  2. Mainly because people were incapable of using the correct one at the correct time.
  3. Well, I'm about to embark on a university course - a four year masters in computer science. I've a couple different reasons why I'd much rather do this than just get a job/freelance as a web developer. Firstly, I think the experience of uni will be something well worth getting both for personal and academic development. Second, I'm fairly confident I'd get bored after a while if I did web development. That's just the kind of person I am - I know ill need to change what I do otherwise I'll become bored. And tied into that is the fact that a university degree gives me far more options. I need not stay in the computing field at all with the degree if I dont want to. All of that was a roundabout way of saying that it really depends on you as a person. You'll have more options if you go and get a good degree, but if you know you want to stick with, say, web development then there might not be much point. From a purely salary orientated point of view, you'd probably make most money by going and getting a cs degree and working for a big bank. Might not be as much fun, however.
  4. That's called pagination. There's a very good tutorial on the subject here: http://www.phpfreaks.com/tutorial/basic-pagination
  5. It means that there isn't an element in the $_POST array called login. I would assume you are expecting that there should be, so check the spelling of your form's name - don't forget it is case sensitive. Other than that, we'd need to see some more code to help you further.
  6. The only thing you need to check for the display of the next link is whether or not you're on the last page. E.g. if($current_page != $total_pages){ //display next link } If you're struggling, it might be worth reading through this tutorial: http://www.phpfreaks.com/tutorial/basic-pagination
  7. 1.) You need to set the position to 1, not 0: SELECT SUBSTRING(Ordernum,1, $len) 2.) Exactly like that
  8. Or no braces at all. Didn't even notice the brackets on first glance. Should either be: require_once $docroot.'rss/rss.inc'; Or: require_once ($docroot.'rss/rss.inc');
  9. Bit confused as to what you're actually trying to achieve. Are you trying to find the sum of the 'pld' for each different id? Or each different name? Or something entirely different?
  10. Presumably you own the other site then? Seems a bit pointless to spend time parsing the HTML - wouldn't it just be easier to give the other site (which i'm assume you want to display this data on?) access to the database of the first?
  11. You really shouldn't be storing data like this. I would expect an order table to have an order number and user id of the user who ordered the item - you therefore shouldn't be storing the user's name in the order table, and certainly not as part of the order number. It would be worthwhile reading up on database normalisation. However, as an immediate solution to your problem, you should use the MySQL SUBSTRING function. You can then select only those rows where the first part on the order number is the username. This would also prevent the inefficient method of selecting all the rows and cycling through them.
  12. lol The thing i find funny was that some people seemed to be relieved that we were still here after it was turned on yesterday, failing to realise that they've not actually collided anything yet.
  13. There's no point in casting a GET variable as a string. If you don't do anything with it, it'll be treated as a string anyway.
  14. And what about SQL injection?
  15. Your particular problem is that variables inside single quotes are not parsed. They are treated as literals. Variables inside double quotes are parsed. As an illustration, try running this: <?php $foo = 'bar'; echo '$foo'; //echos $foo echo '<br />'; echo "$foo"; //echos bar echo '<br />'; echo $foo; //echos bar ?> You have a few options to solve your problem. The two most useful are to either replace those single quotes with doubles: echo "Welcome back. $name"; Or to use single quotes and some concatenation (joining, if you prefer): echo 'Welcome back. '.$name; //the . operator is the concatenation operator As to which you chose, it's largely a matter of personal preference. There is a very very slight increase in performance by using single quotes, since the text inside the quotes need not be parsed. For all practical applications, the difference wouldn't be noticeable, however. There is also a further problem with your script in this line: if ($name == admin && $password == password) The strings admin and password should be contained in quotes - all strings should. Unquoted strings are what are called constants. You can read more about those here. The php engine isn't stupid, however. If it finds an undeclared constant, it assumes that you mean to use the string. However, depending on your error reporting level, you could receive a notice. And it's bad practice to not quote your strings. Therefore, the line should be: if ($name == 'admin' && $password == 'password') p.s. Welcome to the forums.
  16. Agreed. It would depend on many things including the extent to which language x is better suited than y, whether or not it's just a matter of opinion, the difficulty of learning language x and the future opportunities for using language x.
  17. Not sure I agree - i think the question of "which is the better language,x or y for this particular application?" is a valid question.
  18. This is why I prefer to have any and all forms submit to themselves and have the processing done on the same page. It negates the need to transfer information back to the previous page. In any case, for an introduction to sessions, I would suggest the examples in the manual: http://uk3.php.net/manual/en/session.examples.php
  19. Well, it depends what you're trying to do. If its a CSS issue, then conditional comments are probably the way forward.
  20. You were missing a closing parenthesis in your query. Try: $result = mysql_query("SELECT COUNT(*) FROM administrators WHERE fice IN (SELECT fice FROM characteristics WHERE offering IN '".join("','",$f)."')") or die(mysql_error()); As for the array, I assume $_GET['highest_deg'] is the array of values you need to be matching against?
  21. Ok, so what doesn't work with it? What parts of the above requirements have you tried to implement?
  22. If you're asking what I think you are, see this post: http://www.phpfreaks.com/forums/index.php/topic,215379.msg984429.html#msg984429 The query in that post would return rows where the name is either tom,dick or harry.
×
×
  • 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.