Jump to content

premiso

Members
  • Posts

    6,951
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by premiso

  1. Would $_SERVER['PHP_SELF'] work for you?
  2. You need to escape textual data going into a DB using mysql_real_ecape_String which will escape apostrophes properly.
  3. Are you using mysql 4+ ? $sql = "SELECT item FROM xdata WHERE item NOT IN(SELECT products_model FROM my_products)"; See if that helps ya out a bit.
  4. It is not necessarily the better way. But you should have that option set in there by default. You can add the Options +Indexes parameter in the http.conf file under the <directory></directory> declaration to prevent this, then users can allow a certain directory to display contents by using .htaccess if they so choose.
  5. You can .htaccess it or if your own server you should modify the apache http.conf file. I would look into the .htaccess tutorial and how to use it to get what you want. Preventing Directory Listing
  6. Are you on shared hosting?
  7. You are over escaping the data. Check that magic_quotes is turned off, if not turn it off. You may have to stripslashes on current data then update it for it to be right in the current DB. Basically with magic_quotes on, php adds addslashes to any form data passed to the script. It is being depreciated/turned off in PHP 6. So I suggest not relying on it and just turn it off and be happy
  8. Sum all the votes together then divide that by the number of votes.
  9. By is a reserved word. Either rename that column or surround it in backticks (`) $sql = "INSERT INTO bonusaps(name, `by`, reason, aps, date) VALUES ('{$_SESSION[s_username]}', 'self', 'Potion Set', '30', '{$today}')";
  10. <?php function sortCounter($a, $b, $key="counter") { return ($a[$key] < $b[$key]); } $items[0]["counter"] = 18; $items[1]["counter"] = 19; $items[2]["counter"] = 1; usort($items, "sortCounter"); print_r($items); die(); ?>
  11. Document root goes to the very root. If you are working under the "videos" folder you need to add that in there.
  12. They should be accessible as long as they were defined before the include.
  13. What does the second variable contain?
  14. array The manual with different array functions. sort should give you what you want.
  15. UPDATE set col1 = 'someval', col2 = 'someval' WHERE somecol = 'someval'
  16. select recID, restName, cityID, price, time from clientReceipts cr, restaurants re WHERE cr.restid = re.restid AND userID = $userID;
  17. It uses the php cli (command line interface) PHP CLI. What it is doing depends on what is housed in the two variables, as they hold the comments. Hence why Maq asked that.
  18. $sql = "SELECT * FROM tabl_name WHERE (itemNumber LIKE '%-1' OR itemNumber LIKE '%-2' OR itemNumber LIKE '%-3' OR itemNumber LIKE '%-0')"; $result = mysql_query($sql) OR DIE(mysql_error()); while ($row = mysql_fetch_assoc($result)) { $itemNum = substr($row['itemnumber'], 0, -2); $update = "UPDATE SET col1 = '{$row['col1']}', col2 = '{$row['col2']}' WHERE itemNumber LIKE '{$itemNum}%'"; mysql_query($update) or die(mysql_error()); } That is a rough example, you did not provide very good information, thus you get that.
  19. I can say I did not know that, granted I would see that as dismissing the point of a switch/case....but I could see different usages for it...I guess.
  20. I would suggest against using ereg_replace as it is being depreciated. As far as why it is not working, notice in the replace segment you use "$searchItem" php is case sensitive. It should be all lower case.
  21. Bottom left hand corner above the Quick Reply.
  22. Basic html, you need to use <br> to "break" and go to the next line. Read up on html, as it is seems you are in need of doing so.
  23. That is great that you tried. But post the code you are using to try with. Maybe then you will get your problem resolved.
  24. Ternary operators. Basically a shortened if/else, If $row['auth'] is 1 then put 'auth' in the class variable. Else but 'noauth'
  25. Switch/Case cannot evaluate if x is greater than y. You need to use an if/elseif/else statement to handle that.
×
×
  • 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.