Jump to content

hitman6003

Members
  • Posts

    1,807
  • Joined

  • Last visited

Everything posted by hitman6003

  1. $result = mysql_list_tables('mysql'); while ($row = mysql_fetch_row($result)) { $query = "DELETE FROM " . $row[0] . " WHERE FIELD = ''"; $result = mysql_query($query) or die($query . "<br />" . mysql_error()); }
  2. Why would you do that? Assigning it to a intermediate variable, like you have above, is no different than using the $_POST array. It doesn't matter if you address $_POST directly or assign it to an intermediate variable, use mysql_real_escape_string to prevent SQL injection... $result = mysql_unbuffered_query("INSERT INTO table (column_name) VALUES ('" . mysql_real_escape_string($_POST['value']) . "')") or die(mysql_error()); http://www.php.net/mysql_real_escape_string
  3. change $result = mysql_query("SELECT * FROM mps_data"); to $result = mysql_query("SELECT * FROM mps_data") or die(mysql_error()); And see what the error is.
  4. $db is not accessible from inside the function...scope's a PITA : ) http://www.php.net/language.variables.scope
  5. are you sure that the path to the file is correct? echo $myf to ensure that it is...double check any relative paths to be sure.
  6. Are you using a MyISAM table with a fulltext index on the column(s) you are trying to query against?
  7. http://www.w3schools.com/wap/default.asp
  8. JS: http.open("GET", url + escape(nameuser) + "&param2=" + escape("use JS to get your value from the DOM"), true); PHP: $second_param = urldecode($_GET['param2']); There's some really good Javascript frameworks that make using AJAX much easier: jQuery, Dojo, etc. http://jquery.com
  9. Use a one-to-many relationship... An example: users ----- id name phone_numbers ------------- id user_id number Each user is listed once. For each phone number the user has, an entry is put into the phone_numbers table that has the user_id and the phone number. Apply the same principle to what you are trying to accomplish.
  10. http://phpclasses.goodphp.com/browse/class/42/top/rated.html
  11. Perhaps this will help www.php.net/language.types.array
  12. You have an incorrectly named function (or you called the wrong one in your page)... function select($name, $listVals){ $this->addText($this->gSelect($name, $listVals)); } // end buildSelect Should be: function buildSelect($name, $listVals){ $this->addText($this->gSelect($name, $listVals)); } // end buildSelect
  13. just use the file_get_contents command... <?php $pic_location = "http://your.camera.page/pic.jpg"; file_put_contents('pic.' . date("Ymdhis") . '.jpg', file_get_contents($pic_location)); //or if you don't have php5: /* $open = fopen('pic.' . date("YmdHis") . '.jpg', 'wb'); fwrite($open, file_get_contents($pic_location)); fclose($open); */
  14. mod_auth... http://httpd.apache.org/docs/2.2/mod/mod_auth_basic.html Other wise, you'll have to have a "download" page, where the user info is checked, then the file sent to the user by the script, rather than linking directly.
  15. you are using two different tables...one to update, and another in the WHERE clause, but not identifying how to join them together. Perhaps you should start there.
  16. http://www.php.net/get_browser orio beat me to it.... : )
  17. <?php $p = '100593825_1,100593826_2,100593826_1'; $items = array(); foreach (explode(",", $p) as $input) { list($sku, $quantity) = explode("_", trim($input)); // You'll get a php notice for each undefined element in the array // this way, but they don't mean anything $items[$sku] += $quantity; /* // alternatively, without the php notices: if ($items[$sku]) { $items[$sku] += $quantity; } else { $items[$sku] = $quantity; } */ } $query = "SELECT sku, product_name FROM inventory WHERE sky IN(" . implode(",", array_keys($items)) . ")"; $result = mysql_query($query); while ($row = mysql_fetch_assoc($result)) { echo $items[$row['sku']] . " " . $row['product_name'] . " were requested.<br />"; }
  18. Use fping...http://fping.sourceforge.net/
  19. Another way, with more in the comments: http://www.xml.lt/Blog/2008/04/22/Calculating+distance+in+SQL Takes into account the curve of the earth and all...
  20. Depends. There are two variables...post_max_size and upload_max_filesize. The sum of all files can not exceed post_max_size. No single file can exceed upload_max_filesize. http://us.php.net/ini.core#ini.upload-max-filesize http://us.php.net/ini.core#ini.post-max-size See above. Yes
  21. http://www.stroz.us/php/index.php?option=com_smf&Itemid=53&topic=98.0
  22. Don't use session_register... http://www.php.net/session_register:
  23. you need to use the concatenation operator in your $query string... http://www.php.net/language.operators.string
  24. Why don't you execute it and see? The php interpreter will throw errors if it's incorrect. If you want syntax highlighting, there's a thousand programs that do it for free...gvim, gedit, kate, bluefish, notepad++
×
×
  • 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.