-
Posts
1,807 -
Joined
-
Last visited
Posts posted by hitman6003
-
-
you should put POST variables inside a variable then put it in MYSQL
like
$variable= $_POST[variable];
mysql_query"(INSERT INTO table ( values here) VALUES ($variable)");
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());
-
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 : )
-
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?
-
-
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.
-
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.
-
-
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
-
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.
-
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.
-
-
<?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 />"; }
-
or ping more servers every second
Use fping...http://fping.sourceforge.net/
-
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...
-
we all have to start somewhere... : )
-
If the PHP upload limit is 2Mb would this cause the script to fail?
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
Or does it count each file selected as an individual file?See above.
Can I use a while loop to process the upload?Yes
-
-
Don't use session_register...
http://www.php.net/session_register:
If you want your script to work regardless of register_globals, you need to instead use the $_SESSION array as $_SESSION entries are automatically registered. If your script uses session_register(), it will not work in environments where the PHP directive register_globals is disabled. -
you need to use the concatenation operator in your $query 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++
Help with array
in PHP Coding Help
Posted