Maq
Administrators-
Posts
9,363 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Maq
-
I don't like the header, looks like you did it in MS paint. The green background hurts my eyes.
-
Of course you do. Even string in Java is an object itself...
-
Booooooooo :-\
-
Yes, depending how how big your web application is it could be easier. The easiest would be to include it on a page that is included on every page, such as a header. That way you never have to include files or autoload on every page.
-
The university I went to taught me how to use OOP very well. I think that actual work will teach you much more but school has certainly taught me the core concepts. The best way to learn is to use an actual OOP language, Java would be a good choice. Very very useful
-
echo $cb -> functionC(); *** Beaten to it, twice! ***
-
Yes sorry, I just re-read through all the posts and realized what exactly happened. Glad everything is working properly.
-
Next time, instead of trying to take a bite bigger than you can chew, you should play around with sessions, mysql, forms, etc... so you can piece together your problems and ask specific questions next time.
-
Assuming you have already started the session, you can change your SQL statement to: $sql = "UPDATE users SET groupid = 'P' WHERE username = '{$_SESSION['username']}'"; Also, there's no point to have (lines 10 & 11): ?> Unfortunatly no. It just displays the button and once clicked it re-directs you. Unknown to why it dont work thoe :S, Im completely confused now , James. So it just doesn't update the database?
-
You still need the variable $username to be assigned to something. In your sql statement you're comparing username to something that doesn't even exist. How do you know what username to UPDATE?
-
* This is not tested * You need to assign $username to something like Blade said, but this should be an error less example. if(isset($_POST['terminate'])) { $username = "user1"; $sql = "UPDATE Users SET groupid = 'P' WHERE userid = '$username'"; mysql_query($sql) or die(mysql_error()); header("Location: ../login/logout.php"); } ?> </pre> <form method="POST" action="<?php%20echo%20%24_SERVER%5B'PHP_SELF'%5D;%20?>"> </form> <b
-
Ok. I see you are getting annoyed with me i will close the thread. I don't know about everyone else but, I'm not getting annoyed... I'm just trying to push you in the right direction. We gave you the pseudo code, now as Blade already said, the pieces are out there you just have to put them together. There's probably a similar scenario to yours right here on phpfreaks. If we do all the work for you, you will never do any work for yourself because you will never learn. That's why this section is called PHP Help, not PHP we will code your CMS for free. The point is to try it yourself and come back with some code and questions for us to help you out with. P.S. - The section isn't closed, it's just marked as solved. Good luck!
-
Is it? What makes you think it's not? Does it work the way you want it to? Do you get errors?
-
You need to get the id from somewhere, most likely a session, but here's a skeleton of how you can accomplish this. if(isset($_POST['butt')) { //execute query //redirect } ?> How do you have an online store and don't even know how to go about this?
-
Sticky forms: There has got to be a more efficient way
Maq replied to kyalee's topic in PHP Coding Help
I would recommend using tags with "<?php ?>" encapsulating the code rather than just tags because they produce a large amount of line breaks if you CnP it to your IDE. @kyalee, This is called HEREDOC, incase you're wanting to look it up. -
All that you stated was that you didn't know how to do it, not the fact that you don't know MySQL. The first logical step for completing this task would be what Blade suggested... Google. Search, "MySQL UPDATE" and you would have had your answer instead of having someone else do it for you. In any case, you're welcome
-
UPDATE Users SET groupid = 'P' WHERE userid = '$id';
-
So, what's your question? If you want help with the mod, you should probably take that up on the SMF forums.
-
You should have still been getting a return. DISTINCT will just grab all the unique emails... So you are just trying to filter out duplicate emails?
-
I'm not sure but I would imagine you could just ORDER BY the number of replies each topic has.
-
Where's line 32? Your code only goes to 29...
-
What do the errors say...?
-
Change this line to: $sql = "UPDATE vvvv SET goingTo='$Abs' WHERE Code_1 = '$code1' AND username='$username_b'"; and add: echo $sql; to make sure you're passing the correct values.
-
I usually do: if (mysql_num_rows($resultUser) > 0) { echo "match"; } else { echo "invalid"; } But in your case I think you can just do: if($rowUser['username']) { echo "match"; } else { echo "invalid"; }