Maq
Administrators-
Posts
9,363 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Maq
-
These errors are easier to see when you have proper format and indentation, which is what the "unexpected t_else" almost always refers to.
-
Maybe...? Do you think if it stands for "Don't" then it should be an exception for "do not" and vice versa? Sometimes acronyms don't follow the rule, like PHP for example, "Hypertext Preprocessor". Anyway, I was referring to the statement you made about DRY, and why it's, "Don't", and not, "do not".
-
1) You don't need single quotes around 'id' in your query. Change it to this and see if it makes a difference or outputs any errors. $update=mysql_query("update fansaker set acc='1' where id='$accid'") or die(mysql_error()); 2) You need to end your form. 3) Like ober said, the value is not going to magically change from the form to the action script if that's your entire code.
-
No 'N' because you could say, "Don't".
-
[SOLVED] MySql Query - Selecting Multiple Rows from different Tables
Maq replied to Bladescope's topic in MySQL Help
You're going to have to use LEFT JOIN and ORDER BY date DESC to obtain the correct order. Should not be a problem. When you JOIN tables you need to specify what table each column comes from anyway. But you can ALIAS table names to make things a lot easier. Good luck. -
Does anyone know a tutorial where this is explained??
Maq replied to 28rain's topic in PHP Coding Help
The skeleton of your script probably looks something like this. So first let me explain how it's being generated. $sql = "SELECT * FROM items"; $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_assoc($result)) { ?> &qty=1">Add Item } ?> Your script queries the database and grabs all of the unique ID's for the items and assigns 'id' to it. The '?' and '&' characters are how you append these values to the URL. '?' is used for the very first one, and any additional values you must use the '&' symbol. If you go to the cart.php page, and look for 'add_item', which is the action you're taking when you get there, then you will see $_GET['id'] and $_GET['qty'] which will be used to add that item to the customers cart (session or DB) with the quantity of 1. -
Does anyone know a tutorial where this is explained??
Maq replied to 28rain's topic in PHP Coding Help
Looks like when someones clicks on that link it sends them to the processing page (cart.php) where it's going to add the item that they selected ($_GET['id']) with the quantity of 1 ($_GET['qty']). It's utilizing the GET method. The link is generated dynamically, and the value for the URL parameter 'id' is generated from the results of the query to the database. -
You could use a foeach or something like array_walk().
-
spam :S, what do you mean ?, i haven't spammed this thread ? james, you have posted 3 times in less than 15 minutes, relax, be patient, and wait for a reply. The more you bump post your thread, the less likely you'll get a response.
-
9three, '!=' is the opposite of '==' and will work just fine for comparing strings. Using three would be comparing the datatype as well as the value.
-
This if should look like: if (mysql_num_rows($Query) == 1) {
-
Hehe, yeah forgot to pass the password to the MD5 function.
-
Try: $Query = mysql_query("SELECT * FROM Users WHERE Username='$Username' AND MD5Password='$Password' LIMIT 1") or die(mysql_error());
-
EDIT: No, you have to do SET column = column + 1
-
I guess it all depends. Of course you need food and water. But if it's a good temperature range where you're living, then you don't need that factor. Same with clothes, if it's warm enough where I don't need clothes, then I would rather have something else. So, in order to accurately answer this question, I guess you would have to know what the circumstances are. This is unfair: I agree because then you could, "make", "find", or "figure" out anything on the list. Maybe tangibles only?
-
The most commonly used is mysql_connection. Please read this link for more info: PHP: Persistent DB Connection.
-
Google "js loading bar" there are literally 10's of thousands of legitimate results.\ I've also actually seen some similar threads on phpfreaks for this.
-
Echo out $cID right before the query to make sure there's a value. If not, you're going to have to keep backtracking and echoing the $cID to see where it's getting lost.
-
Take a look at the phpfreaks tutorial: PHP Security.
-
Yes, it's meant to do this to retain its "uniqueness". But ALTERing the table this way, should work.
-
I agree, there's no sense in re-inventing the wheel. You'd be surprised at how many obscure functions there are...
-
Hehe, yeah there's a MySQL function for this, which is faster and is less code EDIT: But props on the creative function EDIT2: Nvm, it went away :'(
-
$sql = "SELECT * FROM table ORDER BY RAND() LIMIT 5";
-
Me either, just found it on Google. As far as helpfulness, I've never actually needed to do something like this. But I could see how such large numbers could get annoying.