Jump to content

Philip

Staff Alumni
  • Posts

    4,665
  • Joined

  • Last visited

  • Days Won

    20

Everything posted by Philip

  1. What data is in the database?
  2. Make $worked[active] -> $worked['active'] and $worked[id] -> $worked['id']
  3. The backticks (`) are like normal single quotes (') for table and column names - they are for identifiers. locked is a mysql keyword (if i remember correctly), thus breaking your query. See more here: http://dev.mysql.com/doc/refman/5.0/en/identifiers.html
  4. "SELECT `locked` FROM `forumtutorial_posts` WHERE `postid` = '{$id}'"
  5. I've got to be honest with you, I looked at your other thread and this one. Your code is really hard to read through, and you're not providing a lot of background information on what is supposed to happen, how it happens, etc. Take it as constructive criticism, but you have a lot of inefficient code.
  6. Yeah, that's what I would do - of course don't forget to filter it (possibly use an array/switch to check to see if the action is acceptable)
  7. Okay - after putting another item in my cart (apparently it emptied itself) and: I'm pretty sure the action=?GETVARS is browser dependent - some will run it, others wont (can anybody confirm this?)
  8. Hopefully you're still fixing it,
  9. <?php $action = ($_SERVER['REQUEST_METHOD'] == 'GET' && isset($_GET['action']))?$_GET['action']:''; $action = ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['action']))?$_POST['action']:''; ?> Wouldn't that overwrite itself? If you had a GET var, but not a POST, action would be set to "" @ OP, I go to http://www.fhsgsa.org/dw2/cart.php?action=update However get the errors:
  10. Look into Apache's modrewrite http://www.workingwith.me.uk/articles/scripting/mod_rewrite
  11. Why not just use a hidden field?
  12. It's not like you see a billion of them a day
  13. <?php $path = dirname(__FILE__); include $path.$_SERVER['PHP_SELF'].'.txt.'; ?> Should work.
  14. if($EnemyRand=="4"); shouldn't have a semicolon
  15. Well, as PHP states - chosen.txt is not found, which is why it cant read/see end of file.
  16. Good point. xtopolis' is going to be the best way, it'll take more work, but it'll be worth it in the long run (view patterns, history, etc)
  17. Agreed, I would use the AS, it makes things a lot easier
  18. Yeah, you can do it with PHP/MySQL. The easiest would probably be using sessions - when they login, start a counter session... each time they submit a new form, increment the session variable. On logout, just email the user's name, and the session variable. The other way would be a little more complicated, using MySQL. If you want to know that way, let me know and I can try to setup an example.
  19. You still need to call mysql_fetch_assoc (or array)
  20. size="32 value = " Missing a " on the <input> Also, if that doesn't work, Find: <body> Replace: <body> print_r($row); That'll show to make sure you're pulling the right col names + if there is a value or not
  21. I'm just following ngreenwood6 today Just optimizing the code above, same principles. <?php $color = '#000000'; // define color first while($LogF = mysql_fetch_array($result2)) { echo "<tr>"; echo "<td bgcolor='$color' > <font size='2'>".$LogF['id']."</font></td>"; echo "<td bgcolor='$color' > <font size='2'>".$LogF['date']."</font></td>"; echo "<td bgcolor='$color' > <font size='2'>".urldecode($LogF['title'])."</font></td>"; echo "<td bgcolor='$color' > <font size='2'>".$LogF['price']."</font></td>"; echo "<td bgcolor='$color' > <font size='2'>".$LogF['duration']."</font></td>"; echo "</tr>"; // Of course you could shorthand the following: // Or even put it in array to get multiple colors. if($color == '#000000') { $color = '#94FF79'; } else { $color = '#000000'; } } ?> Edit: forgot to define color before the loop Also, ngreenwood - on "$count = 1" you're missing a semicolon, but otherwise it would work
  22. Or, if you wanted to keep all your data, like me and become an e-packrat. A query would become (no DELETE query required): SELECT * FROM `table` ORDER BY `id` DESC LIMIT 100 You wouldn't lose any data - but if your point is to save space, ngreenwood6 is pretty much correct... I would just change it to: <?php $query = "SELECT * FROM table"; $results = mysql_query($query); $num_rows = mysql_num_rows($results); if($num_rows == 100) { //put delete query here (only deletes if 100 rows were found) } //put insert query here (always inserts) ?>
  23. I dunno, I was hoping there was another way than to do a subquery on each value I needed to check - but I guess not. I just see a subquery as being a resource hog for some reason, even though it's probably not
  24. Both are possible.
  25. Given that the file is an UPDATE to the others, yes, your programmer would be able to leave the others alone (if coded correctly) However, if the products in the file are NEW (and not updates), then the VendorPrice or InventoryLevels would remain at NULL until you, or another query overwrote that.
×
×
  • 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.