Maq
Administrators-
Posts
9,363 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Maq
-
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'];
-
You're in the wrong section.
-
You win a steamy pile of Cat Crap.
-
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
-
Out of curiosity, why would you write this in a language you've never touched before?
-
It would be a lot easier to figure out a solution if you post code to a specific problem/example.
-
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!"; } }
-
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;
-
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.
-
I asked where it comes from not what it's supposed to do... Can you post all of your code?
-
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());
-
Are your drivers up to date?
-
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());
-
[SOLVED] InnoDB vs MyISAM for a Social Networking Website
Maq replied to sergeidave's topic in MySQL Help
It's high time someone posted it to MythBusters. submit here -
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'] . ""; }
-
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')
-
[SOLVED] InnoDB vs MyISAM for a Social Networking Website
Maq replied to sergeidave's topic in MySQL Help
It's the same information no matter where you go. -
This will give you the users IP: $_SERVER['REMOTE_ADDR'];
-
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
-
[SOLVED] InnoDB vs MyISAM for a Social Networking Website
Maq replied to sergeidave's topic in MySQL Help
Nothing... Found this comparison (InnoDB vs MyISAM): -
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";
-
[SOLVED] InnoDB vs MyISAM for a Social Networking Website
Maq replied to sergeidave's topic in MySQL Help
I always thought InnoDB was specifically designed for transactional databases... -
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.
-
You need to use: strtotime('+1 week');
-
backup: mysqldump -h"host" -u"username" -p"password" "dbname" > dir/your_file.sql restore: mysql -u "username" -p "dbname"