Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. no error messages? Very first thing I notice is in your 2nd code block, you forgot a ; after $id = $_POST['id']
  2. whoa hey I notice you have this in that code you just posted: $row['mobile']; // notice the [] on the var $_SESSION['mob'] = array($row['mobile']); You didn't have that first line in there before did you? That could be your problem right there. You're trying to redefine $row when the while loop already does that in the condition. But regardless, I was saying like this: $sql="select mobile from user where mobile !='' and sms = 'X'"; $query = mysql_query($sql) or die (mysql_error()); $_SESSION['mob'] = array(); while($row = mysql_fetch_assoc($query)){ // assign each row to a new array element. This makes a 2d array $_SESSION['mob'][] = $row['mobile']; } //example to display info foreach($_SESSION['mob'] as $mob) { echo "$mob <br />"; } If you had that $row['mobile']; in there before, simply removing that should work, without adding that line before the loop.
  3. http://www.phpfreaks.com/tutorial/php-loops
  4. de ja vu
  5. okay how about putting $_SESSION['mob'] = array(); before that while loop.
  6. hmm...did you already define $_SESSION['mob'] somewhere else before that while loop?
  7. umm...hmm..do you have a space between "$_SESSION['mob']" and "[]" ?
  8. <?php if(isset($_SESSION['id']) && isset($_SESSION['sessionID'])){ echo "<a href='/profile.php?id={$_SESSION['id']}'>Profile</a><a href='/account.php'>Account</a> <a href='/logout.php'>Logout</a>"; } else { echo "<a href='/index.php'>Home</a> <a href='/signUp.php'>Sign Up</a> <a href='/index.php'>Login</a>"; } ?>
  9. Nope, SMF does not provide us with those sort of features. Not even admin can do that. Unless the database happened to be backed up between the time you posted and edited it, it's forever gone.
  10. Why are you checking what kind of data type your data is? You should not be doing that here. You should be doing that in the script that takes care of putting it into the database. All data should be checked, sanitized, converted properly, etc.. BEFORE putting it into the database. I suppose checking if it's empty per row is okay, but it's not really ideal, especially if you're only making use of one column... on that note, if you are only going to be making use of one column, only select that one column from the database. There's no reason to burden the server with extra processing times and resource usage calling * like that. You also do not need to be "reseting" mobile every iteration like that. In fact, you do not need that variable at all. Also, use mysql_fetch_assoc or mysql_fetch_row instead of mysql_fetch_array. _array returns duplicate info: it returns a 2d array first element is numerical indexed 2nd element is associative. There are very little instances in which you actually benefit from using _array. It works, but it's overkill. And even more overkill is that you can add a 2nd argument to _array to specify returning only 1 or the other, making it exactly like _row or _assoc. <?php $sql="select mob from user where mobile !='' and sms = 'X'"; $query = mysql_query($sql) or die (mysql_error()); while($row = mysql_fetch_assoc($query)){ // assign each row to a new array element. This makes a 2d array $_SESSION['mob'][] = $row['mob']; // notice the [] on the var } // example to display info foreach($_SESSION['mob'] as $mob) { echo "$mob <br />"; } ?>
  11. Well shit that was ironic. First post actually had my real password to my sql server (but not my password to this site). haha i can click my back button and get the original unedited version since i was replying before your edit :evilgrin j/k :-X
  12. yes, making a file to be included like that is more secure. Put it in a folder above your public_html, though.
  13. Okay man, I don't mean to sound rude, but you got to focus here.... You keep showing separate little chunks of code. That does nothing for us. You need to copy/paste your entire code. You said earlier you are echoing your link, with quotes, without quotes, etc.. but you just keep pasting a link out of context. Not counting security issues, this is what your code should look like, no more, no less: page1.php <?php $var1 = "This is my text"; echo "<a href = 'http://www.thewebsite.com/projects.php?masterVar=$var1'>my link</a>"; ?> projects.php <?php $masterVar = $_GET['masterVar']; echo $masterVar; // output: This is my text ?>
  14. - You can make a donation here. - You can read other posts and help people with their problems. - You can say thank you. Simply saying thank you has always been cool with us. We have a "Topic Solved" button on the bottom left of the thread for you to click so that the thread will show that the problem was solved. But a lot of people don't know about it, so mods are able to mark it for them if their last post informs us that it was solved. As far as I know, we do not enforce any kind of time limit. Ideally people should be able to search the forums for threads that may have the same or similar problems as them, and ideally, the solved threads should be more helpful. Since SMF's search function does not at this time include only searching for solved threads, threads that are "bumped" because of a thank you post can potentially serve to one's advantage. Writing this response, I just thought of an alternative option. Perhaps we could have a "Solved" forum, where threads marked as "solved" can reside. The pro to this would be that in the advanced search, you can specify a forum to search in. Since the forum would only have topics marked as solved..well, there you have it: a work-around to not having a current feature for that. The con to this would be that manually searching through solved topics by navigating through the board could be tedious, since they wouldn't be categorized. We could solve this by making a bunch of subforums, 1 for each of the main forums. Or we could make a subforum inside each of the main forums. I think I will bring this up for discussion with the other mods/admin. Yes, someone has taken the time to research their problem first. Yes, someone has taken the time to write their problem as clear as possible, providing relevant code, etc.. so do they deserve a straight and informed answer? Well, first and foremost, nobody here gets paid to help. None of the "staff" gets any kind of portion of ad revenue if we have ads, or any kind of portion of donations given; nothing. That money goes straight towards helping pay for hosting, and as far as I know, we do not get enough money from donations to fully pay for hosting. Since nobody gets paid for any of this, we do not really try to discipline people who are just trying to help, no matter how "bad" that help may be. I personally like to think of those posts as "here's what doesn't work" posts. Even those posts can be helpful, if you think about it. Knowing what doesn't work can be a tremendous help in narrowing down and fixing the problem, especially when dealing with logic problems, which are the hardest problems to fix. Countless times I have seen other people say "no that's not right, but that did get me on the right track and here's the solution." I've heard that from other helpers and original posters alike. Seems that 9/10 times there will always be someone who comes in after a "bad advice" post to correct it. In my experience, the real problem with "bad advice" posts is how those 'correctors' respond to the bad advice. 9/10 times, those are the people we have to ask to be nice. If it's straight up "spam," we usually straight up delete it. There is a board I [used to] frequent where a bunch of "smart" people (Engineers, rocket scientists, doctors, physicists, etc...) hang out to discuss philosophy, religion and politics. I stopped hanging out there mostly because the context was way the frack above my level of understanding, but also because debates would almost certainly always degenerate into a game of semantics, entirely missing the point of the debate. Each response would literally be a 2,000 word essay full of quotes for every single sentence by the previous poster (yes, this is where I got my long-windedness, Dan I went there to maybe soak in some of that IQ but just walked away with their worst habits, lol ). And not to be out-done by that, the response would be a full blown book. I'm serious. This isn't a "smart people" hangout. We are a support forum. In the spirit of trying to learn and solve problems, we tend to let an awful lot slide. Bad spelling, bad grammar, lack of clarity, etc.. are always obstacles to getting the problem solved, but we do not delete posts because of any of those things, but neither do we shy away from telling people they need to be more clear. Most people do, in fact, feel they are being clear enough when they make their posts, so unless it is pretty obvious that they are spamming, trolling, or just being lazy (like asking people to write their code for them, etc..), we generally try to tell them they need to better explain their problem, provide more information, etc.. After all, the goal is to solve the problem. As far as debate vs. flame war: it's actually pretty easy to tell whether conversation is centered around debate or if it's some kind of flame war or useless spam. It's mostly a matter of common sense. However, if we do have doubts, we do ask the other mods/admin their thoughts on the matter. But even then, we are pretty lenient on that stuff. Remember, nobody gets paid for it, so keeping some fun in the atmosphere is a good thing for keeping people around. I totally agree with this. To be honest, as a moderator (but more importantly, someone who tries to help) I don't really care so much for the thank you as a pat on the back. My main desire to see the proverbial thank you is so I know that the problem is solved. Since we do not have direct access to the scripts or the environment they are being used in, a lot of our "job" is...well, I wouldn't exactly say "guess" work, but there are a ton of things that could be wrong with something, or there could just be that one thing we suggested. I can't officially speak for others who help, but I get a sense of accomplishment when I see that "thank you" or "topic solved" button hit. There was a problem, and I [helped] fix it. It makes me feel more confident of my skills, being able to help fix problems, when I do not know the whole situation. The more I help people out here, the more I feel my skills as a programmer grows. The best teacher is experience, as they say. That's my real reward. "Thank you's" are just a signal of "job done," not "job well done." Not that I don't appreciate it. I'm just sayin'... lol.
  15. foreach (array as key => value) use $name instead of $href.
  16. so...just make something up...like what I said. I don't think the challenge is so much coding it but deciding on what's a "fair" way of ranking them. Seems to me when you have a "circle" like that: 1 > 2 > 3 > 1 > 2 > 3 etc... that figuring out who won by the highest margins seems fair. But maybe that's just me. I'm not really into this sort of thing.
  17. show your actual code from source and target scripts (use code tags) seriously I think we're making a way bigger issue out of this than it really is. I mean, the only way it would literally echo out "$var" instead of the value of $var is if you're a) trying to echo out the link (with the variable) in single quotes, or b) your link is just plain text outside of php tags (regular html). There's really no other reason, except for that your script isn't being parsed at all, which it obviously is, as something is being received and echoed out.
  18. He's talking about when the user clicks the back button on their browser. Pressing the back button usually brings a cached page up. It doesn't automatically send for a new page load. ..
  19. Maybe it's the database. Maybe When page1 sends a query, the database locks everything else out until that query is executed, in order to prevent other queries from somehow messing up that query, so basically each query has to "stand in line" and wait it's turn? Haha I dunno. I mean, I know you can specifically tell the db to do that, but idk if that's a default setting or if your db does have that turned on or somethin'. Just another shot in the dark.
  20. unless there is some sort of official rule.. they really aren't "tied" per se... I mean, team 2 never beat team 1. Team 3 never beat team 2. Team 1 never beat team 3. I personally would just kinda make something up. Like... team1 beat team2 50 to 40. That's 10 point margin for team1 team1 beat team2 45 to 42. That's 3 point margin for team1 team2 beat team3 64 to 36. That's 28 point margin for team2 team2 beat team3 19 to 12. That's 7 point margin for team2 team3 beat team1 42 to 40. That's 2 point margin for team3 team3 beat team1 83 to 49. That's 34 point margin for team3 totals: team1: 13 team2: 35 team3: 36 Even then it's possible to "tie" so you can also consider margin of loss as well... you'd also maybe want to consider figuring these numbers on an overall scale. I mean, what if there was a team4 that had like 10 wins, 0 losses, but they only won by like 2 points every game, for a total of 20 point margin? Seems to me that that should somehow factor into this somehow, because team2 and team3 both have higher point margins.
  21. I really don't specifically know but it seems more efficient to me for the server to have one connection stream handle the requests and queries, especially if it's from the same client. It even seems more efficient if it's different clients making requests/queries through the same script or to the same database. I think that's where specifying the connection comes in; so you can specifically tell it to use a different stream. But again, I'm just kinda guessing, based on what seems more logical/efficient.
  22. Haha that's just like those sites that were popular in the web gaming circles many years ago, where you picked a monster and it started out at level 1 or as a "baby" or whatever and the goal was to get people to click your link and the more people who did, the more your monster would level up or "grow." Fair warning, those type of sites are frowned upon. You aren't really gonna get sponsors to give you money for this sort of thing because people just make bots to artificially increase their hits.
  23. did you try opening and specifying different connections? page1.php $conn1 = mysql_connect(...); $result = mysql_query('...',$conn1); page2.php $conn2 = mysql_connect(...); $result = mysql_query('...',$conn2); etc...
  24. I'm not seeing any include in your script up there..
  25. show your actual code (in code tags). It looks to me like you're using single quotes around it so it's interpreting $var1 literally. You need to either have it in double quotes or not in quotes at all: echo "http://www.thewebsite.com/project.php?masterVar=$var1"; // or echo "http://www.thewebsite.com/project.php?masterVar=" . $var1;
×
×
  • 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.