-
Posts
228 -
Joined
-
Last visited
-
Days Won
9
Content Type
Profiles
Forums
Events
Everything posted by G7470
-
Look at the query it was trying to do. The error is here: `itmbuyprice` = string string is invalid, which is throwing the error. Not only is it not wrapped in quotes or apostrophes (which it has to if it is a varchar or text type), but I am fairly certain that itmbuyprice is looking for an integer. Make sure the itmbuyprice column is attempting to insert an integer (or number) and you should be fine. ~G7470
-
Mostly mobile now. I help develop browser games, but to unwind, I enjoy playing a mobile game on my phone. ~G7470
-
Use tools like firebug in order to test out changes to your CSS without actually having to change your code base. Firebug also shows you exactly what css properties/attributes are active. With this tool, it should be pretty easy to find out what is happening with your CSS. ~G7470
-
True true haha. I do see your point. :p ~G7470
-
Not sure if you changed your post, but this link was initially shown on the email notification I got of your post, which disproved php.net's claim of mt_rand(): http://en.code-bude.net/2013/01/06/php-rand-vs-mt_rand-what-is-more-accurate-what-is-faster/ ~G7470
-
Another way to do this would involve a number of steps to attempt to achieve "randomization". First off, initially following [MENTION=70347]NonStopCoding[/MENTION]'s initial thought, expand that by allowing a unix timestamp into the "locked" field instead with a 0 default. ALTER TABLE `serverconfig` ADD `lockedtil` int(11) not null default 0; Then, on your daily cron, add something like this: $randtime = rand(time(), (time() + (23 * 60 * 60))); // random time from now until 23 hours from now (could change this accordingly) $res = mysql_query("UPDATE `serverconfig` SET `lockedtil` = '".$randtime."'"); Then, on the page that you would want to "hide" until that time is up: if($worked['lockedtil'] > time()) { echo Message('This page is blocked right now'); include_once(__DIR__.'/footer.php'); exit; } This would not be truly random (as the rand() function is only pseudo-random), but this is probably the closest that you would come to true randomization without much more code to do so. EDIT: Be aware that until the cron is run for the first time with the changes in to update "lockedtil" to a future time, the page will always be available. ~G7470
-
[MENTION=70283]Samurai Legend[/MENTION] use the most recent version of that file on Sniko's github here. There's a change on there to that update statement that should fix your problem. ~G7470
-
Lol not necessarily. All depends on the quotes and how the query is structured. $IP may cause some problems (if this was customized), but other than that variable, I'm pretty sure it would all work. Agreed with Kyle. Surprised I didn't even notice that despite the fact that I even got the reference of what it did right lol. Give his suggestion a try. ~G7470
-
Just for clarification: this is for names/descriptions, not including any possible images? ~G7470
-
That's not what I asked. I'll try to explain it differently...I am looking for the definition of the function insert_id. That function definition could help explain what the problem is with the code. The mysql function that I am looking for in this definition is something similar to this: mysql_insert_id() If you don't know what mysql_insert_id is, here's a link of reference: http://php.net/manual/en/function.mysql-insert-id.php Hopefully that makes more sense. ~G7470
-
This is the line that I'm interested in: $i=$db->insert_id(); Could you post the code for this function? That's probably where the problem lies. ~G7470
-
With environment settings such as these, the processing power difference between using issets versus not is unnoticeable to the end user; however, good programming practice should be done regardless of the environment, so I'm with you on that [MENTION=68774]HauntedDawg[/MENTION]. :) ~G7470
-
I think that is better than the percentages. Gives a better understanding of what your skill set is. :) Looks really nice overall. Very good job. ~G7470
-
Under your "Portfolio" section, the "My Skills" section confuses me. I would clarify what those percentages mean a little better because in terms of business, people would have no idea what that means (and even I am a little confused too on what that means haha). ~G7470
-
It all depends on how you would want to structure your code. I made that code on-the-fly, so I really did not take the time to analyze the "least code" method. Regardless, both methods (what I did VS what you did) have their pros and cons. It's all personal preference. ~G7470
-
Not a problem. Let me know if you have any questions. ~G7470
-
Following the code that you just wrote: while($getresults = $db->fetch_row($query)) { switch (!$getresults['itmid']) { case $r['equip_primary']: $priName = $getresults['itmname']; break; case $r['equip_secondary']: $secName = $getresults['itmname']; break; default: $armName = $getresults['itmname']; break; } else { switch ($getresults['itmid']) { case $r['equip_primary']: $priName = None; break; case $r['equip_secondary']: $secName = None; break; default: $armName = None; break; } } I can see what you are trying to do, but that method simply will not work (as you have already experienced). You are basically trying to compare results that do not even exist in the first switch statement, and then trying to do an "else" statement with a switch, which is syntactically incorrect. This is how I would do it: while($getresults = $db->fetch_row($query)) { switch ($getresults['itmid']) { case $r['equip_primary']: $priName = $getresults['itmname']; break; case $r['equip_secondary']: $secName = $getresults['itmname']; break; default: $armName = $getresults['itmname']; break; } } if(!isset($priName)) { $priName = "None Equipped"; } if(!isset($secName)) { $secName = "None Equipped"; } if(!isset($armName)) { $armName = "None Equipped"; } Assuming you have NO items with an ID of 0 (which you really shouldn't), then this should work for you. Read through the code that I just wrote and let me know if you have any questions about how it works. ~G7470
-
Below are the echo statements for each item name using the code I posted: echo $priName; // Will display equipped primary weapon name echo $secName; // Will display equipped secondary weapon name echo $armName; // Will display equipped armor name Take those and change them as needed in order to format them as desired. ~G7470
-
My advice would be to make the text much bigger when mobile. As said before, it is extremely difficult to read any of the text on the game. It looks as if it is strictly a desktop design. It would be one thing if you only used the website, but when having a downloadable mobile app, that has to be appealing and easily readable on a mobile device; otherwise, people may quickly abandon your game. ~G7470
-
If you want to have the exact item name for each item equipped, it will be a little tricky to do, but this is what I came up with: $query = $db->query("SELECT `itmname`, `itmid` FROM `items` WHERE `itmid` IN (".$r['equip_primary'].", ".$r['equip_secondary'].", ".$r['equip_armor'].")"); while($getresults = $db->fetch_assoc($query)) { switch $getresults['itmid'] { case $r['equip_primary']: $priName = $getresults['itmname']; break; case $r['equip_secondary']: $secName = $getresults['itmname']; break; default: $armName = $getresults['itmname']; break; } }
-
Without going into the game, I would suggest building a more mobile-friendly design. It is extremely difficult to read the text even in the mobile app. ~G7470
-
I'm aware of that haha just was at least trying to get him on the right track as to where things are going wrong. Wanted to see if he would meet your demands too before giving other information. :) ~G7470
-
Depends on how you would want to do it and structure it, but usually images are placed under a special images directory you have in your file structure. Then, in the database, you add a column to place the image file itself for your items (whatever it may happen to be called). After that is done, the coding part is not too bad. Again, all depends on how you would want to do it. You can either create a function like I did to accomplish this: show_image($image_file_name, $item_id); and build a function in a classes file like so: function show_image($image, $id) { return "<a href='javascript:;' onclick=\"javascript:window.open( 'description.php?id=".$id."', '60', 'left = 20, top = 20, width = 400, height = 440, toolbar = 0, resizable = 0, scrollbars=0, location=0, menubar=0' );\"><img src='".$image."' width='100' height='100' style='border: 1px solid #000000'></a>"; } or you can do something like Script did. They all basically do something similar. ~G7470
-
Check for semicolons on your echo statements. You are using the echo command multiple times without a semicolon. ~G7470