-
Posts
1,807 -
Joined
-
Last visited
Everything posted by hitman6003
-
$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()); }
-
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
-
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.
-
$db is not accessible from inside the function...scope's a PITA : ) http://www.php.net/language.variables.scope
-
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.
-
Are you using a MyISAM table with a fulltext index on the column(s) you are trying to query against?
-
http://www.w3schools.com/wap/default.asp
-
JS: http.open("GET", url + escape(nameuser) + "¶m2=" + 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
-
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.
-
create zip file from selected check boxes
hitman6003 replied to networkthis's topic in PHP Coding Help
http://phpclasses.goodphp.com/browse/class/42/top/rated.html -
Perhaps this will help www.php.net/language.types.array
-
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
-
[SOLVED] Cron job to grab a picture from an external site
hitman6003 replied to 86Stang's topic in PHP Coding Help
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); */ -
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.
-
[SOLVED] Decreasing a value using Select Query
hitman6003 replied to ballouta's topic in PHP Coding Help
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. -
http://www.php.net/get_browser orio beat me to it.... : )
-
Need Help Working with Array & Database Result
hitman6003 replied to mclamais's topic in PHP Coding Help
<?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 />"; } -
Use fping...http://fping.sourceforge.net/
-
PHP Zip Code Raduis Search Suggestions?
hitman6003 replied to advancedfuture's topic in PHP Coding Help
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... -
[SOLVED] use php variable in mysql query - syntax error??
hitman6003 replied to kate_rose's topic in PHP Coding Help
we all have to start somewhere... : ) -
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
-
PHP Zip Code Raduis Search Suggestions?
hitman6003 replied to advancedfuture's topic in PHP Coding Help
http://www.stroz.us/php/index.php?option=com_smf&Itemid=53&topic=98.0 -
Don't use session_register... http://www.php.net/session_register:
-
[SOLVED] use php variable in mysql query - syntax error??
hitman6003 replied to kate_rose's topic in PHP Coding Help
you need to use the concatenation operator in your $query string... http://www.php.net/language.operators.string -
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++