Jump to content

alphanumetrix

Members
  • Posts

    167
  • Joined

  • Last visited

Everything posted by alphanumetrix

  1. Just do an if/else. if ( file_exists($filename) ) { //execute } else { //execute }
  2. He showed the error: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource It seems to me that you aren't connecting to the database with a valid connection. I don't know for sure, because I don't code like you are, but you should probably turn your database connection into a variable, if you haven't already. As so: $link = mysql_connect($host,$user,$pass) or die('Database Error: ' . mysql_error()); Then rewrite your mysql_query functions to connect directly, as so: mysql_query("SELECT url as surl, siterating as srating FROM wlddl_sites", $link); Also, remember, if you don't create the $link variable directly in the function, you'll have to make the variable a global within the function, as so: function admin_ratesite() { global $link; Again, I'm not sure, because your coding style is a little weird to me. This is just something to try.
  3. Basically, set up a set of reciving files on your server somewhere. Then set your user's scripts (or whatever you are doing) to send data to your receving files via cURL. curl_set_opt() in particular is a function you should look into. basically send post data with it, which when sent to your scripts, will access your db, etc, and then send data back. it can be used in a bunch of different ways, and is great for server-to-server (http) data transmission. hope that helps.
  4. it will tell the script which blog the user is using. you get the blogid from the database. SELECT * FROM wherever WHERE userid='userid' - then just pull the blog from the users row. then you just create a script to recognize the blog=blogid using $_GET, where you determine what to show. the blog id will probably correspond to another field in a different table, maybe blogdata or something. that is recognition point. i'm going to take a break for a while; hopefully someone else can think of a good idea before i get back.
  5. Yeah, try using set_time_limit(2);
  6. Should just have to change your limit: <?php $limit = 50; $sql = "SELECT * FROM user ORDER BY RAND() LIMIT $limit"; $result = mysql_query($sql ,$con); $myrow = mysql_fetch_array($result); echo $myrow['bandname']; ?>
  7. Well I couldn't write what I am thinking in that same syntax short-cut format, but essentially, you could try using a condition to round the results. example: $roundup = 235; $rounddown = 234; $t = 234.232; if ($t{5} >= 5) { echo $roundup; } else { echo $rounddown; } there's probably an easier way to do it, but you could get creative with that. Given what I see from your code, you're using classes. So perhaps create a method to sort it in that way, and instead of calling the variable directly like you did, call the value of a method. IE: <?=($player->expRounded() / $player->maxexp * 100;?> EDIT: here's an example of a method: <?php function expRounded() { $exp = $this->exp; $nodecimal = strstr($exp, '.', true); $last = sub_str($nodecimal, -1); $roundup = substr_replace($nodecimal, $last+1, -1, 0); $rounddown = substr_replace($nodecimal, $last-1, -1, 0); if ($last >= 5) { echo $roundup; } else { echo $rounddown; } } ?> I didn't test any of this, and don't plan to, but that should give you what you're looking for, for any number.
  8. Try shuffle(); I don't really know all that much about it, but I don't think the algorithms that create the "random" results are ACTUALLY random. I think its more "complexly shuffled around", to try and simulate a random result. Because actually, I don't think ANYTHING is truly random. Not even the flip of a coin. It can be controlled under certain circumstances. Therefore, I would presume that after so long, you would receive similar/the same results if your actual count your randomizing isn't changing. Again, just something I theorized. Don't know if it's true or not.
  9. This can be done. Look into cURL with PHP. If you're looking to hire, there's a freelance section.
  10. Maybe add a field to the users table (if you're using database that is...) that is for their blog id/name. then when they login, just do this: header("location: index.php?blog=$blogid"); :-\ though, I don't think that is the best way to do this. I think you should post some of your code here, so it can be evaluated.
  11. A simple fix to this would be to add these codes around all of your scripts: ob_start(); ob_end_flush(); that should get rid of the error without having to change what you already have. it basically refreshes the headers for you.
  12. preg_match is used for regular expressions. If you want to learn more about it, I suggest you just google "create regular expression" However, instead of looking for a regular expression, you should be able to use strpos, and it should fix your little problem. $site = 'http://mysite.com'; foreach($html->find('a') as $e) { if ( strpos($e->href, $site) == true ) { echo $e->href . '<br>'; } }
  13. I'm not entirely sure what you'd need that for. Maybe try this: time_sleep_until(); // makes the script sleep until specified timestamp set_time_limit(); // limits the maximum execution time in seconds --- edit: unless you mean something like give a user an option during a specified time of day or something. then i'd say set time options with if/else statements maybe. i'm not sure how to set that up off the top of my head, but i could look it up if someone else doesn't suggest a way first.
  14. Since your include.php is so small, why don't you just copy the function to the top of the script to see if it works that way; then play around with getting the include to work.
  15. Oh yeah? I guess you made your own clothes, you hunted and slaughtered, prepared the animals you eat. You also built your own house, your own computer (including its components), programmed your own operating system and all the software the runs on it too. Then you made your own web server. In the real world, nobody makes everything themselves. Nobody has all the skills that are required, and few have the time. Doing everything from scratch is infeasible in the long run. In the business world you will likely be required to work on stuff other people made (and sometimes that stuff really sucks). They will be paying you for your time, and they will probably not accept that you need more time just because you want to do it from scratch. Last I checked, around 100 WPM. Not extremely fast, but not slow either. I didn't mean to offer a real interpretation. Instead I decided to explain the reason why I argue the way I do and why I always demand from people that they back up whatever they claim. My "overkill cat analogy" was part of that. It was intentionally simplified and overkill to illustrate how you can abuse logic to make two true premises support a false conclusion. The cat thing wasn't part of an argument against you. Not really, because it's still ignoratio elenchi. The truth value of an argument doesn't change depending on who made the argument. Whether you made it up yourself or someone else did wouldn't change if it was true, false or perhaps fallacious. You cannot be apathetic on the internet. Communication is comprised of three basic elements: words, intonation, and body language. Studies show that words only account for about 7% of the communication, the remaining 93% are the intonation and body language. This is also why it would be difficult for me to gauge whether you were being sincere or sarcastic in your last post, and thus why I didn't bother because you could always claim the opposite. My experience shows that this is nearly never the case. People will for the most part respond when being refuted. I didn't bother to check, but I believe already said something along the lines of that already, but you did respond to my further messages. Everyting you've said isn't true. It's all statistical. It's most-commonly true (i'm not just saying that because you actually through statistics in it this time). You seem to fail to realize, or at least refuse to acknowledge, that there are exceptions to everything you've said. Truth is only as true as it's proven. For instance, pluto is no longer declared a planet. Tomorrow people can figure a way why gravity doesn't exist, and why four divided by two is actually seventeen (please don't contradict me with some ridiculous theory as to why this is right - i get it). - this especially applies to the last thing you said "my experience...never...case" - i wouldn't, and still won't, further explain. furthermore, i'm telling you this to further be the exception. you see, and i'm sure you do realize, that me saying this puts my chances of contradicting myself that much higher. frankly, i treat everything outside of my head as irrelevant (truly), so i couldn't care less - shameless as one might say. 100 wpm is pretty good. i type about 30 wpm less than you. i was using my phone to reply yesterday though, so everything took significantly longer for me (redundant but i'm bored). One thing you're definitely right on - i can't be apathetic on the internet (entirely at least). I should have simply written lazy or perhaps bipolar (not that I am - just an hyperbole). "ignoratio eleechi" - why are you italicizing all your "big" words? i won't over-read them. frankly, they're not that complicated of words either. this is actually the first of the previous ones you put that i didn't know right off the top of my head. Now, I have the biggest question of all for you... You will probably like this one, too, as you seem to always want to explain things. - Explain why you want to be "explain-able" for everything? And don't say it's because you're from a "educational institution." I mean, give me a reason someone would want to know everything about everything he knows. I could think of several reasons, which I would not be interested in explaining. On top of that question above, answer this if you can: is any of this explaining actually relevant to anything, other than the dopamine it probably floods your brain with? And of course you didn't mean a real interpretation. I just wanted to explain... because I like situations like this. Now, I'm less bored again, so let's keep playing if you're up for it. Rationalizations should be defined as lies people tell themselves to make things easier. That's what I expect you do do for my big questions...rationalize. I mean, what can someone do other than that? -> please answer that without rationalizing... :) :) You are fun to speak with. It's been a while since I've actually used my brain for anything other than what I'm requested to use it for, it seems like. Thank you... I really do enjoy this.
  16. Wow... you must really type fast. No, you were very far from the interpretation I was hoping you would give. I was by no means discrediting you. In fact it was quite the oposite. I reversed my strategy (for no purpose other than testing your ability to interpret), based entirely on how you interpreted my last post. In fact, it was the same strategy as you interlreted the first time (you were wrong the first time though). I created an illusion to make it seem as though I am ultimately right, but I in turn asked you to call me out on something different, challenging your ability. You see, I was seeing if you could call me out on the test/game (whatever you want to call it). Of course, you can't know for sure, so I was expecting different scenarios to be layed out (probably how I would go about explaining it). If you thought about it, you may have been able to realize this. From here, I'd easily be able to manipulate my story to best fit whatever I wanted. I could even go back to what you originally said, me creating an illusion. This mixes things up and gives me the upper-hand either way. Clearly, the difference between you and I would be apathy. A person such as yourself would probably regard me as stupid for this, whereas I would regard you as ignorant for the contrary. I will stop there (please do not call me on this, as I will refuse to further explain). I think you may have missed my point about us being on the Internet (I figured you'd understand as I wrote it). When I speak of us being online, I mean even if I knew nothing about it, I could find a good argument to support XHTML via Google. Also, because were online, and not speaking face-to-face, I have a substantial amount of time to build an argument. Your cat analogy was overkill. I get your point. I'm bored now. Unless you can think of something else to debate/think about, I'm probably done. BTW, how old are you (if you don't mind me asking)?
  17. You're good. Really good. I'm not so sure I can even beat you in a debate if I tried. I mean, the way you responded to that post... Brilliant. Your response time was excellent, and your interpretation - flawless. I'm curious if you're that good, or if you're just speaking from experience. Perhaps you've used the illusion you spoke of in a similar situation? I made my last post in the hopes of a good response too, but you've definitely exceeded what I thought. I'm less complicated though; I just love these situations. So...what do you interpret from this? *Not the same theory - see if you can get even more creative. As for not being able to argue my point, nice try, but no. We're online (remember?); I'm sure I could just google an argument if need be. If you want to stop, say the word. I don't want banned. Don't mean to disappoint; just trying to get an answer.
  18. No offense, but the whole point of my post was to rationalize why this debate we're having is pointless. I didn't post in here to debate at all. Truth be told, the only reason why I posted in here was to see if there actually was an answer. You see, I wanted an answer, so I was counting on people to either throw my two-cents out, or agree with me. At this point, if there was a definite answer to this question (whether HTML or XHTML is better), someone would have posted. Therefore, I can confidently conclude this is more a matter of opinion or situation (too many variables for there to be an absolute answer), thus making all debating meaningless. I hope I won't need to explain this post, too...
  19. Why? I think you'll need to back up that claim. It's good practice. I beg to differ... My reasoning is here: http://www.phpfreaks.com/forums/index.php/topic,241805.0.html Now I'd like your reasoning. You didn't back up your claim, you just repeated yourself. I thought I'd explained it well. Is this a debate club or a php forums? (lol... scratch that. HTML VS XHTML... duh. bad rationalization) If you're a developer, as the guy above obviously is, using XHTML is good practice. Odds are, someone's going to request it, and being intimately familiar with it makes it that much easier. I personally (personally) see XHTML & HTML as the difference between right and wrong... I'm not a good guy necessarily, but I try to make good habits (get it?).
  20. Why? I think you'll need to back up that claim. It's good practice.
  21. I see it on PHP's website. It's here: http://us.php.net/oop - I looked on another few websites, too, for a better definition of it. The funny thing is, I use this style of coding a lot. - I always just referred to it as classes though... Now I feel completely embarrassed. No it is not! Yes, it is. Look it up. PHP is an Object-Oriented Programming language (OOP). Quick reference: http://en.wikipedia.org/wiki/Object-oriented_programming_language Buddy, you don't know what you are talking about. You don't even know what OOP is according to your last post. Leave it. I thought you guys were referring to a different acronym, because of the post below: Thanks for clearing this all up for me, guys!
×
×
  • 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.