Jump to content

Shadowing

Members
  • Posts

    722
  • Joined

  • Last visited

Everything posted by Shadowing

  1. Oh thanks alot requinix had no idea it did that makes total sense though
  2. apparently if i dont do '1' it seraches for any 1's that exist geez didnt even know this
  3. Hey guys I dont really do a ton of sql statements in mysql but i did one today and the results puzzled me SELECT id,activation FROM users WHERE activation = 1
  4. lol guys opps my bad i gave the wrong numbers xyph you are awesome seriously thank you
  5. Hey guys im trying to figure out how to do this problem backwards $x = pow(1407, .5) / 25; this equals 2.5 what I really want to do is find the number 1407 by knowing what x is so the equation i need to figure out is like 2.5 = pow(x, .5) / 25; anyone know how to do this? im really stuck here lol
  6. Hey guys i ran into a wierd problem using firefox for some reason like sending account activation links turn into white pages example: http://www.stargatesystemlords.com/system_lords.php only does this with firefox. i can do this in firefox http://www.stargatesystemlords.com but I cant add file paths. anyone know why this happends, thanks one thing to add it runs the php code on the page but yet still white pages.
  7. lol nevermind, walked away from the computer for a minute and realize that is correct
  8. Hey guys im having a problem. This is crazy makes no sense at all. I am so stuck and out of answers on why this is happening I wrote this code out so anyone can just copy and paste it to see results $resource1_level_costs = 0; $resource1_highest_level = 2 + 1; $resource1_subtract = 50; $before_bonus_reduction = ''; while($resource1_level_costs < $resource1_subtract) { $before_bonus_reduction = pow($resource1_highest_level,3); $resource1_level_costs += ceil($before_bonus_reduction - ($before_bonus_reduction * .22)); $resource1_subtract -= $resource1_level_costs; ++$resource1_highest_level; echo $before_bonus_reduction." before deduction<br />"; echo $resource1_level_costs." after deduction<br />"; } The return is this 27 before deduction 22 after deduction 64 before deduction 72 after deduction takes 27 subtracts 22 percent giving 22 takes 64 subtracts 22 percent giving 72????? what the heck
  9. Thanks alot psycho i'll start doing that instead
  10. Also i was thinking is this the best way to delete more then one row from the data base? is there a way to do it where the query isnt in the loop? and make mysql do all the work?
  11. ahh i solved my problem lol not sure why i missed it decided to implode it one more time and the return wasnt what i expected so the array_diff was working as it should with the situation of what array2 contained but still though why cant i var_dump it, maybe the json_encode is messing it up?
  12. Thanks for the reply Psycho when I do var_dump or print_r error: trips that i set up stating not retreiving data so my php script is failing. the array does exist cause it works in the foreach statement. but now this is driving me crazy on why i cant simply output it back on my page to see the array obvious stuff is already checked the ajax return does work. I did $retun = 1; and it displayed it as a alert i set up on the page also i did impode on $_POST['association'] and shot it back to my page and it worked. function remove_saved_planet() { $return = var_dump($_POST['association']); echo json_encode(array("display" => $return)); } what is even more crazy is this decided to just rebuild the array so this way i know what its going to look like foreach($_POST['association'] AS $val) { $auto_id = (int) $val; $remove_save = "DELETE FROM save_planet WHERE auto_id= '".($auto_id)."'"; mysql_query($remove_save) or trigger_error("SQL", E_USER_ERROR); $array2[0] = $auto_id; } $array1 = $_SESSION['saved_planets']; $_SESSION['saved_planets'] = array_diff(array1,$array2); I could just delete the values from the array while its looping. driving me crazy on why this isnt working ha.
  13. hey guys im having problem getting array_diff to work. when I print_r on array1 it looks like ( [0] => 210643 [1] => 210641 [2] => 210648 [3] => 210650 ) my largest problem is i dont even know what the 2nd array looks like. I cant figure out how to see it. I'm checking check boxes on one screen then sending ito to a php page via ajax. The array works with my script using a foreach statement but now im trying to do more with it. im thinking the array looks like this (210643,210641,210648) so with out the keys $var = array_diff(array1,array2); my results in this is null. it makes $var null and if I flip the arrays around then it just makes $var equal array 1 I wish i could see what array2 looks like as an array how can i return this back to my page so i can alert with javascript? i hate how blind i am at the moment where i cant see what this 2nd array looks like. function remove() { $return = $_POST['association']; echo json_encode(array("display" => $return)); }
  14. oh i just reread your question onlyican example is exactly what you are requesting. Although you should beable to use post instead of a session. since you only need to save it for just the screen refresh
  15. Just to be clear as to what you are needing you want it so that when the user hits submit the page reloads stores data from a input field into the data base and it shows what he chose? And you want it to always show what he has chosen every time he comes back to that page? If that is right then you will have to query what he has in the data base. i assume your users have a session id right? So when the screen reloads it grabs the data out of the database and displays it as selected $results= "SELECT username FROM table WHERE user_id = '".($_SESSION['user_id'])."'"; $msql= mysql_query($results) or die(mysql_error()); $fetch = mysql_fetch_assoc($msql); <select name="username_1"><option value="John" <?php echo $fetch['username'] == 'John' ? 'selected="selected"' : ''; ?> >John</option></select>
  16. thanks shelestove I wasn't aware of how to concatenate a ternery in a string
  17. I would add there information to sessions. So it will be there on screen reload. but you can use $_POST also. acctually im not really sure untested but really you should beable to use $_POST['username_1']; so you dont even have to save it to a variable $_SESSION['username'] = $_POST['username_1']; <select name="username_1"> <option value="John" <?php echo $_SESSION['username'] == 'John' ? 'selected="selected"' : ''; ?> >John</option> </select> what this is saying is that if their user name equals what any of the ones in the drop down box then display it as selected
  18. Hey guys ive hit a wall trying to return this as a string. not sure what to do about the "'" issue. [php $return = " <option value='-43200' $time_offset == '-43200' ? 'selected="selected"' : ''; >(GMT -1200) national </option> <option value='-39600' $time_offset == '-39600' ? 'selected="selected"' : ''; >(GMT -1100) Samoa </option> <option value='-36000' $time_offset == '-36000' ? 'selected="selected"' : ''; >(GMT -1000) Hawaii </option> "; echo json_encode(array("display" => $return)); [/code]
  19. Figure out was causing it. was using mysql_real_escape_string before returning it
  20. wierd json_encode is adding the \n back in
  21. ehh i just tested that example i made and it works. so something else is wrong hmm im returning it using echo json_encode(array("display" => $test)); Then using jquery to html replace it into a div
  22. Hey guys im having a issue getting nl2br to work When im retrieving text from mysql it works fine but its not working just in a php variable. test test test test $test = "test\n\ntest\n\ntest\n\ntest"; $test = nl2br($test ); echo $test;
  23. Alright 2 months later and looking back over what you said lol really wish i understood this more Now i kinda know what class's are but i dont know what plubic static does and i notice this line where you are creating a blank function? private function __construct() {} Is using :: some sort of syntax for class's? oh boy
  24. Hey ManiacDan I was looking some stuff up today and came accross some stuff on mysql displaying what Memory was on table type. so if i used memory instead of InnoDB for the chat system wouldnt it be faster? doesnt it mean its all being stored on the servers memory?
×
×
  • 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.