Jump to content

jo.nova

Members
  • Posts

    27
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jo.nova's Achievements

Member

Member (2/5)

0

Reputation

  1. Well, first of all, I'm not an expert, so some more specific error checking advice would be appreciated. How would I use mysql_error() if I'm building queries and feeding them to a database object, instead of talking directly to the database?
  2. Hi, Can anyone find something wrong with this statement? //store the current section id $secNum = $secResult[$i]->id; //check value echo "Section: " . $secNum . "<br /><br />"; //set query $sql = "SELECT * FROM #__categories WHERE section = $secNum GROUP BY id ORDER BY ordering"; //get results $database->setQuery($sql) or die ('Could not set category query'); $catResult = $database->loadObjectList() or die ('Could not load category object list'); It fails every time. Here's the output: The statement runs fine when run through phpMyAdmin, except I have tweak the table prefixes because of the DB object abstraction. Any ideas?
  3. I highly recommend Joomla. It's very extendable, plus there's some extensions already available for what you want to do. Joomla is all that I use for websites because it rocks. Good luck!
  4. I'm working on modding a Joomla component. I'm not quite sure, but I'm unable to set a query: // get all the categories that are bound to a content item $sql = "SELECT #__categories.* FROM #__categories INNER JOIN #__content ON #__content.catid = #__categories.id AND #__categories.published = 1 AND ( publish_up = '0000-00-00 00:00:00' OR publish_up <= '$now' ) AND ( publish_down = '0000-00-00 00:00:00' OR publish_down >= '$now' ) GROUP BY #__categories.id ORDER BY #__content.ordering "; $database->setQuery($sql); $result = $database->loadObjectList(); for($i = 0; $i < count($result); $i++) { //get current section id $secID = $result[$i]->section; echo "Current section ID is: " . $secID . "<br />"; //query: select all category items that have the current section id $sql = "SELECT #__categories.* FROM #__categories WHERE #__categories.section = '$secID' AND #__categories.published = 1 AND ( publish_up = '0000-00-00 00:00:00' OR publish_up <= '$now' ) AND ( publish_down = '0000-00-00 00:00:00' OR publish_down >= '$now' ) GROUP BY #__categories.id ORDER BY #__categories.ordering" or die ("Could not assign query"); $database->setQuery($sql) or die ('Could not set query: '. $sql); $catResult = $database->loadObjectList() or die ('Could not load object list'); ... The script makes it to this line, then dies: $database->setQuery($sql) or die ('Could not set query: '. $sql); Can I not use $database->setQuery within the for-loop? Can't code within the loop reference variables that are in a scope above it? - Joe
  5. How would I write a function to check if someone is a certain age?  They will be filling in a date of birth field, which I can check against today's date.  But how do I implement it?
  6. Whoa...that's crazy.  How's it work?  ;)  Thanks, I'll play with it! - Joe
  7. I'm using the free DHTML date-chooser calendar from DHTMLgoodies.com.  I'm using it so that customers can simply pick a date from one interface instead of using three drop-down boxes. The dates chosen from the calendar represent the date/time that a customer would like to pick up their project. So, to give us some time, I set the default due date to be three days from the current date: [code] <?php $dateyear = date(Y); $datemonth = date(m); $dateday = date(d) + 3; ?>[/code] But, if it were the 31st of August 2006, the above code would just set the due date to be the 34th of August 2006, which obviously is no good. So, I wrote the following to compensate for this: [code] <?php if (($datemonth == 01) & ($dateday > 31)) {$datemonth++; $dateday = $dateday - 31;} if (($datemonth == 02) & (($dateyear % 4) == 0)){ if ($dateday > 29) {$datemonth++; $dateday = $dateday - 29;} } else if (($datemonth == 02) & (($dateyear % 4) !== 0)) { if ($dateday > 28) {$datemonth++; $dateday = $dateday - 28;} } if (($datemonth == 03) & ($dateday > 31)) {$datemonth++; $dateday = $dateday - 31;} if (($datemonth == 04) & ($dateday > 30)) {$datemonth++; $dateday = $dateday - 30;} if (($datemonth == 05) & ($dateday > 31)) {$datemonth++; $dateday = $dateday - 31;} if (($datemonth == 06) & ($dateday > 30)) {$datemonth++; $dateday = $dateday - 30;} if (($datemonth == 07) & ($dateday > 31)) {$datemonth++; $dateday = $dateday - 31;} if (($datemonth == 08) & ($dateday > 31)) {$datemonth++; $dateday = $dateday - 31;} if (($datemonth == 09) & ($dateday > 30)) {$datemonth++; $dateday = $dateday - 30;} if (($datemonth == 10) & ($dateday > 31)) {$datemonth++; $dateday = $dateday - 31;} if (($datemonth == 11) & ($dateday > 30)) {$datemonth++; $dateday = $dateday - 30;} if (($datemonth == 12) & ($dateday > 31)) {$datemonth++; $dateday = $dateday - 31; $dateyear++;} ?> [/code] BUT, I'm still getting the same results: the date increases to a number that is beyond the number of days in a month. For exampe, I just ran the code and  the due date came up as August 33rd, 2006. Where am I going wrong? - Joe
  8. Corona, you're the dopest!  I didn't know that!  I'll try it, thanks!
  9. I know that when using Adobe Designer, I am able to set the PDF form to send XML to a server.  So, theoretically, you should be able to write a PHP script that catches that XML and does something with it. I'm not sure where to find any guides, though! Sorry! - Joe
  10. I've created a multi-page form that I want to have store information until the last page where it will then be entered in a DB. The first page is a <form> that calls the second page upon submittal.  The second page is a PHP script that validates the data then displays a java file-upload applet.  The java applet calls it's own PHP script (which I've modified for my needs).  This second page can successfully echo test variables from the $_SESSION array.  After uploading files, the user clicks a "Next" button, which is actually a submit button that loads the third and final page. The third page will contain a confirmation number and will do three other things:  1) enter all variables into the DB, 2) email the user and the administrator, and 3) destroy the session. At this point, I am unable to echo any $_SESSION variables on the third page, but I AM able to echo them on the second page. Do I have to do something special for the third page to acknowledge the session?  What am I missing here? - Joe
  11. Sure, I can edit any of the PHP. But I can't edit the applet, obviously, because its a JAR application file. So, no it's not a matter of not being able to edit the PHP scripts.  I'm just asking "what's the best angle for this problem"?
  12. I started a thread about this yesterday, but it looks like its gone! I'll be more clear this time. I'm trying to implement a form that gathers customer information and allows them to send me files.  Right now, the script takes the form's $_POST variables, puts them in a MySQL database, emails me with the customer information and attaches their file to the email, and also emails the customer a confirmation email of their order. I've run into two problems:  1) The php.ini on my host has the max_upload setting set to 8MB and 2) even if I bumped up the max_upload setting, I would still have to worry about browser time-outs for large files. So, I've found an open-source applet that allows uploading to my webserver.  I've tied this applet into my form, and it works great, but now I've got other problems.  The applet uses a php script to name the file and move it from a temporary location to its permanent location.  This script is called as a parameter of the applet.  The problem is that the script uses the flush() function; so after it's done, the variable that contains the file's name is blown away. I need to be able to capture the file name and send it in the emails. Or even better, when the form is submitted, create a folder named the same as the unique order number, then move the files into that folder. Any ideas?
  13. Hmmm...That didn't work. Here's what I got as a response: Warning: Cannot modify header information - headers already sent by (output started at /home/content/r/o/c/rocknroll124/html/site/sendfile/test1.php:9) in /home/content/r/o/c/rocknroll124/html/site/sendfile/test1.php on line 16 I read in the manual: "Note:  Since PHP 4.4.2 and PHP 5.1.2 this function prevents more than one header to be sent at once as a protection against header injection attacks." Is there another way?
  14. So, I have some variables in a PHP script that I would like to carry over to a different page when it loads. How do I do it?  With global variables? How would I use them?
×
×
  • 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.