Jump to content

viion

Members
  • Posts

    47
  • Joined

  • Last visited

    Never

Everything posted by viion

  1. Cant edit my post, marking solved as I've found a work around. Thank you for enlightment!
  2. Ah, damn I forgot that. Anyway I can get around it?
  3. I'm having a weird issue going on, I'm wondering if it has to do with my php.ini or server setup, anyway here is the code with the odly outcomes: echo date('Y/m/d H:i:s', 2145000000); // 2037/12/21 01:20:00 echo date('Y/m/d H:i:s', 2149000000); // 1901/12/31 01:58:24 echo date('Y/m/d H:i:s', 2150000000); // 1902/01/11 15:45:04 It seems after year 2037 it goes down to 1900+... Why would this happen? I've tried on 2 godaddy servers and local host and all same result
  4. I'm extremely confused why this is not working. the sql column names are correct, just something is not working, here are the 2 pieces of code, they do not run at the same time on the site infact the working piece i dont even use at the moment, but they're almost identical but the piecei need wont work! I'm using OO sql through mysqli btw. Here is the working code: $query = $db->query("SELECT * FROM countries WHERE value LIKE '$queryString%' LIMIT 10"); if($query) { while ($result = $query->fetch_object()) { echo '<li onClick="fill(\''.$result->value.'\');">'.$result->value.'</li>'; } } else { echo 'ERROR: There was a problem with the query.'; } Here is the piece that doesnt work, which i wish would. $query = $db->query("SELECT gamename, linkuser FROM ogd_projects_main LIMIT 10"); if($query) { while ($result = $query->fetch_object()) { echo $result->gamename; } } else { echo 'ERROR: There was a problem with the query.'; } Anyone notice anything wrong? When the second piece runs, it just stops the render of the page, anything below it will not be considered. Like die();
  5. I finally got this working, my error was a silly typo in another piece of code. Heh, proof reading pays off.
  6. I changed my statement (the == was a typo on here >.<) Removed the Array command in the $user->setList Added public function Still nothing working class items { var $item_list; public function setList($d1) { $this->item_list = $d1; } } $user = new items; $item_list=array("item1", "item2", "item3"); $user->setList($item_list); echo $user->item_list[1];
  7. I have a class setup and I want a var that is in the class to hold an array. This is how it's setup: class items { var $item_list; function setList($d1) { $this->item_list = $d1; } } $user = new items; Then upon loading the website this runs: $item_list==("item1", "item2", "item3"); $user->setList(array($item_list)); when I try pull one of the items though nothing seems to happen. Like this: $user->item_list[1];
  8. the query is very same but it's more like column='$date', column='$otherdata', and so on.
  9. I'm trying to order an event list by dates. What is the best way to go about doing this? I tried setting the field type to "date" but no matter what the value is, it just keeps inputting 00-00-0000
  10. okay thank you, i fixed it, some things in phpadmin had to change
  11. this is my code: function topPoints() { // Pull Array of characters from database. $top_members_b = mysql_query("SELECT ". CHARACTER_CONFIG_PLAYNAME .", ". CHARACTER_CONFIG_POINTS ." FROM ". CHARACTER_DATABASE ." ORDER BY ". CHARACTER_CONFIG_POINTS ." DESC LIMIT 0,10"); if (!$top_members_b) { echo("<div id='error'><img src='img/icons/icon_cross.png'>Characters could not be loaded from database: " . mysql_error() . "</div>"); } // Print Results while ($toplist_b = mysql_fetch_array($top_members_b)) { $top_char_b = $toplist_b[CHARACTER_CONFIG_PLAYNAME]; $top_total_b = $toplist_b[CHARACTER_CONFIG_POINTS]; echo "<strong>$top_total_b</strong> : <a href='?mode=profile&user=$top_char'>$top_char_b</a><br/>"; } } It's result is: 9 9 9 6 6 6 5 3 3 18 Why is it not putting things above 10 to the highest?
  12. How would I do powers in php? Like when you do 5 to the power of 5, it'd return 5x5x5x5x5 Is there a function to do this in php?
  13. The plan to this code is to create a kind of drop down menu depending on the category of the results pulled from SQL. The results would render Distinctively through their numbers. Outputting: 001, 002, 003, etc. Within the while function for them categorys, it'll also do another SQL and pull information from the same table dependant upon the current category it's rendering. This when page renders it'll notice first distinctive category is 000, then within that the second sql will pull all information regarding data in 000, then it'll loop until it finishes. The code generates a number of div's with titles, so when you click them it changes the style of a hidden dive to display:show, everything kinda works great but sometimes when you load the page it doesnt create the <a href link, its like skipping it, and im not sure what could be causing that? Anyone have any idea? The code below: function showResults() { global $possible_choice_array, $users_choice_array; $categorys = mysql_query("SELECT DISTINCT ". MONSTER_DATABASE_MOBCAT ." FROM ". MONSTER_DATABASE ." ORDER BY ". MONSTER_DATABASE_MOBCAT ." ASC"); if (!$categorys) { echo("<div id='error'><img src='img/icons/icon_cross.png'>Could not load items from data base: " . mysql_error() . "</div>"); } while ($cats = mysql_fetch_array($categorys)) { $category = $cats[MONSTER_DATABASE_MOBCAT]; if ($category=="000") { $categorytitle="Miscellaneous"; } if ($category=="001") { $categorytitle="SKY"; } if ($category=="002") { $categorytitle="SEA"; } if ($category=="003") { $categorytitle="DYNAMIS"; } if ($category=="004") { $categorytitle="EINHERJAR"; } if ($category=="005") { $categorytitle="ZNM"; } if ($category=="006") { $categorytitle="KSNM"; } if ($category=="007") { $categorytitle="OMEGA"; } if ($category=="008") { $categorytitle="SALVAGE"; } if ($category=="009") { $categorytitle="ASSAULT"; } // LOOPS ---------------- // THIS CODE SOMETIMES GETS SKIPPED UPON LOADING THE PAGE echo "<a href='#' onclick='categorylist(\"$category\");return false;'>"; // --- echo "<div id='wishlistcategory'>"; echo "<strong>$categorytitle</strong>"; echo "</div>"; echo "</a>"; echo "<div id='$category' style='display:none;'>"; // Possible Choices $possible_choice_sql = mysql_query("SELECT * FROM ". MONSTER_DATABASE ." WHERE ". MONSTER_DATABASE_MOBCAT ."='$category' ORDER BY ". MONSTER_DATABASE_MOBCAT ." ASC"); if (!$possible_choice_sql) { echo("<div id='error'><img src='img/icons/icon_cross.png'>Could not load items from data base: " . mysql_error() . "</div>"); } // Categorys // Print Results while ($possiblelist = mysql_fetch_array($possible_choice_sql)) { // ARRAY FROM POSSIBLE CHOICE SQL $nmID = $possiblelist[MONSTER_DATABASE_MOBID]; $possible_choice = $possiblelist[MONSTER_DATABASE_MOBDROP]; $possible_choice_name = $possiblelist[MONSTER_DATABASE_MOBNAME]; $possible_choice_area = $possiblelist[MONSTER_DATABASE_MOBZONE]; $possible_choice_reqi = $possiblelist[MONSTER_DATABASE_MOBREQI]; $possible_choice_array = explode("|", $possible_choice); // Count the number of values in array. $possible_choice_array_total = count($possible_choice_array); // Adjust Areas so | changes to a comma and a space. $items_needed = str_replace("|", ", ", "$possible_choice_reqi"); // ------------------------------------------------------------------- // Header of Table echo "<div id='wishTable-title'>"; echo "<a href='#' onclick='wishlist(\"nm$nmID\");return false;'><h2>$possible_choice_name</h2></a> <div id='mob-left'><strong>Location: $possible_choice_area</strong></div> <div id='mob-middle'><strong>Requirements:</strong> $items_needed</div> <div id='mob-right'><strong>Total Drops:</strong> $possible_choice_array_total</div> <div style='clear:both;'></div> <ul id='nm$nmID' style='display:none;'> <div id='wishTable-options'>"; showChoices(); echo "<div style='clear:both;'></span>"; echo "</div></ul>"; echo "</div>"; } echo "</div>"; // LOOPS ---------------- } }
  14. You have course year that is linked in as i can see all tables. So you could just make it print out courses that fit within the users course years. Eg courses years 2000-2001-2002-2003-2004, only 2001-2003 will be choosen for people who pick 2001-2003. I am guessing you could do this in sql i actually forgot the command and it could all depending on how course year is structued. If you're saving just say 2007, then you could do: Pull the users information "SELECT * FROM USERS do a while and output the course year into a variable such as $course_year, then in the while do: "SELECT * FROM courses WHERE CourseYear='$course_year'" this will only list courses that are in the year of the time that the student has input. A lot of your post is jumbled up and it's quite hard to understand exactly the purpose and mechanisms you're trying to do, if you're just listing courses it's a lot different than to add check box's and let users save courses or choose them.
  15. For the time issue im guessing you're using mktime() ? Or something to give back the unix. You could do this: function UpdateArcade() { $sql = mysql_query("Select id, game, timedate, name, MAX(score) FROM HighScores Group By game"); while($row = mysql_fetch_array($sql)) { $today = $row['timedate']; $time = $today['month'] . " " . $today['mday'] . ", " . $today['year']; $time .= " " . $today['hours'] . ":" . $today['minutes'] . ":" . $today['seconds']; echo "Game: " . $row['game'] . "<br>"; echo "Score: " . $row['MAX(score)'] . "<br>"; echo "Time: $time <br>"; echo "Name: " . $row['name'] . "<br>"; echo "<p>"; } } Is the max score the highest scored value by certain player? because if you're grouping by game, it's gunna group all that data and pick the Max Score obviously but it'll choose the first name. Maybe you could try. $sql = mysql_query("Select * FROM HighScores ORDER BY score DESC"); This will output like: GAME: UNO - SCORE 1000 - TIME: 12/3/2007 12:13:53 - NAME: Bob. GAME: CROSS - SCORE 800 - TIME: 12/3/2007 12:13:53 - NAME: Peter GAME: UNO - SCORE 710 - TIME: 12/3/2007 12:13:53 - NAME: Bob And so fourth. I don't know if that is specifically what you're after though.
  16. No you wont because you'd only input the data through a striplashes and or other functions. When it's pulled back it will be already clean in the database and will not require any fiddling.
  17. The thing is item1 could be anything, it's pulled from the database itself. I also didn't want it to list item1 multiple times when multiple people have it, i'd rather it group then output the names individually for that specific item. I actually figured out how to do it, it's probably a bad method, but i don't know it works fine and I couldn't find a better Approach. I did a cross-referencing method, so it'd pull the item from the database, then as it's rendering out the information for that item it would cross reference it to pull all the names from the database that the where pulleditem=item in where clause. This would then group the names individually. The code is below: Also the output, the only issue I have now is trying to find a way to count the number of times a specific name is found within the same while as cross-referencing. But it's hard because that's already truncated the columns by the group. function itemlist_group() { // Pull Item Information $itemtrack = mysql_query("SELECT DISTINCT * FROM ". ITEMTRACK_DATABASE ." GROUP BY ". ITEMTRACK_DATABASE_ITEM ." ORDER BY ". ITEMTRACK_DATABASE_ITEM ." ASC"); if (!$itemtrack) { echo("<div id='error'><img src='img/icons/icon_cross.png'>Item Track List could not be loaded: " . mysql_error() . "</div>"); } $itemtrack_total = mysql_num_rows($itemtrack); echo "<div id='itemlist'>"; echo "<strong><span id='item'><strong><span id='itemid'>ID</span> ITEM</strong></span><span id='char'><strong>CHARACTERS</strong></span></strong><span id='date'><strong>DATE</strong></span><span id='type'><strong>TYPE</strong></span><span id='delete'><strong><em>Cannot Delete Groups</em></strong></span>"; echo "<div style='clear:both'></div>"; echo "</div>"; echo "<div id='itemlist'>"; while ($itemlist = mysql_fetch_array($itemtrack)) { $itemID = $itemlist[iTEMTRACK_DATABASE_ID]; $itemname = $itemlist[iTEMTRACK_DATABASE_ITEM]; $itemchar = $itemlist[iTEMTRACK_DATABASE_CHARACTER]; $itemdate = $itemlist[iTEMTRACK_DATABASE_DATE]; $itemtype = $itemlist[iTEMTRACK_DATABASE_TYPE]; $itemtrack_group = mysql_query("SELECT DISTINCT COUNT(*) FROM ". ITEMTRACK_DATABASE ." WHERE ". ITEMTRACK_DATABASE_ITEM ." LIKE '$itemname%'"); $itemtrack_print = mysql_fetch_row($itemtrack_group); // List Items echo "<span id='item'><span id='itemid'>$itemID</span>$itemname (<span id='en-green2'>$itemtrack_print[0]</span>)</span><span id='char'>"; // Pring Results $ONcharacter = ""; $itemtrack_check = mysql_query("SELECT ". ITEMTRACK_DATABASE_CHARACTER .", ". ITEMTRACK_DATABASE_ITEM ." FROM ". ITEMTRACK_DATABASE ." WHERE ". ITEMTRACK_DATABASE_ITEM ."='$itemname' GROUP BY ". ITEMTRACK_DATABASE_CHARACTER .""); while ($checklist = mysql_fetch_array($itemtrack_check)) { $charcheck = $checklist[iTEMTRACK_DATABASE_CHARACTER]; $itemcheck = $checklist[iTEMTRACK_DATABASE_ITEM]; $ONcharacter .= "$charcheck "; } echo "$ONcharacter"; echo "</span><span id='date'>$itemdate</span><span id='type'>$itemtype</span>"; echo "<div style='clear:both'></div>"; } echo "</div>"; } Result: Hope it helps someone. PS. If anyone confused why output says like test (6) but shows 4 names, this is because 1 of the names has 3 of the item "test" and it's grouped them names together rather than showing the same name 3 times. This is why i'd like to find out how many items they are per name found so it can say Name (x1) AnotherName (x3) and so fourth.
  18. I have a piece of coding like this: $itemtrack = mysql_query("SELECT DISTINCT * FROM ". ITEMTRACK_DATABASE ." GROUP BY ". ITEMTRACK_DATABASE_ITEM ." ORDER BY ". ITEMTRACK_DATABASE_ITEM ." ASC"); This will work fine but when outputting the information, it'll only display for example the first value of the group. So if table looks similar to: id1 - John - item1 id2 - John - Item1 id2 - Joe - Item 1 When grouping all item 1, outputting the mysql_Fetch_Array on it will just output John. How do I make it list both John/Joe in some sort of array?
  19. How do I get the variable of the group to output the number? Atm I do something like: (this is by item, not user, but same principles) $itemtrack = mysql_query("SELECT * FROM ". ITEMTRACK_DATABASE ." GROUP BY ". ITEMTRACK_DATABASE_ITEM ." ORDER BY ". ITEMTRACK_DATABASE_ITEM .""); this is then in a while mysql_fetch_array which will output the usual stuff. How do I make a php variable like $amount = the total in a group specific to a user. (they'll be more than 1 user)
  20. I want to be able to count the amount of values that is grouped. For example User A has Item1 User A has Item1 User A Has Item1 after grouped it'd be like User A has Item1 (x3) the x3 is a value I need, wasn't sure to post this in php or sql, I know the Group by will effect counts and I'm not really counting how many times a Name Appears because User A might have Item2 or 3 or 10, I just need to count the number of times User A has the same Item multiple times. Anyone know how to do this? Greatly appreciate it.
  21. How do I make $val into a string variable. If i echo $val| and I have selected say 3 items, it would outcome it as: item1|item2|item3| but when I try SQL insert this, it doesnt. it just does item1|
  22. the item names runs under a for. example: $possible_choice_arrayx[$i] will convert into w/e it is. The possible_choicex looks like this: item1|item2|item3|item4 the possible_choice_arrayx splits it in "|" which then creates the [1][2][3] etc array. I'm guessing I'd have to put the foreach in a for loop to generate the name? Maybe I can live with it for now as it'll just end up inserting the exact same information into the database.
  23. If you go here: http://encorels.com/v2/?mode=u03character&id=963643388 Click "Kirin" then tick a few box's and then click Save Changes and you'll see the out come, you can view the source. Here is the full functions that control the checkbox and the submit: Showing Checkboxes: function showChoices() { global $possible_choice_array, $users_choice_array; $currentID = $_GET[id]; $users_choicex = mysql_query("SELECT ". CHARACTER_CONFIG_WISHLIST .", ". CHARACTER_CONFIG_OBTAINED ." FROM ". CHARACTER_DATABASE ." WHERE ". CHARACTER_CONFIG_ID ."='$currentID'"); if (!$users_choicex) { echo("<div id='error'><img src='img/icons/icon_cross.png'>Users wishlist could not be loaded: " . mysql_error() . "</div>"); } while ($prls = mysql_fetch_array($users_choicex)) { // PULL SQL $users_wishes = $prls[CHARACTER_CONFIG_WISHLIST]; $users_obtained= $prls[CHARACTER_CONFIG_OBTAINED]; // SPLIT SQL $users_choice_array = explode("|", $users_wishes); $users_obtained_array = explode("|", $users_obtained); // GATHER ARRAY VALUES FROM SPLIT $qwert = array_values($possible_choice_array); $qwert2 = array_values($users_choice_array); $qwert3 = array_values($users_obtained_array); foreach ($qwert as $v) { if (in_array("$v", $qwert3)) { echo "<img src='img/icons/icon_tick.png'> <strong>Obtained: $v!</strong>"; } elseif (in_array("$v", $qwert2)) { echo "<input name='checkbox[$v]' type='checkbox' value='$v' checked/> $v"; } else { echo "<input name='checkbox[$v]' type='checkbox' value='$v' /> $v"; } } } } On Submitting of form it calls this function: function editWishlist() { $currentID = $_GET[id]; // Pull Possible Choices and filter through which is true. $possible_choice_sqlx = mysql_query("SELECT * FROM ". MONSTER_DATABASE .""); if (!$possible_choice_sqlx) { echo("<div id='error'><img src='img/icons/icon_cross.png'>Could not load items from data base: " . mysql_error() . "</div>"); } while ($possiblelistx = mysql_fetch_array($possible_choice_sqlx) ) { // PULL $possible_choicex = $possiblelistx[MONSTER_DATABASE_MOBDROP]; // SPLIT $possible_choice_arrayx = explode("|", $possible_choicex); // COUNT $possible_choice_array_totalx = count($possible_choice_arrayx); foreach ($_POST['checkbox'] as $key => $val) { echo "Checkbox: {$key} contains a value of {$val}<br />"; } } }
  24. Okay that works =D, the outcome is rather odd though. It's rendering the results 5 times. So an outcome of select 3 box's would come out like this: Checkbox: KirinsOsode contains a value of KirinsOsode Checkbox: Neptunal Abjuration: Body contains a value of Neptunal Abjuration: Body Checkbox: Scroll of Raise III contains a value of Scroll of Raise III Checkbox: KirinsOsode contains a value of KirinsOsode Checkbox: Neptunal Abjuration: Body contains a value of Neptunal Abjuration: Body Checkbox: Scroll of Raise III contains a value of Scroll of Raise III Checkbox: KirinsOsode contains a value of KirinsOsode Checkbox: Neptunal Abjuration: Body contains a value of Neptunal Abjuration: Body Checkbox: Scroll of Raise III contains a value of Scroll of Raise III Checkbox: KirinsOsode contains a value of KirinsOsode Checkbox: Neptunal Abjuration: Body contains a value of Neptunal Abjuration: Body Checkbox: Scroll of Raise III contains a value of Scroll of Raise III Checkbox: KirinsOsode contains a value of KirinsOsode Checkbox: Neptunal Abjuration: Body contains a value of Neptunal Abjuration: Body Checkbox: Scroll of Raise III contains a value of Scroll of Raise III
  25. Check box's are pulled from a function known as showChoices(); Which includes this: // The values for possible_choice_array and users_choice_array have already been determind and so the variables are ready. $qwert = array_values($possible_choice_array); $qwert2 = array_values($users_choice_array); foreach ($qwert as $v) { if (in_array("$v", $qwert2)) { echo "<input name='$v' type='checkbox' value='$v' checked/> $v"; } else { echo "<input name='$v' type='checkbox' value='$v' /> $v"; } } An example output would be: <input name="KirinsOsode" value="KirinsOsode" type="checkbox"> KirinsOsode <input name="Kirins Pole" value="Kirins Pole" type="checkbox"> Kirins Pole Then when the user hits submit it calls another function called editWishlist(); The code for this is so far: function editWishlist() { // Pull all SQL tables, the below values are ready to work. while ($possiblelistx = mysql_fetch_array($possible_choice_sqlx) ) { // PULL $possible_choicex = $possiblelistx[MONSTER_DATABASE_MOBDROP]; // SPLIT $possible_choice_arrayx = explode("|", $possible_choicex); // COUNT $possible_choice_array_totalx = count($possible_choice_arrayx); // For statements pasted/edit here and tested. // EG below for ($x = 0; $x > ($possible_choice_array_totalx-1) ; $x++ ) { $result[$x] = $_POST["$possible_choice_arrayx[$x]"]; if ($result[$x]=="True") { echo "$possible_choice_arrayx[$x] Selcted <br />"; } } } }
×
×
  • 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.