-
Posts
2,965 -
Joined
-
Last visited
Everything posted by mikesta707
-
it would be much easier if you used a mysql table rather than a text file
-
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"); }
-
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.
-
seems fine... did you test it?
-
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(); }
-
just add another textbox that called confirm password, and before you do any queries test to see that newpass and confirmpass are both equal
-
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
-
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?
-
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
-
Ok I have started a fresh, this time on windows!
mikesta707 replied to Mackey18's topic in PHP Coding Help
Tizags Free Webmaster Help (This one is the one I learned from.) W3schools -
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
-
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
-
is the member_id column an int column? if so remove the single quotes around the $member variable in the query statement
-
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
-
assuming $ch1 is the text you want to output echo htmlentities($ch1);
-
server removes 2nd word in word_blank_word string
mikesta707 replied to jaco's topic in PHP Coding Help
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> -
server removes 2nd word in word_blank_word string
mikesta707 replied to jaco's topic in PHP Coding Help
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>>'; -
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
-
Please Help! Can't figure this out...
mikesta707 replied to markvaughn2006's topic in PHP Coding Help
if ($location == "Hospital"){ echo "You got owned"; } ? -
mystery NULL mucking me up, newbie question
mikesta707 replied to elliotpo's topic in PHP Coding Help
maybe it has to do with the sprintf() call you have. try getting rid of that -
that means that your query failed. echo mysql_error() and see what error you get
-
just write var_dump($uploadEND); echo "<br />".$uploadEND; i threw an extra echo in there just because. where do you echo it?
-
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?
-
he made it as total so you could refer to it as $row['total']; so change it to $totalvalue = $row['total'];