Jump to content

premiso

Members
  • Posts

    6,951
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by premiso

  1. Alright, I actually tested this one: function getCatPageTitle($catId) { global $database; if ($catId == 0) return; // no more to display; $sql = "SELECT id, name, parent from dir_category WHERE id = '$catId'"; $database->SetQuery($sql); $rows = $database->loadObjectList(); $titles = array(); foreach ($rows as $row){ $titles = getCatPageTitle($row->parent); $titles[] = $row['name']; break; } return $titles; } $titles = getCatPageTitle(7); echo implode(" - ", $titles); That "should" work correct.
  2. Well, I looked at my code and found some flaws. Let's try this: function getCatPageTitle($catId, $title='') { global $database; if ($catId == 0) return $title; // no more to display; $sql = "SELECT id, name, parent from dir_category WHERE id = '$catId'"; $database->SetQuery($sql); $rows = $database->loadObjectList(); foreach ($rows as $row){ $titles[] = getCatPageTitle($row->parent, $row->name); } return $titles; } $titles = getCatPageTitle(6); echo implode(" - ", $titles); Give that one a try, I think that is correct now. Untested still.
  3. $date = explode("/", $date); $date = $date[2] . '-' . $date[1] . '-' . $date[0]; $start_dttm= $date . ' ' . $time . ':00'; Should put it in that format. The above should work as far as I know.
  4. You need to use recursion to have this trickle down and display the breadcrumb. function getCatPageTitle($catId, $titles=array()) { global $database; if ($catId == 0) return; // no more to display; $sql = "SELECT id, name, parent from dir_category WHERE id = '$catId'"; $database->SetQuery($sql); $rows = $database->loadObjectList(); foreach ($rows as $row){ $titles[] = getCatPageTitle($row->parent, $titles); $titles[] = $row->name; } return $titles; } $titles = getCatPageTitle(6); echo implode(" - ", $titles); That is untested but is the gist of what you need to do. Look into recursion. EDIT: Forgot the return variable lol, added that in.
  5. When I tried running your form that was the error. I believe maq pointed out this error earlier. You need to modify that WUcontact.html and change the above like maq said and it should work.
  6. Try setting the cookie parameters, domain and path. setcookie("mysite", $_POST['pass'], time()+3600, "/", ".yourdomain.com"); And to unset setcookie("mysite", "", $past, "/", ".yourdomain.com"); If you are trying to do this on localhost, let me know and I will post instructions on how to properly set/unset cookies on localhost, as it can be picky. Also it is a good idea to set the time 1 day back due to timezone issues. EDIT: If using localhost, you would use this to unset the cookies: To set the cookie: setcookie("mysite", $_POST['pass'], false, "/", false); To unset (sort of): setcookie("mysite", "", false, "/", false); I am not sure why that works with localhost (at least on Apache on Windows). That seems to work for me.
  7. I did not mean take out all Trim, just replace the Trim with trim and then take out trim from your if statements. You are already trimming when you assign the variables, no need to trim again. The error you have, chances are it is from removing the trim and forgetting to remove a ). Update that and re-post the updated code so I can see what we are working with.
  8. $EmailTo = "ornclo@aol.com,ornclo@aol.com"; Why do you have that duplicated? Are you saying that the email is not being sent? You are also double trimming, I do not think that is needed, also you use Trim, not sure if it matters but it should be trim since php is case sensitive it may matter.
  9. I am confused then, why not just use fsize to test the file size? I think the issue would be within the temp folder, but not 100% sure. You could, as an alternative base, do the move command on the file, then check the size, if the size is bad unlink that file. But yea, why not just use the fsize?
  10. Look into jquery. You basically take the input from the boxes, by name or id, then use ajax to post it to a page. They should have plenty of jquery ajax examples of how to do it. So basically you are sending it to a php page and it processes it as post data. All in the mean time the information is also sent to that site. Not that I condone this, but yea. That is the logic.
  11. Can you post the code you are using this in? Maybe that will give us some hint on how to fix this issue for you.
  12. You put the [ code][ /code] (no initial space) around your code IE: <?php // Your code here ?>
  13. No, I think, now do not quote me on this, that checkboxes just return if they were "on" or "off". Given that, if the checkbox was on, you set it to 'y' if it was off you set it to 'n'. The best bet is to create a static test page and setup multiple checkboxes, check half them then post it to a page that does a vardump of the $_POST data, and that will tell you the truth of what it does.
  14. You could even just use javascript, that onsubmit it runs a function that sends an ajax request to the page you want the data, that way the user never knows you are sniffing it (unless they view source) and it posts just fine and you get a log of what was entered.
  15. I know it is kind of stupid, the code looks fine so I am throwing this out there: Are you sure you are connecting to the right database?
  16. I think he is asking for how to setup the checkbox bud. $query = "SELECT * FROM icu INNER JOIN dos ON icu.id_incr = dos.pt_id AND dos.completed = 'n' "; $results = mysql_query ($query) or die (mysql_error()); while ($row = mysql_fetch_assoc ($results)) { echo '<td>' . $row['dos_id'] . ' completed? <input type="checkbox" name="completed[' . $row['dos_id'] . ']" ' . (($row['completed'] == 'y')?'checked':'') . ' /></td>'; } First off you need a form to do this, inside the form I would put the ID you are going to reference. Then when you process it, you would do this: <?php // change this to post or get depending on what you have the form do if (isset($_POST)) { if (is_array($_POST['completed'])) { foreach ($_POST['completed'] as $id => $val) { if ($val == "on") { // I am not sure what you check here to see if the checkbox is checked $sql = "UPDATE dos SET completed = 'y' WHERE dos_id = '" . $id . "' LIMIT 1"; mysql_query($sql) or die("SQL WAS $sql <br /> ERROR: " . mysql_error()); } } } } ?> That should get you on your way.
  17. If you want just the count, this is the better/preferred method: <?php $sql = "SELECT count(id) as cnt FROM `table`"; $query = mysql_query($sql) or die(mysql_error()); $cnt = mysql_result($query, 0); echo $cnt; ?> Do not use count(*) as it is slower and less efficient. Defining a column is much faster and you should generally use the index/primary key column. EDIT: Sort of beaten to it by Thorpe, but yea, since I do not use count(*) I figured this was ok to post
  18. implode the array and it will. No you do not need to tidy up the html. Just make sure the ones you want allowed are in the 2nd parameter like shown in the manual.
  19. Correcto mundo! You have a total of 21 rows to be displayed, but you are only allowing 20 items to be pulled out per page, make that 21 and you should be fine.
  20. I am just saying, if you code validation in javascript you need to also code it in PHP. Anyone can easily create a form that posts to your form and in essence bypass the javascript check all together and now you get bad data. My approach is ajax and I use my PHP Validation function to check it, that way I only have to code validation once I am just saying, javascript is good to validate, but you need PHP to check due to people being able to easily get past the Javascript checks.
  21. You said you tried the etc, just checking did you try shell_exec? If you have, had you looked into virtual? Give either or both a try and see if that helps. If you have tried them, let us know and I will throw some more ideas at ya. EDIT: I just found this too http://devzone.zend.com/node/view/id/1712 which may help.
  22. You can try and trim the $_POST and see if they are getting white spaces from somewhere. But try echoing out that query instead of running it, then opening phpMyAdmin and see if it runs there, if not it is probably the id and live are not in the DB.
  23. View the HTML Source of a problematic page and post that here for an easier diagnosis.
  24. If you setup the form as gevens suggested you could do this: <?php if (isset($_POST)) { if (is_array($_POST['id'])) { foreach ($_POST['id'] as $id) { echo "ID is set to $id <br />"; } } } ?> Will give you access to those items dynamically and easily.
×
×
  • 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.