Jump to content

mikesta707

Staff Alumni
  • Posts

    2,965
  • Joined

  • Last visited

Everything posted by mikesta707

  1. array_keys($row) ?
  2. 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?
  3. 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
  4. 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?
  5. perhaps delete the space between the numbers and the commas, IE it should look like , 1800, 1,
  6. 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'];
  7. echo the query again. what does it look like
  8. 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'
  9. 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?
  10. 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.
  11. 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
  12. 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
  13. 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.
  14. -> 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?
  15. $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;
  16. 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
  17. 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)
  18. 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?
  19. 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
  20. 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
  21. 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>"; ?>
  22. 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
  23. 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")
  24. http://www.phpfreaks.com/tutorial/simple-sql-search
  25. a time field? and a type field?
×
×
  • 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.