Jump to content

mikesta707

Staff Alumni
  • Posts

    2,965
  • Joined

  • Last visited

Everything posted by mikesta707

  1. it would be much easier if you used a mysql table rather than a text file
  2. if (move_uploaded_file($_FILES['mimage']['tmp_name'], "../images/merch/$newname")){ $mimage = $newname; mysql_query("UPDATE merch SET userid = '$userid', bid = '$bid', mcat = '$mcat', mname = '$mname', mquantity = '$mquantity', msmall = '$msmall', mmedium = '$mmedium', mlarge = '$mlarge' , mcost = '$mcost', mprice = '$mprice', mdesc = '$mdesc', mimage = '$mimage' WHERE mid = '$mid' "); header("Location: ../view_merch.php"); }
  3. There is an array called $argv that you can use to access arguments passed via the command line. For example if you did the command path/to/php/test.php chocolate 276 "killer tie, dude!" and in that page you had a line print_r($argv); it would output something like Array ( [0] => test.php [1] => chocolate [2] => 276 [3] => killer tie, dude! ) notice that the script name is the first parameter, always there is also a variable $argc which is the count of the array $argv.
  4. seems fine... did you test it?
  5. the same way you made the first textbox... its simple html. to test them $member = $_POST['member']; $newPass = $_POST['newpass']; $confirm = $_POST['comfirm']; if ($newPass != $confirm){ echo "Passwords don't match"; exit(); }
  6. just add another textbox that called confirm password, and before you do any queries test to see that newpass and confirmpass are both equal
  7. umm.. well what is the $member variable? is it the id column, or the username column? i would assume its the username column, so change the column 'member_id' to username, and keep the single quotes
  8. it depends on your version of MYSQL. what version do you have? what is your table structure? have you tried removing the single quotes from your query?
  9. you can get strings from the server array by accessing its index's with its keys. for example: //the script name $name = $_SERVER['SCRIPT_NAME']; //request method (IE get or post) $method = $_SERVER['REQUEST_METHOD']; //the protocol (LIKE HTTP, HTTPS, etc.) //btw for HTTP it will return the version also, IE HTTP/1.1 $protocol = $_SERVER['SERVER_PROTOCOL']; //query string, ie what the ?get=value part of the URL $query = $_SERVER['QUERY_STRING']; if you check out the manual it has all of them
  10. Tizags Free Webmaster Help (This one is the one I learned from.) W3schools
  11. if its of type int, and you pass the value surrounded by single quotes, it will think you are trying to pass a string into an integer column, which will cause an mysql error, which in turn will destroy everything else
  12. if you want the PHP to be parsed, then just echo it. But if you are parsing it anyways, why not just write the lines? there is also the eval function. $php = "<? echo \"My name is John\"; ?>"; eval($php); //output: //My name is John
  13. is the member_id column an int column? if so remove the single quotes around the $member variable in the query statement
  14. As long as the snippets are on the same page, you don't need to redefine the variables again, they are usable throughout the entire script (well relative to their scope of course, you can't use them in functions and what not) also another thing, since you are adding 300 to the $time variable, and setting that as teh $timeinhopital variable, the following if statement if ( $timeinhospital < $time ) { will always be true, assuming those snippets are on the same page. If they aren't, don't worry about the latter, but you will have to take what AlexWD said into account about the redefinitions of $time and $timeinhospital
  15. assuming $ch1 is the text you want to output echo htmlentities($ch1);
  16. I'm not entirely sure why its truncating your string. When i do the following code echo htmlentities("<a href=".$_GET['taco'].">taco</a>"); with the following value for $_GET['taco']; my name is mikey the output is <a href=my name is mikey>taco</a>
  17. post code?
  18. you can replace spaces with underscores than when y ou get the var, replace underscores with spaces again echo '<a href=http://www.lightmypump.com/pumpdatabase2/return-pump-pagination.php?s='. ($start + $display) . '&cp=' . ($current_page+1) . '&p_type=' . str_replace(" ", "_", $searchpumptype) .'><b><big>Next </big></b></a>>';</big></b></a>>';
  19. simple mistake in the constructor public function __construct($configData) { $this->conn = mysql_connect($configData['db_host'], $configData['db_user'], $configData['db_pass']); if (!isResource($this->conn) || !mysql_select_db($configData['db_name'], $this->conn)) { $isConnected = false;//this line echo "Could not connect to the database."; } else { $isConnected = true;//and this line } } assuming you want to access the data member isConnected, you need to use the $this keyword. public function __construct($configData) { $this->conn = mysql_connect($configData['db_host'], $configData['db_user'], $configData['db_pass']); if (!isResource($this->conn) || !mysql_select_db($configData['db_name'], $this->conn)) { $this->isConnected = false; echo "Could not connect to the database."; } else { $this->isConnected = true; } } try that
  20. if ($location == "Hospital"){ echo "You got owned"; } ?
  21. maybe it has to do with the sprintf() call you have. try getting rid of that
  22. that means that your query failed. echo mysql_error() and see what error you get
  23. just write var_dump($uploadEND); echo "<br />".$uploadEND; i threw an extra echo in there just because. where do you echo it?
  24. ahh ok, sorry missed that. before the query, do a var_dump on $uploadEND then and make sure it has the data its supposed to have. are you getting any error messages from your upload checks?
  25. he made it as total so you could refer to it as $row['total']; so change it to $totalvalue = $row['total'];
×
×
  • 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.