Jump to content

premiso

Members
  • Posts

    6,951
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by premiso

  1. POST is just as insecure. You use whichever one is needed. For searches you want to use GET so they can be linked / bookmarked. Where as submitting forms with a bunch of data you want to use POST due to the size limitations of GET. But either method is "insecure" if you do not filter the data.
  2. You can easily use an if / else statement for what you want as PFM stated: if (!mysql_query($query)) { // set error var here }
  3. Please do not take me for a fool. I understand perfectly what he wants and provided the way for it. He already knows how to loop through MySQL data, he just did not understand how he could differentiate the player / target. The new query just pulls more columns for him to utilize a bit easier to see who the player is and who their target is. If he wanted help grabbing the data he would have specified that he could not fetch the data instead of
  4. $query = "SELECT p.id AS pid, p.first_name AS pfirst, p.last_name AS plast, t.id AS tid, t.first_name AS tfirst, t.last_name AS tlast FROM players p, players t WHERE p.current_target = t.id_number ORDER BY p.id"; Note, when accessing the associative array you will use "pid" to grab the player id, "tid" to grab the target id, etc etc.
  5. He is using mysqli_query note the i In mysqli the connection is needed before the query. (Just an FYI).
  6. Post the code you are referring to and what the goal of it is. You can look into case / switch statement instead but it all depends on what the code is etc. Without seeing the code we cannot effectively tell you the proper method or show you a better way to do the checks.
  7. You can combine the queries pretty easily: $query = "SELECT t.first_name, t.last_name FROM players p, players t WHERE p.current_target = t.id_number ORDER BY p.id"; That will give you the target of players ordered by the player id. This way you only have 1 loop and 1 query. The above is untested, but hopefully you can see / understand what is going on. If not let me know but try and implement first.
  8. http://dev.mysql.com/doc/refman/5.0/en/ansi-diff-transactions.html Read up on MySQL Transactions as you can Lock tables from being changed while running a script. EDIT: As Daniel stated. Also a decent article here: http://www.databasejournal.com/features/mysql/article.php/3382171/Transactions-in-MySQL.htm
  9. I love widescreen and bigger, currently sporting tripple 24" monitors and I love it But as far as height, if you really want Height WS is perfect, as you can rotate the monitor (with most video card software) to display the length of the widescreen, it is great for coding, a ton of height!
  10. That is why he posted a reference to the manual for parse_url If you were to click on that link they show an example of usage: Perhaps reading that / reading through the user comments on that manual page will help you figure it out. You can use that to see if http is in the url, if it is not you add it. Alternatively you can use a stristr to locate if the http:// is in the url (which this can be tricked if there is a query parameter with http://), so I would suggest using the parse_url method.
  11. You may want to read: or die() must die.
  12. There is, I used to use it before I setup my 2 computers I think it was called: multimon. The free version works well. As far as the quadcore, that would be nice I am not that "lucky" to have one of them, I just have a Pentium Centrino processor at work (yea cheap bastards) and at home I am not willing to dish out the cash for a new pc (I have had mine since about 2003 and have upgraded). I mean I am still running a 5400 rpm 80GB IDE hdd and I do not have any Sata ports, it is not USB 2.0 (had to buy a pci card for that) and the Video card is AGP 4x. Maybe one of these days I will want a new pc, but it works just fine for what I use it for (mainly a file/download server) and use my P Centrino laptop to code on. But maybe in the future I will upgrade, so far though it runs as fast as I need it to.
  13. It is very nice, watching a movies while playing video games or even messing with videos such as compressing / converting DVDs etc. 2 separate processors / memory etc > 1
  14. Well using the method I provided you can just set the timezone to be that PST time, what would be the problem with doing that? Simply do this at the top of your script: ini_set("date.timezone", "US/Pacific"); That will set all times for that script to be pacific time. Is that not what you want?
  15. You want to use the modulus ( % ) operator. $i=0; $x = 10; while ($i < $x) { if (($i % 2) == 0) echo "White <br />"; else echo "Grey <br />"; $i++; } Is a rough example of how you would use it.
  16. Right, read up on glob. Given that you just posted the same question I take it you did not even bother to look into that function at all. As if you would have looked at the first example: <?php foreach (glob("*.txt") as $filename) { echo "$filename size " . filesize($filename) . "\n"; } ?> You would have an outline for what you need to do to get your images.
  17. With synergy, there is another bug that the right shift does not work as well. Not hard, you just have to remember to use the left shift But so far I like it, it works pretty good for my uses.
  18. Look into using glob as that should get you what you want.
  19. To answer the question: $query="select last_insert_id() as LastID from stock"; $result = mysql_query($query) or trigger_error("Error in SQL: " . mysql_error()); $lastID = mysql_result($result, 0, 0); echo $lastID; Note that is how you obtain 1 field from the first row returned by the query, if you have multiple rows you want returned I would suggest looking into mysql_fetch_assoc (and notice the user comments for some usage).
  20. At work I have 3 all 3 setup to different computers which I connect to each other using: http://synergy2.sourceforge.net/ [ Monitor 1] [ Monitor 2 ] [ Monitor 3 ] The 3 different computers allows me to do 3 separate tasks, such as creating images etc. I do not code for my job, so they are not used for coding at all, just viewing different documents / email / setting up images etc, I also use a KVM switch so I can use just that particular computer if I need to. 3 x the processing power is pretty nice, cause I do not get slowed down when I am pushing images to computers or making them etc, which is nice.
  21. You can easily try this out: <?php if (isset($_POST['submit'])) { echo "Test without nl2br(): " . $_POST['test'] . "<br />"; echo "Test with nl2br(): " . nl2br($_POST['test']) . "<br />"; } ?> <form method="post" action=""> <textarea name="test"></textarea> <br /><input type="submit" name="submit" value="submit!" /> </form> And see how it works. If the second text contains <br />'s then yes they contain \n characters. Alternatively, you can do a strstr for "\n" to check if one is contained in the string. Or if you wanted to visually see them do a str_replace and replace \n with /n and it will show you where they are.
  22. It seems to possibly something with how your MySQL is setup as: C:\mysql\\share\charsets\ is not a valid path (Unless you can type that in Windows Explorer and browse to it). I would look into your MySQL setup and possibly do a re-install of MySQL.
  23. Gotcha, that does make sense. As far as them including the extras, it will be nice; however, I just do not see why that would matter if they included them or not, but oh well. I guess I do not have to be able to see why
  24. I am not sure, but I think you need to select the database first. Switch around the select_db and the charset and see if that works.
  25. When I was coding in .NET Studio with SQL Server, they were a god send for the C# / ASP applications we were working on. Also when I used them in Oracle for an old database to pull up reports they were pretty awesome. It all depends on how you need to use them. I have never used them in MySQL, so I cannot vouch for that.
×
×
  • 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.