Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. okay the way HEREDOC works is you can use an identifier to specify the start and the end of what you want quoted. It pretty much has the same naming conventions as variables. In your code, you use "STUFF" as the identifier but you end it with "BLAH" you need to end it with "STUFF" echo <<<STUFF <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <body> STUFF; The <<< tells php that the next thing you put will be the identifier. Now here's the thing: There cannot be anything after your identifier. No code, comments, even a space. Same thing goes for when you are ending it. "STUFF;" needs to be on its own separate line with nothing before or after it, except for the ;
  2. p.s.- I don't recommend putting posted vars directly into a query string. you should at the very minimum do this: foreach ($_POST as $key => $val) { $$key = mysql_real_escape_string($val); } $sql="INSERT INTO fines (profile_id, fine_amount, reason) VALUES ('$name','$amount','$reason')";
  3. -You didn't specify a method in your form tag. You need to put method = 'post' in that tag if you wish to use $_POST array. - You may or may not also have issues with your vars in your query string. Change it to this: $sql="INSERT INTO fines (profile_id, fine_amount, reason) VALUES ('{$_POST['name']}','{$_POST['amount']}','{$_POST['reason']}')";
  4. That does run the query. It assigns the result source to the variable.
  5. also you need to pass the result source as an argument for that
  6. If it were someone I knew I'd do it for free, seeing as how that's like a 2 second job. But if I were gonna charge someone, I'd charge like $20 for that.
  7. Okay I lied it seems to be doing the same thing further down as well, even if I put it on one line. Perhaps you should look into using HEREDOC instead? Like: echo <<<BLAH formstuff here BLAH;
  8. hmm..well i c/p'ed it into my editor and it doesn't seem to like this here: echo '<table id="employees"> <tr> <td> <select name="emp_id" onchange="this.form.submit()" /> '; It works fine if I put it all on 1 line but for some reason it don't wanna work on separate lines like that. The quote ' don't seem to want to close, so it's throwing all your other quotes off after that. You seem to have the same style in other places as well, but those seem to work just fine. I'm kind of at a loss as to why that is...but it does seem to work if I put it on one line.
  9. You have them right, syntactically.
  10. query as in sql query string or are you talking about what you see in your url bar?
  11. got a line number to help narrow it down?
  12. $qColumnNames = mysql_query("SHOW COLUMNS FROM table LIKE 'cx%'") or die("mysql error"); $numColumns = mysql_num_rows($qColumnNames); $x = 0; while ($x < $numColumns) { $colname = mysql_fetch_row($qColumnNames); $col .= $colname[$x] . ","; $x++; } $col = rtrim($col,',');
  13. Post some code please, particularly your query string.
  14. Yay spam filters FTW. At the end of the day even if all your i's are dotted and t's are crossed, it could still be labeled as spam if your server has had past issues of sending out spam (like if you're on a shared server and other people have used it for such things) so all you can really do is make sure all your ducks are lined up in a row...and then make a statement to the receiver (wherever applicable) to check their spam/junkmail box.
  15. keeps executing even before the cron? Did you manage to make more than one cron job? Perhaps you wrote the cron job wrong and it's executing more than you expect it to? Perhaps you have some other script executing it?
  16. Thread closed. You already asked this in your other thread, and you already got an answer.
  17. Your syntax error is because all this code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Novo Nordisk Selling Skills Recommended Follow-up Results page</title> <link rel="stylesheet" href="Global.css" type="text/css" media="screen, handheld" /> </head> <body> is not in some kind of echo or variable assignment or php tag closed before it or whatever you can do to make php know that that's just text and not code to be parsed. As far as setting session variables: is the session variable named 'name' ? or is it named something in the $Name variable? If it's the first, then take off the $ in '$Name' if it's the second then remove the ' ' around it. The $_POST['Name'] means that you are assigning a posted variable to your session variable, so I assume that this page is a target of some form?
  18. Okay seriously man, you're starting to get out of line. You have been given 2 examples of how to condition a loop to display something every X lines, just like you asked for. They spit out numbers because they are example scripts, meant to display the principle for what you are asking for. You have to take that principle and apply it to your own script. You asked for how to do something, and you were given examples that do exactly what you asked for. It seems pretty obvious to me that you simply don't grasp the concept of applying the principle of one piece of code to another, and that's fine. I'm not judging. But you need to make a much more concerted effort on your part if you wish to get anywhere with your code. Yelling and screaming at us saying that we aren't being helpful just because you can't take the example, copy and paste it into your script and it magically works, is not making a concerted effort. I am closing your thread, as your question has been answered. I'm sorry that you don't understand it, but it has been answered, nonetheless. Instead of being grateful to those who have helped on their own free time, you've been rude and snippy and lazy.
  19. You asked for some thing to be displayed every X amount of rows. That's what my script did. You even posted the output. So either you aren't being clear about what you want or...
  20. You make a loop with a condition in it. Or you put a condition in your existing loop. You know, like the example I already showed you.
  21. I gave you an example loop that displays something after X amount of displayed rows, just like you asked for. No offense, but if you can't make sense of a simple condition inside a simple loop, then maybe you aren't the decent php hack you say you are. There really isn't anything more we can do for you, short of doing your work for you, which is something we don't do. People do that sort of thing for money.
  22. that's an example of how to get something to display every 5 lines. You would have to integrate that principle into your own code, yes.
  23. $y = 5; // number of rows to display per text $text = "blahblahblah<br />"; // text to display // example loop for ($x = 0; $x < 100; $x++) { echo (($x % $y) == 0)? $text : ""; echo "$x <br />"; }
  24. so..you're wanting your movies to have a rating, 1-5, and there's a column in your database table that specifies that, and you want to be able to get the rating, and display the correct amount of stars? Is your star image just a single image that you display x amount of them based on rating? Make a loop. Do you have 5 different images, one for each rating? If they are all named like 1star.gif, 2star.gif, 3star.gif, etc.. then simply concat the rating onto "star.gif" like // retrieve rating from db and put it into $rating echo "<img src = '{$rating}star.gif'";
  25. .josh

    PHP script

    I remember back in the day when I was into those sort of games there was (is, apparently) a game called Kings of Chaos and you could buy their previous "age" (version) for like $100. But that was like 5 years ago.
×
×
  • 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.