Jump to content

KevinM1

Moderators
  • Posts

    5,222
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by KevinM1

  1. I'm not quite sure what your problem is. Do you only have one monster on the map? I mean, most games tend to either have monsters placed in locations that the player would have to go through (certain hallways/rooms/in front of doors), so they're guaranteed to encounter them, or have them randomly generated where each move by the player rolls the dice behind the scenes to see if they've stumbled into a fight.
  2. You need to use a query string, like: website.com/index.php?departure=something&arrival=another The query string is everything after the '?'. In PHP, you grab the values using the $_GET superglobal array, like so: $departure = $_GET['departure']; $arrival = $_GET['arrival']; echo "Your departure time is $departure, and your arrival time is $arrival"; That echo statement would output: If you used the query string I added to the fake URL I wrote above.
  3. The difference between the 'tedious' approach and 'shortcut' approach has nothing to do with everything being an object. You're confusing what's known as syntactical sugar for under-the-hood functionality. It's not a matter of things being objects that magically make the shortcut work, but rather that someone programmed the interpreter to recognize certain syntactical arrangements, which are then extrapolated as being the same as the more verbose, tedious code. In compiled languages, that kind of code is sometimes literally re-written as the verbose version, then compiled. In C#, the shortcut generates the same CL* code as the tedious code, which is then compiled to bytecode. RE: Global objects - a better way to go would be to have namespaces for everything. Some things don't need to be included in every script, like math. That's how Java does it, it's how the .NET languages do it. LOL, what? There's nothing advanced about what PHP has for OOP features. If anything, it's been perpetually late to the party with adding standard functionality. It's still lagging behind in some areas (see: true properties). *CL is short for Common Language. One of the features of .NET is that any language built on top of it (C#, Visual Basic, F#, etc.) is first translated into an intermediate language, and then compiled down into bytecode. That allows easy interoperability between the languages, and completely removes the necessity for a .NET programmer who only knows one language to have to learn another.
  4. It is, but you can then install a Linux distro and a LAMP stack. That's how I do it. I just have my old PC on the floor with no mouse/kb or monitor attached running Ubuntu server. That way I can work on my desktop or laptop and don't have to sync up. Nice. I only have my laptop (the desktop is the family computer), so I just use a VM. Was thinking about pure dual boot, but didn't want to go through the hassle, as 80% of what I do is MS-related.
  5. It is, but you can then install a Linux distro and a LAMP stack. That's how I do it.
  6. Yeah, good point. There's often a cap on certain things. Quick WordPress work (installation, installing a new theme/plugins, or even creating a simple theme) has a cap of around $500 in my area.
  7. What debugging have you tried? Have you echoed out your completed queries? Echoed the value of 'user_id' at various points in your script? If you can track the id, you'll be able to find when/where it goes bad. As a general design tip, you should think about breaking your validation and update code into functions. Instead of having to go through 300+ lines of code in one swoop, it will help you narrow things down. Very helpful when debugging. Also, take a look at this line at the top: $query = "SELECT * FROM companies WHERE user_id = '" . $row['user_id'] . "'"; You want $row here, not $row['user_id']. Why? Because: $row = $_POST['user_id']; That could be screwing you up, as $row at that point is a scalar, not an array. It's also a good lesson in having better variable names.
  8. Yeah, that's a retina burning yellow. On the plus side, I can now only see in black and white.
  9. Well, it looks like this thread has run its course. If you want to continue to bitch at each other, take it to PMs.
  10. A. The users would still need to go to the site to respond, so your 'keep the site active' argument is moot. Remember, also, that you want to gain/keep users by keeping your site user friendly. It's nice being able to filter PMs via email, as it keeps actual site interactions productive, which increases the overall enjoyment of the experience. Quick and dirty: users first. If you do it right, you won't have to worry about keeping the site active.
  11. I have an internal rate of $30/hr (which is cheap, but I like undercutting the competition. it allows me to get a lot of the local small businesses that can't afford to pay more). What I do is give the client an estimate of time - which includes what I believe will be enough time to thoroughly test and debug - and the price based on that total time (so, $30 * estimate). If the client can't pay that number, I negotiate. Keep in mind that web development is not anything close to being a novelist. A writer is a person with an English degree and a bunch of time on their hands. A developer is a person working in a technical niche, and potentially has a significant amount of overhead to pay for (hosting, software, hardware, continual training, etc.). You're not just charging for work done, but for the ability to do that work. So, you need to figure out how much you actually worked and what a fair per-hour cost is for your skill level. You said the project took two days... is that 16 hours of work? 48? 8? The hardest part, I've found, is figuring out the time estimate. All I can say for that is to take a hard look at yourself, and try to judge how quickly you tend to complete projects. It's always best to give yourself a significant buffer for debugging. Clients will be much happier if you overestimate the time and complete a project 'early' (and if you do, you should consider giving a slight discount to the original estimated cost to really gain the client's loyalty) instead of underestimating and going over on both time and the agreed budget. Never, ever, ever over promise and under deliver. You not only screw yourself (freelancing is all about reputation), but you make it that much less likely for that client to hire another developer in the future. Along those lines, always be honest with a client. If you don't know how to do something, be upfront about it. You don't want to be that developer who's learning on a live project. That almost always leads to the over time/budget/promise problem. That's about all I can think of at the moment. Hope it helps.
  12. So change the function definition to only accept one parameter: MysqliCOE($dbname) { // stuff } You'll still need to figure out how to get it the username and password. You have a couple options, like includeing a configuration file with that info, or reading it from a text file with fgets. Both are better options than passing them in by global.
  13. So, take everything into account now. You have a function definition with three parameters: function MysqliCOE($dbname, $DBusername, $DBpassword) { /// stuff } Yet you're trying to invoke it by supplying it only one argument: MysqliCOE("db_name"); You can't do it like that, which is why it's giving you an error. The error itself tells you that arguments 2 and 3 are missing. When you invoke a function, generally speaking, you need to pass in the same number of arguments as the definition calls for. In other words, MysqliCOE is expecting you to pass in $dbname, $DBusername, and $DBpassword. You're only sending it $dbname. You need: MysqliCOE("db_name", /* something for $DBusername */, /* something for $DBpassword */); Make sense?
  14. Okay, can you show me how you're trying to invoke that function? Maybe lines 50 - 69 in your db_select.php file?
  15. When you pass in arguments, you need to remove the line that has 'global'. As in: function MysqliPersist($dbname, $DBusername, $DBpassword) { $DBconnect = new mysqli_errordisplay('p:localhost', $DBusername, $DBpassword, $dbname); return $DBconnect; } You also need to ensure that those values actually exist before invoking the function. Example: $dbname = "MyAppDB"; $username = "Bubba"; $pass = "Forrest Gump"; $connect = MysqliPersist($dbname, $username, $pass);
  16. Tell the client that it's difficult/time consuming to successfully stuff all that info on one page and make it user friendly and make it look good. Remind them that they hired you for your expertise, and that in your expert opinion their decision has the serious potential to ultimately hurt their brand/bottom line. Explaining it in those terms - "These decisions are likely bad for your business" - tends to get a client's attention. Is there a reason why they're afraid to have the user go to separate pages? It's just an odd request. But yeah, dude, that layout... not good. Lefthand navigation has kinda gone extinct in favor of header horizontal navigation. I don't like the popup info, especially since there's no X/Close button for it. And the thumbnail preview appearing below the last link on the left is too small, plus that's an awkward position to put it in, in any case. I can't imagine adding CC payment to that page as it stands now. How are you planning to do that without a payment gateway? Paypal? Suggestions: Get rid of the lefthand navigation. You'll get more screen real estate that way. Use a grid. A lot of your content is haphazardly placed. Go here to generate a layout grid. Use it in PhotoShop to help place elements before translating it to code. If you're going to stick with the one page site, don't just give your href's a value of #. Give them a real value, and then have your jQuery stop the default link behavior. I *believe* this will allow users to bookmark them (try it and see). Also, pagination. Especially if this is going to be a one page app. The JANKA Scale... oy. There's no need to have a paragraph from Wikipedia explaining it. Your client is going to have two kinds of customers: 1. Carpenters, who already know what it is. 2. Home owners who only need to know "The higher the number, the harder the wood." You can get rid of that page entirely and add the JANKA number as a column in the other listings. On the home page, the Polaroids look incredibly pixelated. Do you have photos of their actual stock? Similarly, for the about/contact pages, photos of the store? Of the owner(s)? Adding a touch of realism can be inviting. It says, "We do exist! Look at all of our real shit for sale! And our nice building! We want you to feel comfortable spending money with us." You already mentioned the font/lack of logo. --- That's all I have for now.
  17. Don't use 'global'. Instead, pass $DBusername and $DBpassword as arguments to your MysqliPersist function.
  18. Correct. Easy enough to test, too, if you make a couple of nested folders. I made the following test just to double-check: test.php /inc inc.php /nested nested.php test.php: echo "Hello from test.php"; inc.php: require_once('../test.php'); nested.php: require_once('../inc.php'); nested.php could not grab a hold of test.php because it is a level deeper than inc.php. Well, that's what include paths are for. They're set in your php.ini, and tell PHP to look in those paths for the files you try to include/require. So, instead of having to keep track of what your current script's relation to the files you want to include manually, you simply tell it "Look in these locations whenever I try to include something." If it finds it, it will automatically be included. Look at the link I provided in my previous response for more info.
  19. Have you tried setting your include paths? If you don't want to do that, then why can't you use your already predefined WEB_ROOT constant to help with your path issue?
  20. Why would a more 'complete' language automatically lead to more people using OOP? Also keep in mind that OOP is more than just using objects. OOP is more about how objects are used than anything else. It's entirely possible to write procedural style code with objects.
  21. System would likely be an included namespace/class, with output being a static method. So, it would actually look more like: using System; System::output(new String("Hello World"));
  22. Why can't you include the constants first in header.inc.php? // Access Constants. require_once('config/config.inc.php'); // Access Functions. require_once(WEB_ROOT . 'utilities/functions.php'); // Connect to the database. require_once(WEB_ROOT . 'private/mysqli_connect.php'); // Determine Script Name. $scriptName = $_SERVER['SCRIPT_NAME']; ?
  23. @ManiacDan, very curious about what kinda projects you work on. Are you receiving JSON or something else? Also, do you ever use a client side debugger (Chrome's built-in web tools, Firebug)? They generally let you step through JS, and, at the very least, monitor HTTP requests.
  24. Yup. Like @jesirose asked in the other thread, "What's the OOP version of 'Hello World' look like?"
  25. To be fair, this is actually HoF's first thread on "OOP = awesome." The PHP 5.5/6.0 thread came later. But, yeah, any way you slice it, it's ridiculous. I mean, that Linus Torvalds (principle creator of linux and creator of Git, and somewhat notorious for not liking C++ or OOP) is such an amateur.
×
×
  • 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.