Jump to content

Maq

Administrators
  • Posts

    9,363
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Maq

  1. Yes, you get this error message because you're echoing before your redirect (my fault). Take out these lines: if(isset($_POST['submit'])) { echo "You just tried to submit hahaha"; } Where does the the $P_POST array come from? $P_POST['term']; $P_POST['definition'];
  2. You're in the wrong section.
  3. You win a steamy pile of Cat Crap.
  4. Try this: if(isset($_POST['submit'])) { echo "You just tried to submit hahaha"; } if($_POST['op'] != "add") { $display_block = "Add an Entry </pre> <form method='\"post\"' action="%5C%22%24_SERVER%5Bphp_SELF%5D%5C%22"> Term: Definition: Chapter: Section: </form>";<br>}<br>else if($_POST['op']=="add")<br>{<br>$display_block = "<h1>Got to the if statement!!!</h1>";<br> // time to add to tables, so check for fields<br> if(($P_POST['term']=="")||($P_POST['definition']==""))<br> {<br> header("Location: test.php");<br> exit;<br> }<br> <br> // connect to the data base.<br> $conn = mysql_connect("localhost","root","") ;<br> mysql_select_db("v1test",$conn);<br> <br> // add to records to table<br> $add_word = "insert into englishtest (id, term,definition, chapter, section) values ('','{$_POST['term']}','{$_POST['definition']}','{$_POST['chapter']}','{$_POST['section']}')";<br> mysql_query($add_word) or die(mysql_error());<br> //$word_id = mysql_insert_id();<br>}<br>?><br><br><br><br><title>Add an Entry </title> <br><br><b
  5. Out of curiosity, why would you write this in a language you've never touched before?
  6. It would be a lot easier to figure out a solution if you post code to a specific problem/example.
  7. Then why not grab the product_id and check it against the products_to_categories table. Here's how you would check if the product were in 0, 1, or more than 1 categories: if(isset($_GET['products_id'])) { $prod_id = $_GET['products_id']; $sql = "SELECT * FROM products_to_categories WHERE products_id = $prod_id"; $result = mysql_query($sql) or die(mysql_error()); $num = mysql_num_rows($result); if($num > 1) { echo "This product is in MORE than 1 category!"; } elseif ($num == 1) { echo "This product is in ONLY 1 category!"; } else { else "This product ISN'T in any categories!"; } }
  8. Yes, premiso provides the correct example of how you should perform this query. Also, as revraz stated, echo your variables to see what's inside. echo "query: " . $sql . " username: " . $username;
  9. Looks like you're using osCommerce. A way to check would be to go to the products_to_categories table for the products that don't have a cPath in the URL and see if they have a category. You could do this manually and check a couple or just write a SQL query to check.
  10. I asked where it comes from not what it's supposed to do... Can you post all of your code?
  11. Where do you get $username from? You can just update it in 1 query. $sql = "UPDATE `users` SET `village` = 'Akatsuki' WHERE username = '$username' AND skill > 5000000"; mysql_query($sql) or die(mysql_error());
  12. Are your drivers up to date?
  13. MISTAKE (extra semi-colon, but I'm sure you would have figured that out ), change this line to: mysql_query($query7) or die('Week update failed:' . mysql_error());
  14. It's high time someone posted it to MythBusters. submit here
  15. Try this: $query7 = "update WEEK SET week=week+1 WHERE week > 0"; mysql_query($query7) or die('Week update failed:' . mysql_error()); ; $value = "SELECT week FROM WEEK WHERE week > 0"; $result = mysql_query($value) or die(mysql_error()); while($row = mysql_fetch_array($result)) { echo "Week updated as well " . $row['week'] . ""; }
  16. Hmm, not sure. It looks correct to me, maybe add single quotes? SELECT sum(o.total) FROM travel_orders o WHERE o.company_id = '12' AND (o.charge_date BETWEEN '1167627600' AND '1197781200')
  17. It's the same information no matter where you go.
  18. This will give you the users IP: $_SERVER['REMOTE_ADDR'];
  19. You don't need the () around the between clause. SELECT sum(o.total) FROM travel_orders o WHERE o.company_id = '12' AND o.charge_date BETWEEN 1167627600 AND 1197781200
  20. Nothing... Found this comparison (InnoDB vs MyISAM):
  21. If it's an integer, why don't you just add 1 inside the query? $query7 = "update WEEK SET week=week+1 WHERE week>0";
  22. I always thought InnoDB was specifically designed for transactional databases...
  23. You need to check out the sticky for this section. There are many great articles to get tips from, one in particular, Top Ten SEO Factors.
  24. You need to use: strtotime('+1 week');
  25. backup: mysqldump -h"host" -u"username" -p"password" "dbname" > dir/your_file.sql restore: mysql -u "username" -p "dbname"
×
×
  • 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.