Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. yes. it would overwrite the previous object though.
  2. Well I said that was an option for getting your var from point A to point C I didn't say it was the best option to go with. It was an example to illustrate that you are assigning $sql at point A and trying to use it at point C.
  3. Up until about a week ago I had 2 crappy computers and a crappy laptop. I gave the laptop to my sister-in-law for school and one of my computers died on me. Well I think it's dead. I'm still tryin' to mess with it. It's pretty old. Even if I do manage to fix it, it still sucks.
  4. so when are you gonna post some actual code?
  5. OS?
  6. wait wait wait, are < and > supposed to be less/greater than signs there? As in, if $foo is less than or equal to $100, like say, 99 or 75 or 13, and you divide it by 2, the answer is 50? And if $foo is greater than or equal to $100 like say 150 or 197 or 1,002,043,123 and you divide it by 2, the answer is 1? How is that possible?
  7. $sql is a local variable inside that function. It doesn't exist outside that function unless you specify it as a global variable or else return it from whence the function was called (which I'm not seeing in your previous code calling that function in the first place). edit: or rather what I mean to say is, I don't really see a connection between $sql in that function and where you are trying to use it. I mean, I see you trying to pass it as an argument to the function but I don't see it being returned or set as a global or anything in the function where it's set in the first place, so I don't really see how you are getting it from point A to point C from the presumably point B of calling the function.
  8. mysql_query($sql,$this->connection) or die(mysql_error());
  9. where is $conn being assigned? where is $sql being assigned?
  10. maybe I'm not doing it the right or proper way, but I never do an initial check to see if the submit value is there or not. I mean, you're gonna be checking fields anyway, right? So just cut to the chase and look for them first. Or just do a blanket if($_POST) or if($_REQUEST).
  11. .josh

    Browsers

    Lol... have you tried pointing your IE6 to phpfreaks.com? Well that's different. We're elitist jerks. The rules obviously do not apply to us.
  12. well you can't do select subqueries inside a modify query so you're gonna have to break it down into 2 separate queries. The first query would be the one you already have. The second query will be a plain run of the mill insert query where you just do 1000-$Total as the value ($Total being the retrieved info from the first query).
  13. by...echoing out the variable in the appropriate place?
  14. huh. Well when I originally posted the string I actually wrote it exactly like that, but I thought that that was just a longer way of using BETWEEN.
  15. well that's just an example of looping through a simple array. You're obviously gonna have to apply it to your array. If you know how to echo out an individual target element then you can apply a foreach loop to that array, even if it's nested inside another array.
  16. so..where are $session->logged_in and $session->isAdmin being assigned? In head.php? Or are those global session vars? If so, you need session_start() at the top of your page. Also if that's how you're doing sessions then you must have register globals set to ON which you don't want to be doing.
  17. did you try some regex to remove them first and then query?
  18. mysql_real_escape_string addslashes stripslashes
  19. so...use a condition to concat the where clause onto your query string if it's there. Also you should not be putting variables like that directly into your query string. You should sanitize them first. That's just begging for sql injection.
  20. Ha well I readily admit I suck at sql. Can you further explain?
  21. <?php // example array $something = array('a' => 1, 'b' => 2, 'c' => 3); echo "<form action = '' method = ''>"; echo "<select name = 'blah'>"; foreach($something as $key => $val) { echo "<option value = '$key'>$val</option>"; } // end foreach $something echo "</select>"; echo "</form>"; ?>
  22. <?php // example array of columns not to touch $keepers = array('id','name'); $sql = "show columns from tablename"; $result = mysql_query($sql); while ($list = mysql_fetch_row($result)) { if (!in_array($list[0], $keepers)) { // mysql allows you to drop more than 1 column at a time // but in order to remain compatible with other sql's, we're // gonna do it 1 at a time $sql = "alter table tablename drop column {$list[0]}"; $result2 = mysql_query($sql); } // end if not in array } // end while $list ?>
  23. I don't get it. Are you trying to drop an actual table column(s)? Your script doesn't do anything of the sort, except for to initially get the column names...I mean, it sounds like you want a list of your columns and you want to delete some (but not all) of them, but since your script isn't doing anything remotely close to that, I kind of have to wonder if maybe you need to explain something a little more?
  24. stristr()
×
×
  • 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.