Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. If you have a table dedicated to only departments like (example): Departments dept_id dept_name dept_description etc... You could do something like this: $sql = "select dept_name from departments"; $result = mysql_query($sql); while ($depts = mysql_fetch_assoc($result)) { echo "<option value = '{$depts['dept_name']}'>{$depts['dept_name']}</option>"; }
  2. Okay let me ask you this: What format does js want your list order to be in? some semicolon separated string?
  3. Right then. What DarkWater said. Stop making multiple topics asking the same thing. Thread Closed.
  4. php is parsed on the server and the results are sent to the client (your browser). Javascript is parsed on the client. All of the php script will be executed and results sent before a single piece of javascript is executed, no matter what kind of order you put it in. If you want some kind of "live" interaction, where you start off with php and have more php executed based off of js, look into ajax.
  5. PEAR has a net_ping class to ping or you can use sockets to ping. Google "php ping"
  6. You are correct in that you need to use javascript to make a popup.
  7. Perhaps you should mosey on over to the smf forums and suggest a change then.
  8. .josh

    Hey guise

    Congrats for being able to use a spell checker on your little "article" but I hope you know it is full of grammatical errors. Not to mention the title of your thread here is misspelled. I think it's funny and ironic and sad all rolled into one when the grammar police come knocking on your door and fail. Kind of like this friend of mine I used to get high with and one day he busted out saying he was an undercover cop and had to arrest me for smoking weed and I was like er...wtf you're smoking too... I guess the lesson I learned is that the law doesn't apply to the people who enforce it, so maybe I should extend that to grammar police.
  9. Yeah that's kinda what I mentioned to him earlier, but from what I gather, what he has is a script that he gets to move around articles on a page (like physically order them different with js or whatever) and what he is storing is the order in which the articles appear on the page, not the articles themselves. So I was thinking that he could just use one column of enum type or hell just a varchar or somethin'
  10. This way will create an un-needed array, and generally take more processing power than basic string comparisons... but yes, it will work You know, according to the manual, parse_url is supposed to accept a second argument to only return the part you want (as a string), but when I tried to add PHP_URL_QUERY as the 2nd argument, php kept screaming at me about how parse_url only accepts one argument...so...am I just not understanding the manual right, or is the manual wrong? edit: Oh wait, I just read further down: the component argument is a feature of php5 I was testing it on a php4 server. whoops
  11. If you want all the information in one field then you don't need to explode anything. The point of explode is to separate data....and yet you want to have it all in one field in your table, so again I tell you, why are you trying to use explode? Does the script that's arranging your stuff need the variables separated? Even if it does, you could keep it in the database as one string and explode it when you retrieve it from the database. Is that the best way to go about it? Maybe, maybe not. In the end, that's up to you. Maybe you need a fresh set of eyes and ears on this because I kind of feel we're just going around in circles here.
  12. here's my take: <?php $url = "/server/lhs/admin/pages/4.php?act=1&step=2&category=Lighting&1217980250839"; $url_query = parse_url($url); parse_str($url_query['query']); echo $category; ?>
  13. Well if you just want the data inside one field of the table then why use explode at all? Just update the field (or insert or whatever). if(isset($_POST['itemOrder'])){ $itemOrder = mysql_real_escape_string($_POST['itemOrder']); mysql_query("UPDATE groups SET article1 = '$itemOrder' WHERE group_id ='".$group['group_id']."'"); }
  14. Okay well I'm just kind of feeling in the dark here, because I don't know anything about your situation or what kind of content you are working or any of that sort of thing, but offhand, I would say that you should at the very least have two tables, one for your articles and one for that other info. But articleX (replace the X with any of those numbers) doesn't really mean a whole lot to me, being some random Joe who doesn't know anything about your business, so it's pretty hard for me to suggest a decent table(s) structure for you.
  15. well I don't know how your table is setup so how should I know where to put it?
  16. You're not getting your articles inserted because $items isn't in your query.
  17. php is a server side language. It is parsed and the results are then sent to the client (your browser). It does not do "realtime" stuff like that. Look into javascript.
  18. what are you wanting help with? If you don't want it to check the database if the user posts the same thing, then just check if it's the same thing and not query the database if it's the same as the current. if ($oldusername != $newusername) { // query database } I mean, is that what you're asking, or something else?
  19. Then sort the array and make a loop that stops when you get to the first number that's greater than it.
  20. loose example: $currentusername = "Johnny"; $newusername = $_POST['newusername']; $sql = "select username from table where username = '$newusername'"; $result = mysql_query($sql); $found = mysql_num_rows($result); if (($found > 0) && ($newusername != $currentusername)) { // good to go, do something } else { // already exists are is same as old, do something }
  21. can you work your code to have the top layer be associative instead of numerical, so you can just do $c['varx'][0] $c['vary'][0] $c['varz'][0] ?
  22. can you post results of echo "<pre>"; print_r($answers); echo "</pre>";
  23. That's because fopen creates a resource stream for the file. You need to use it with for instance fread to read the contents. if you are wanting to just echo out the contents of a file, use file_get_contents
  24. Not necessarily. OR: a b X X true X O true O X true O O false yes, if you do a condition with an OR, it will evaluate true if both are true, making it like an AND, but you would not be able to separate the logic. For instance, if you wanted to do one thing if either one of them would be true (OR), but you wanted to do something else if both were true (AND), you could not do that with an OR by itself.
×
×
  • 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.