Jump to content

Maq

Administrators
  • Posts

    9,363
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Maq

  1. You had an extra mysql_query in there: $conn = mysql_connect("***", "***", "***"); mysql_select_db("***", $conn); $sql = "SELECT * FROM *** WHERE id = '".$_SESSION['id']."'"; $result = mysql_query($sql); while ($row = mysql_fetch_array($result)) { echo " Item: $row[make] - $row[model]"; } ?>
  2. Extra semi-colon while ($row = mysql_fetch_array($result)) {
  3. You have to check to see if it exists first. $catid = isset($_GET['id']) ? $_GET['id'] : null;
  4. Try this: $DBConnect = mysql_connect("localhost", "root"); if(isset($_POST['submit'])) { $var = isset($_POST['name']) ? $_POST['name'] : null; $delete = "delete from members where id = $var"; mysql_select_db("dietetics", $DBConnect) or die(mysql_errno() . ": " . mysql_error() . " "); $result = mysql_query($delete) or die(mysql_query()); if (mysql_affected_rows() > 0) { echo "The row has been deleted, successfully"; } else { echo "No rows have been deleted"; } } ?> </pre> <form action="adminRegister.php" name="thisform" method="get"> <
  5. Post your current code.
  6. Just Google, "php echo vs print". Haven't read this article yet but it looks informative. PHP Echo vs Print
  7. Your $result will always return true because it does not error out. Comparing something to null isn't an error. mysql_affected_rows() will return the number of rows that have been affected by the previous query executiong. Replace these lines: $result =mysql_query($delete); if ($result ==true) { echo "The row has been deleted successfully"; } else echo "No rows has been deleted"; with these lines: $result =mysql_query($delete); if (mysql_affected_rows() > 0) { echo "The row has been deleted successfully"; } else { echo "No rows has been deleted"; }
  8. I guess the OP, after 2 years, still hasn't decided on an OS for his server.
  9. You're going to need to store this in a database regardless. I'm telling you, that you need to come up with a database design that can handle all of this data and is well designed. If you design some tables, we can give you feedback as to what needs to be modified.
  10. You need to give it the connection link.
  11. You need to decide on what/how many tables you need, what columns should be in each table. Think about what you need. characters -------------------------------------- id name type items -------------------------------------- id name power defense etc...
  12. With a database you can uniquely identify each character. You can also create other tables for fights, items, etc... You should come up with a database design first that incorporates everything you need for this text based game. It's hard for us to help with only general information like this.
  13. It's ideal to use GROUP BY, as you can see it will scale if you add more sectors.
  14. A letter cannot be a number. Try: SELECT * FROM foo WHERE bar REGEXP "^[0-9]"
  15. I don't see how this could possibly be a PHP question...? EDIT: Mchl, beat me to it.
  16. Just to save you a step. You can just give IN the array, as opposed to imploding it together.
  17. Is this thread solved? I see, I think I replied in that thread.
  18. ??? Is this a SQL question?
  19. I think it was moved there, but there were still 2 separate threads that were essentially the same thing.
  20. Please don't double post... http://www.phpfreaks.com/forums/index.php/topic,248099.0.html
  21. This checks to see if the id exists in the URL, if it does assign $id to it, if not give $id an empty string. $id = isset($_GET['id']) ? $_GET['id'] : ""; if ($_GET['id'] == $cat_id) {
  22. I think you're going to have to use a subquery for this. Something like: SELECT * FROM table WHERE post_id IN(SELECT post_id FROM table ORDER BY date DESC LIMIT 10) ORDER BY date ASC;
  23. EDIT: Nvm.
  24. What does your URI look like when you see that error? I'm guessing that 'id' is never being set the first time you run your script. You should check it with isset() to make sure it as a value, or is even in the URI, before you compare it to anything.
  25. Link?
×
×
  • 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.