-
Posts
2,965 -
Joined
-
Last visited
Everything posted by mikesta707
-
array_keys($row) ?
-
Don't use an iframe. its pointless to use an iframe if you are going to be using PHP's include function. In fact people stopped using Iframes pretty much because of the PHP include function. what error are you getting?
-
change password for profile page. working but not? help please
mikesta707 replied to blesseld's topic in PHP Coding Help
idk if you meant to do the following, but shouldnt $password = $row["newpass"]; $newpass = md5($password); be something like $newpass = md5($newpass); based on what it is now, you are taking the value from the newpass column of your table (which i'm not entirely sure actually exists) MD5-ing that value and setting it as the actual password. The password entered in the form doesn't even take part in the script at all -
what happens when you run the script? you need a better description than not working. is it throwing an error? not showing the flash? blank page?
-
perhaps delete the space between the numbers and the commas, IE it should look like , 1800, 1,
-
2 things. you have to use the "." character to concatenate strings. two associative array keys must be surrounded with single quotes $message = "Hello, your reference number is " . $_GET['to'];
-
echo the query again. what does it look like
-
[SOLVED] URL with parameter of url parameters
mikesta707 replied to malikah's topic in PHP Coding Help
you should be able to just set the get variables normally and your view.php page should be able to access them. so href='blah.php?page=view.php&a=apple&b=ball&c=car' -
you're going to have to explain a little better or post some code. "get a 0 from nowhere" means nothing to me. Which value are you echoing? what text field?
-
oh, it would just make the javascript look like jsArray[0] = 'value'; jsArray[1] = 'value1'; #etc but mjdamato's example is probably a little cleaner.
-
[SOLVED] I need help in trying to assign value to a variable...
mikesta707 replied to Jim R's topic in PHP Coding Help
ehh more or less. You aren't so much telling it which function to get, you are calling a function much like a normal call, but the syntax is slightly different because that function is encapsulated (basically inside) the class itself. The main difference between normal functions and class functions is they have access to class variables (This is the basics of data encapsulation incase you are wondering) but for your project, that probably won't matter much to you. So in short, the following snippet (taken from your first post) $tag = $wp_query->get_queried_object(); will execute the get_queried_object function of whatever class the $wp_query object was instantiated as, and assign the return value of the function to the $tag variable -
this print($query); die ; $update_tables_action = mysql_query($query) or trigger_error(mysql_error(),E_USER_ERROR); should be this print($query) or die ; $update_tables_action = mysql_query($query) or trigger_error(mysql_error(),E_USER_ERROR); you are exiting your script after you print the query, so it never actually runs
-
As far as databases go, I generally just have some functions that I use all the time, but I usually don't bother making a class because you get the same functionality when you don't use a class pretty much. I COULD add some extra functionality if I wanted to, but all in all it's not worth the effort in my opinion. However, classes do come in handy when you have a lot of code that is reused a lot, and it would benefit from OOP functionality like encapsulation, overriding functions, inheritance, etc. Like, say you have a general class that you can use with a bunch of different types of data. its so general that it will always (or almost always) work with all your input, but you can also override certain functions, or even add news ones to customize it to your needs.
-
[SOLVED] I need help in trying to assign value to a variable...
mikesta707 replied to Jim R's topic in PHP Coding Help
-> is PHP's way of accessing member functions and member variables in an object. say I had a class foo, with a function bar that would output "Hello world!" to access it I would do the following $foo = new foo(); $foo->bar(); and the foo class itself would look like class foo { function bar(){ echo "Hello World!"; } } make sense? -
$display = "<script type='text/javascript'>\n"; $display .= "jsArray = new Array();\n"; $count = 0; while ($row = mysql_fetch_array($result)) { $name=stripslashes($row['name']); $display .= "jsArray[".$count."] = '".$name."';\n"; $count++; } $display.= "</script>"; echo $display;
-
are you price and quantity columns integers? if so remove the quotes surrounding $price and $quant variables. Also, you may want to do a trim on your $quant variable because there is whitespace after it, and I'm not sure if you want that (although that may be due to incorrect placement of your single quotes
-
How to include quotes and image html in forum
mikesta707 replied to MDanz's topic in PHP Coding Help
unless you already sanitize your forum posts, HTML is already allowed. If you htmlentities the post, then you will probably have to go back through, and un-entity certain tags. you can do the "quote" system a few ways, but the most dynamic way would probably be via javascript. You could use the HTML dom to extract the words of a post, assuming the are enclosed by a div tag or something, and then take that string and put it in the textarea (perhaps wrap the string in BBC quote tags) -
hahaha wood. you could put that after your if statement, but if you are relying on post data being passed to the results page to show your results, you aren't going to want to do that. Why not just set your form's action to your results.php page?
-
Put the query string in a variable, not the query action itself. all that will do is either return a mysql resource, or return false. $query = "INSERT INTO shop (item_name, item_description, price, quantity, species) VALUES('{$name}' , '{$description}' , '{$price}' , '{$quant}' , '{$species}'"; echo $query; But I don't think you need to wrap your variables with curly brackets ("{}") unless they are arrays. try getting rid of those curly brackets
-
[SOLVED] I've lost my mind over a simple one line conditional
mikesta707 replied to kratsg's topic in PHP Coding Help
its because that if statement will always run true. You have to test if it is not equal to one AND not equal to the other, not if its not equal to one OR the other if($_GET['do'] != 'approve' && $_GET['do'] != 'deny') with the way you had it, if its approve, the first test will be false, but the second true, and vice versa for deny -
you could use a get variable and use that to decide which image to show. For example $id = (isset($_GET['id'])) ? $_GET['id'] : 71;//will assign id with either the get variable if its set, or the default value, 71 //make sure $id is valid if ($id < $first || $id > $last){ //not a valid id echo "Sorry but the image could not be found!"; exit(); } $last = 76; $first = 71; $file = "../../pics/jpgpics/P".$id.".jpg"; $caption = "No description"; //show the image echo "<html><head>"; echo "<title>My Gallery</title>"; echo "</head><body>"; echo "<h1>Gallery 09</h1>"; echo "<p><img src=\"$file\"></p>"; //now for the links if ($id != $first){//only show prev link if we aren't at the first image echo "<a href=\"$self?id=".($id-1)."\">PREVIOUS </a>"; } if ($id != $last){//only show next link if we arent at last image echo "<a href=\"$self?id=".($id+1)."\">NEXT</a>"; } echo "</body></html>"; ?>
-
unset pretty much just creates a whole in your session array. It will take out the value of the array at that key, but the key is still preserved. You also want to do session_destroy() to completely destroy the session
-
you have to surround strings with quotation marks. that will try to find a constant logout and since there is none, that will always run false if ($_GET['action'] = "logout")
-
http://www.phpfreaks.com/tutorial/simple-sql-search
-
a time field? and a type field?