Jump to content

TOA

Members
  • Posts

    623
  • Joined

  • Last visited

Everything posted by TOA

  1. Now just define your TITLE constant in your other files. If you have contact.php, define TITLE to "Contact Page", if you have a info.php define TITLE to "INFO Page" inside that one. Then when the index includes 'filename'.php, the title will that's defined inside will come with it. Sessions might also be a reasonable solution
  2. http://php.net/manual/en/function.mail.php Put everything you want into a $body variable, here's an example that I use all the time $to = whoever@email.com; $subject = 'Your temporary password'; $body = 'Your temporary password is:'.$password; $hdrs = 'From: Whoever'; mail($to, $subject, $body, $hdrs); and to add more headers $hdrs = 'From: Whoever'; $hdrs .= 'Reply to: Me@email.com'; Hope that helps
  3. Doesn't matter. Cookies or actually sessions is probably your best bet.
  4. I believe I have everything down except the above problem, can I make sure I only update 1 record with an update statement such as the following? UPDATE tcc_timeclock SET timeout='$currtime' WHERE login='$employee' AND realdate= CURDATE() ORDER BY timein DESC LIMIT 1 it doesnt seem to work but from what I read it should only update 1 row after it orders all available rows (that match todays date and the employee in question) descending What's your pk? Figure that out and use DISTINCT
  5. Could be as simple as an undefined variable or an incorrect call to the function. And to add to Thorpe's question, where is $code being defined?
  6. Might just be a browser issue, what browser is that? Ex. IE doesn't like floats very well.
  7. It tells you where... Now, what that means, I'm not sure. Do an internet search and see what pops up and tell us.
  8. php can read from a website in conjunction with xml or ajax. I've done it with php and xml to pull in a blog to a website. Google "importing blogs" or "importing html from a website". I'm sure you'll find what you're looking for.
  9. The way I see it, you'll want to select the money the logged user has and then check it against the cost of the item, which I'm assuming is stored in a variable(?). Could you post the code you have or have tried?
  10. Ok, it would be good to throw that up there too. What session vars are you using? More specifically, are you recording the message you want dispayed in a session variable or just when the die() executes? If it's only when the die executes, Id think it wasn't a session issue. Could you post all the code involved?
  11. Oh my god people, this is not a political thread. I was simply offering a solution I used. Don't like it, Don't use it. As for this: You can't be serious. That's the most naive thing I've heard/read in quite some time. You need to precede that comment with, "It would be nice if everyone on this earth ...". But you're obviously still young and/or very, very inexperienced and under-traveled, otherwise, you'd know differently. And even the US is lacking in human rights. How about the right to affordable health care? You need to show me this lollipop lane you're living on, 'cause it sounds pretty sweet (no pun intended). /my2cents I mean exactly what I said. Human nature insists we change the things we need. If you're being suppresed, move, change it, whatever, but every person has that decision to make. Take Iraq for example who just held there first election ever. Progress..Change..Get it? I feel no sympathy for anyone who says "Nobody will let me". And as for being young and nieve...you're entitled to your opinion, but just to set the record straight, I'm neither young nor untraveled. Seems like you are if you feel the rest of the world has to share your opinion. Can we now get back on topic?
  12. What makes you think that? I see no sessions being used anywhere.
  13. I'm not assuming anything. Everyone on this earth has the right to make their life their own, no matter what country. To get this back on topic... thanks for your input
  14. Tell that to the millions of people that are persecuted every day for their beliefs. A worthy adversary! True, but since we are talking about the internet, where the exchange of ideas and opinions are unregulated as of yet, we are still free to think and speak as we want to over that medium, maybe not in complete anonimity though, but that's a whole different ball of wax and a completely different thread. I'll take your suggestions into account, thanks.
  15. In this case, the only person ever seeing the data is the user themselves (they must access it through a "members area" or "profile page" whatever you want to call it) I see your point, maybe not in this instance, but it is noteworthy Touche, but makes my point even more valid, that you are free to think as you want.
  16. Ok, just hit me what you really said, I read it wrong... Why would you do it differently in this case?
  17. I don't see that as being flexible at all, or we may just have different ideas of flexibility. In this case, I didn't want to put all the fields in there for two reasons: 1. It would contain like 30 fields 2. If I add one field or remove one later, I would need to come and alter the query in all the places I use it...inefficient in my mind. This way, no matter what is in there it will grab all but those two fields, no matter how many or what they are. That's my definition of flexibility, but this IS America and you are entitled to your's as well I just thought someone might find this useful if they have a situation like mine. Thanks for your feedback
  18. Hello all. Today I had a need to do as the title says and select all the fields except for two. (Think sticky form for updating user info, but not wanting to show the username which is not changeable in this case, and the password which is changed in a separate place) After searching high and low online to no avail, it hit me, and here's my solution (which is in php) $res = mysql_query("SELECT * FROM User WHERE Username='$uName'", $connection); while ($row = mysql_fetch_assoc($res)) { foreach ($row as $key => $value) { // This says if the field is User_ID or Password to skip it and display the rest if ($key == "Username" || $key == "Password") { continue; } else { echo $value.'<br />'; } } } I've gotten some good help here before so I wanted to share the love. I hope this helps someone
  19. Ok, here's what I came up with for the second solution...let me know if anyone sees anything wrong, because I think it works... $feat_res = mysql_query("SELECT User_ID FROM User WHERE Featured=1 ORDER BY RAND() LIMIT 1", $connection); while ($row_f = mysql_fetch_assoc($feat_res)) { echo $row_f[user_ID].'<br />'; } (solution found here: http://dev.mysql.com/doc/refman/5.0/en/mathematical-functions.html#function_rand)
  20. Hey guys, I'm having an issue. I'm trying to write a script that features a random user. I wrote it this way first: Featured(Feat_ID, User_ID) featureMe.php $feat_res = mysql_query("SELECT DISTINCT User_ID FROM Featured WHERE User_ID='$_SESSION[userID]'", $connection); if (mysql_num_rows($feat_res) == 0) { if (!$feat_res = mysql_query("INSERT INTO Featured (User_ID) VALUES ('$_SESSION[userID]')", $connection)) { die("Error:".mysql_error()); } else { echo "You have been added to our list. Thank you for sharing your story!"; header("refresh:2; url='profile.php'"); } } else { echo "You have already been added to our <b>Feature Me!</b> list"; header("refresh:2; url='profile.php'"); } featuredUser.php $num_users = mysql_num_rows(mysql_query("SELECT User_ID FROM Featured", $connection)); $rand_num = mt_rand(1, $num_users); $users_res = mysql_query("SELECT User_ID FROM Featured WHERE Feat_ID=$rand_num", $connection); if (mysql_num_rows($users_res) == 0) { echo "Could not complete query. Error:".mysql_error(); } else { while ($row_u = mysql_fetch_assoc($users_res)) { echo '<b>'.$row_u[user_ID]."</b><br />\r\n"; $user = $row_u[user_ID]; $bio_res = mysql_query("SELECT F_NAME, L_Name, Email FROM User WHERE User_ID='$user'", $connection); while ($row_b = mysql_fetch_assoc($bio_res)) { foreach ($row_b as $key => $value) { echo $value.'<br />'; } } } } but when I delete a user from the "Featured" table, the code is just as likely to break as get a featured user (I think because of the way I got a random user) So then I thought I could add a field in the User table ("Featured") with a Bool value for yes or no Here's that code: featuredUser(2).php $feat_res = mysql_query("SELECT User_ID FROM User WHERE Featured=1", $connection); while ($row_f = mysql_fetch_assoc($feat_res)) { echo $row_f[user_ID].'<br />'; } but am having issues getting a random user. Maybe I've been over this too many times, I'm not sure, but if anyone has any thoughts, ideas, suggestions, I'm all ears. Hope I've provided enough info. Thanks for reading
×
×
  • 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.