Jump to content

Mr Nick

Members
  • Posts

    13
  • Joined

  • Last visited

    Never

Everything posted by Mr Nick

  1. I'm confused by the entire thing. If I'm only storing a maxlength of 3 digits, would it be recommended to use tinyint? Is there limits? What's the differences and advantages? Thank you.
  2. Mr Nick

    exec()

    I'm trying to open a batch file in php with these contents: @echo off java -classpath rscd.jar;lib/mina.jar;lib/xpp3.jar;lib/slf4j.jar;lib/xstream.jar;lib/hex-string.jar; org.rscdaemon.server.Server pause My PHP code is simply $run = "C:\\Users\\Zorian\\Desktop\\EasyRSC\\Server\\run-win.bat"; echo exec("cmd.exe /c " . $run); It should open up a java applet, instead it just echos: Press any key to continue . . .
  3. You could try and code in the months so it displays them as well... that's why it's not working. PS: I coded a better version of this.
  4. I have a variable, his name is $log_query['player_a_received']. What he equals always varies. He may be either "10=1000;32=23212;" or just "10;10". I would like to echo it so: 1. Something separates him from ";" 2. The first number that it gets separated from MUST be separated from the second one so I could echo them both. SORRY FOR MY HORRIBLE EXPLAINATION I SUCK AT LIFE =(
  5. Please wrap your coding in the code tags: [ code ] CODE GOES HERE [ /code ] No spaces in the tags.
  6. That's not exactly what I want to do . It's already outputting to "user1, user2, user3, " so the commas are already displaying. Just for the last part ("user3, "), I'd want the command removed and replaced with a period. EDIT: The actual variable ( $user_fetch['username'] ) is the actual usernames. There is no comma in this.
  7. So far my simple code works properly. It outputs: "user1, user2, user3, " However I'd like it to output: "user1, user2 and user3." while($user_fetch = $db->fetch_assoc($chars_fetch)){ echo $user_fetch['username'] . ', '; }
  8. Using ? and : is basically the same as using the if command. Although it depends what you're trying to do. I'll post a code using if first. $a = 0; $b = 0; $c = ""; if($a == $b){ $c = "A equals B"; } else { $c = "A does not equal B"; } $a = 0; $b = 0; $c = ""; $c = $a == $b ? "A equals B" : "A does not equal B"; Anyways, I've already solved this
  9. I apologize with the second method. I meant to use && instead of another ?. $order = isset($_GET['sort']) && in_array($_GET['sort'], $orders) ? $_GET['sort'] : "login";
  10. This isn't really a problem, I'm just looking for the best way to do this. I have a simple array that allows the different types of orders. What would be the best way to check and execute them? I've written a few and am wondering which would be the best to use. $orders = array("login", "gm", "email"); //Method 1 if(isset($_GET['order']) && in_array($_GET['order'], $orders)){ $order = $_GET['order']; } else { $order = 'login'; } //Method 2 $order = isset($_GET['sort']) ? in_array($_GET['sort'], $orders) ? $_GET['sort'] : "login" : "login"; //Method 3 $order = isset($_GET['sort']) ? $_GET['sort'] : "login"; $order = in_array($order, $orders) ? $order : "login"; I'll be using the same method to check for ASC and DESC. (This is sort of a MySQL question, but more on the php side so I'm putting it here).
×
×
  • 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.