Jump to content

KevinM1

Moderators
  • Posts

    5,222
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by KevinM1

  1. Please place all of your code within tags in the future.
  2. You never actually run your query. $data is undefined.
  3. In addition to using tags, don't simply paste hundreds of lines of code. Find the relevant parts and post only those.
  4. We need to see what ajaxpage() does. It's a custom function, so without seeing it, no one can help.
  5. For interpolating array values, you can also use curly braces around the array value while within in the string. Like so: echo "Look, I'm an unbroken string! Here's my data: {$_SESSION['someData']}";
  6. If you ever get the chance, try it! The next time you start bashing out some PHP or C you already know what will be going on behind the scenes. Like a simple division by zero, which changes a "flag" on the CPU registry. You'll also start to understand how high-level/abstract PHP and C truly is, the notable difference in number of lines required to do something like a simple IF or FOR. Well, the prof's virtual machine was similar. We still had to play with registers and what not. It just wasn't the real Intel x86 architecture we were playing with. But, there was a simple execution stack, and we could track some things as it grew/shrank.
  7. You need four tables: 1. A user table, which contains user information. 2. A TV series table, which contains series info. 3. A TV episode table, which contains individual episode info and a series ID as a foreign key, linking an episode to a series. 4. A table to combine users and episodes. This can be a simple pivot table containing only a user ID and episode ID, as users will only be linked to episodes they watched (there's no need for a special 'watched' column - the user has either seen it, and is linked to it, or they haven't and no link exists). Series info can be gathered by going through the episode table. But yes, you'll have a lot of rows. That's what happens when you normalize your data. It's a tradeoff between the number of rows stored vs. logical errors and convolutions required to successfully insert and display data. This kind of data is exactly why relational databases exist.
  8. Ah, by 'college' I meant university. The terms are mostly interchangeable where I'm from. I went to the University of New Hampshire. And, like you, the assembly language course is what got me. It was an odd course. We never wrote real assembly. Instead, we wrote instructions in C for a simple virtual machine (also written in C) that my professor had made. When we weren't doing that, we were working on simple compression/decompression algorithms, something with floating point numbers, and something with a custom linker. So, while it was called 'assembly language', it was really all over the place. I graduated with a BA in Communication at the end. Right now, I'm slowly building up my own business/portfolio. Until now, most of my work has been small scale stuff, the kinds of things you can't really put in a portfolio. Some of my old work has been lost (a company folded, some clients changed software, I've had a computer die on me, etc.). The rest is piecemeal, like "Oh, well I hacked a Joomla module, and here's where I did some custom JavaScript for a client." Nothing to truly hang my hat on. I also didn't plan on being a freelancer. So, now with lessons learned, I'm trying to do it right. Start small, start slow, then ramp up when I have my feet under me and something to showcase.
  9. Where does $bioFieldID come from? You also have a syntax error in your if-conditional.
  10. This topic has been moved to PHP Freelancing. http://www.phpfreaks.com/forums/index.php?topic=330801.0
  11. Hehe, I've heard things about COBOL. I actually started way back in the early 80's, as a child, with BASIC on my Commodore VIC-20. Nothing special, but it was cool seeing instructions turn into something else on the screen. I didn't program again until college, mainly because I had more interest in liberal artsy stuff at the time. I didn't do too well when my classes shifted over (down) to C and we started doing low-level stuff. Shifting and flipping bits never appealed to me, and I had a hard time 'seeing' how to successfully finish my assignments anyway. My mind seems to do best with abstract models, and I could never really put bytes, and their constituent bits, into that conceptual framework. My biggest regret is not getting my CS degree. I'd love to go back and try it again some day, now that I have some real life experience to help me along.
  12. But, those conventions are not enforced in any browser or code that I know of. You can use GET to set data to be updated, etc and it will work as long as you code your script to use the data that way. Ken Because browsers have no idea what will happen when the data is sent to the server. Developers should develop to the HTTP spec: http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html Also, most (if not all) browser will give a warning if you attempt to resubmit a form but not a get link. Developers should develop with semantics in mind anyway. They're the basis for RESTful systems.
  13. Some advice: Bookmark the following link: http://www.php.net/quickref.php It's a list of every built-in PHP function, with each function name being a link to a description of what it does followed by code examples. It's an invaluable resource. While PHP is dynamically typed, if you dive into OOP with PHP you'll see that type still matters. So, try not to forget the good habits you learned with C++. Remember that HTTP is stateless. Things only happen when a new request is made by the server. Because of that, you're better off doing all of your data processing first, outputting results/HTML only at the end. Even though PHP makes it easy (and, indeed, a ton of tutorials actually encourage one) to jump back and forth between HTML and PHP in a file, it's really a bad practice to get into. For your own debugging/maintenance sanity, I suggest making your scripts top heavy. Finally, never use 'global'. If you see a tutorial that uses it, run. Every time a newbie PHP coder uses 'global', God kills a kitten.
  14. A couple things: 1. You have a short PHP tag at the beginning of the line require 'facebook.php'; Change it from <? to <?php 2. Is the variable $like_status initialized anywhere? It's not defined in this file. Is it in facebook.php?
  15. I should try relearning C++ sometime this summer. I used it in college, way back in the day (1998-2000 or so... damn I'm old), but haven't had a chance to play with it since. It was fun, though. Getting your first dynamically linked list to work is magical.
  16. This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=330724.0
  17. function connectdatabase($server, $username, $password, $querytype, $type, $database) { // function code } Also, your function definition for query() shouldn't be placed within an if-conditional. Chances are, you want to invoke the function based on the if condition, not simply define the function.
  18. Don't use 'global' to pass parameters into your functions. Pass them through the argument list. That's why it's there.
  19. Well, for one, you're making your life much harder than it needs to be with your loop. When you fetch things associatively, you don't need to manually set the returning array's keys. PHP is nice with db handling in that it does the work for you. Also, since all of your inputs except for your buttons are hidden, you don't need to put them in a list. Your while-loop can be distilled to: while($row = mysql_fetch_assoc($UNVSRA)) { // print the form per entry echo '<div class="newVerifyUserContain" >'; echo '<div class="newVerifyUser">'; echo '<form action="http://localhost/~atharp1122/OGirly_Site/process_staff.php" method="post">'; echo 'USERNAME: ' . $row['username']; echo '<input type="hidden" name="usrname" value="' . $row['username'] . '">'; echo '<input type="submit" name="approve" value="approve">'; echo '<input type="submit" name="reject" value="reject">'; echo '</form></div></div>'; } For more on this, look at: mysql_fetch_assoc. Put your if (mysql_error()) conditional above the line where you close the connection in your form-handling file. I have the feeling that any errors you may be getting are getting hidden by you closing the connection before handling them. I also suggest commenting out your header redirection and trying to echo your username variable in your form-handling file as a debugging measure. Something like: echo "Is the username set: $usrname"; To see if the value is indeed getting set properly. If all else fails, put the following two lines at the top of your files: ini_set("display errors", 1); error_reporting(-1); This will force PHP to display all errors, if any errors are occurring.
  20. KevinM1

    Br4n.com

    Please place your code within tags. I placed them in your post above because, as Spiderman says, "Everybody gets one."
  21. You don't need to include a file in this case. Simply point your form's action to the second file, then have the second file use a header redirect to where ever you want the user to go. Why do it like this? Because you'll be separating the code that displays the form(s) from the code that processes the form data, giving you a clear divide between the two. So, the first file would do the work of obtaining the GET value, querying the db for all of the entries that need to be changed, and displaying them as forms. The second file would simply take that data, validate it, insert it into the db, then send the user somewhere else. No output from it, just pure PHP processing.
  22. I suggest splitting your code into two files. File 1 will accept your GET parameter and display your form(s). Form submission will send the POST data to File 2. File 2 will validate the incoming data and update the db. Upon completion, it will redirect the user to where ever you want them to go. I think this split will help you see what's going on. A non-updated entry means that the last username is not being set, given the WHERE clause in your query. Splittinh the process up can help you isolate the problem. You can always reintegrate them later.
  23. Arrays are always zero-indexed, regardless of whether or not they're generated by PHP itself (like $_POST) or user generated. This holds true for most, if not all, other languages as well, so remember it when you move on to JavaScript.
  24. For the first, grab the boxes by their ids, then use setTimeout to close them. For the second, simply add an onclick event handler to your 'X' buttons, and have that handler function close the box.
  25. Do you have a variable named $path anywhere in your code?
×
×
  • 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.