Jump to content

spiderwell

Members
  • Posts

    1,008
  • Joined

  • Last visited

Posts posted by spiderwell

  1. but didn't work because both parent.name and node.name are displaying the he same field name.

     

     

    I would say you have answered this yourself, you need to seperate out these 2.

    Look again what you are passing into the $iterator array, and make sure you only pass the parent to it?

     

    without seeing that part of the code, I cannot be sure what is in that array.

     

    Also in your SQL you are asking it to return parentname as  node,  and categories as parent, which only adds to confusing me more! and maybe you?

  2. also looking at your code and error it might well be that you have characters in your form inputs that might be breaking the SQL statement, such as ' or ` etc.

     

    it is very bad practice to put form data directly into an sql statement, thats how sql injection is done. at very least put a mysql_real_escape_string() around every $_POST[]

  3. hi all,

     

    i wrote an event for a client's database that is supposed to run once a day, but having checked the database again, it doesnt seem to be occuring,

    essentially what it does is clear out a row's info and reset it to a 'for sale status' from 'on hold' if its been on hold for more than 2 days.

    what it does is working fine, its when it does it that doesn't seem to be working correctly

    could anyone confirm for me if i have correctly structured the part that makes it run once a day every day.

     

    many thanks

     

    
    
    
    CREATE EVENT `checkonhold`
    ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 DAY
      ON COMPLETION PRESERVE 
    DO 
    
    UPDATE `tbl_sales` 
    SET 
    `Sales_Status` = NULL, 
    `Sales_Hold_Date` = NULL, 
    `Sales_PrintRequired` = NULL, 
    `Sales_Date` = NULL, 
    `Sales_User_ID` = NULL, 
    `Sales_GalleryDelivery_Date` = NULL, 
    `Sales_RetailPrice` = NULL, 
    `Sales_Currency` = NULL, 
    `Sales_EuroRetailPrice` = NULL, 
    `Sales_ArtistPercentage` = NULL,
    `Sales_GalleryPercentage` = NULL, 
    `Sales_CommissionOther` = NULL, 
    `Sales_ClientName` = NULL, 
    `Sales_GalleryDiscount` = NULL, 
    `Sales_Billed` = NULL 
    WHERE `Sales_Status` = 'Hold'
    AND `Sales_Hold_Date` < date_sub( 
    CURRENT_TIMESTAMP , INTERVAL 2 
    DAY ) 
    AND `Sales_User_ID` <> 2
    

     

    also would there be any logs on mysql to show it is run daily, so i can further check this

  4. username is not part of the FILE variable, but seperate, perhaps you are looking for name? to get file name.

    and because it doesnt exist the move file, becomes just a directory, as the file name isnt on the end location

     

    replace all $_FILES['uploadedfile']['username'] with $_FILES['uploadedfile']['name'] might fix it

  5. I just started out with php so I'm pretty much a noob.

    How are answers stored normally without a database, in an asp file?

     

    php is one language, and asp is another, the 2 really dont mix.

     

    you could easy store in a text file, using a delimiter to seperate Q from A but then you lose handy functions that databases can easily be used to do, like sorting, filtering, paging and so on. I am sure you could recreate that with a text file, but why reinvent something when you dont have to.

  6. assuming the Q&A are in a database,  using pageination (think thats the right term) and set record limit as 1 row per page.

    the form could have hidden value for next page number and when form posts to itself, you know which page is next (i.e next question) and show that, as well as of course checking the current question and answer.

     

     

     

    there might be alternative methods but thats what came to me when i read your post

     

     

  7. yes you would get the same thing at the end.

     

    its a technique to prevent errors in your code with undefined variables.

    its down to personal preference, but really its better to catch potential errors than not, even if you know that $_POST is going to be there.

     

    you dont have to do it, just like you dont have to do many things in code, but in a professional environment, it would be expected to write code that is covering any possible errors that might be thrown.

     

×
×
  • 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.