Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Posts posted by ginerjm

  1. Huh?

     

    You don't make much sense to me. And posting a stream of code such as you did is not the way to encourage help. Good coders write their code in neat formats to make it easy to spot things, to make it easy to read and understand. Perhaps a better composed description of WTH you are trying to do would help too.

    • Like 1
  2. 1 - try turning on php error checking at the very top of your scripts.

    2 - do some debugging. At the point that you THINK you have prepared the data to be inserted into the word template, dump it out to the screen and check it.

     

    If your script is failing before that, insert some echos at various points leading up to that to be sure that you are getting that var.

     

    This is what programmers do.

  3. You are using php to setup error handling messages in JS. Why? You do realize that you can't have php and JS interact in real time?

     

    If you want a real time error message then stick only with the JS code to check the values onsubmit. If you don't want real time, then stick to only php to edit the posted values and send the screen and data back to the user. Can't have it both ways.

  4. To give you the details.

     

    1 - get a user id and password from the user

    2 - encrypt the password and save the userid and the encrypted password in the users table.

     

    When checking a user's login attempt:

    1 - get the user's id and password entries

    2 - encrypt the password value the exact same way as you did when you stored it

    3 - do a query on the table to get the record that matches both the user id and the encrypted password entry

    4 - if the query returns exactly 1 record - the user logged in correctly. If not - send them back to login again.

     

    As said by Maxxd - you don't return the password in the query, nor do you get it and save it anywhere. The password is not needed once you verify that it was provided correctly. If you need to remember that a user is logged in you create a token that indicates that to your application, such as a $_SESSION var or a cookie but in no way do you store sensitive information in either place.

  5. You need to study on how to build a properly structured relational database. Some ideas you should think about are what attributes you want to link to what data. Such as the name of the page from where an item came from should be stored with that item, or linked to it along with other data directly linked to that item.

  6. How about "DAY(date) as date_dd" and "MONTH(date) as date_mm" and then use date_dd and date_mm as your indices into $row?

     

    AND definitely change your code to stop using MySQL_* functions. They are going out of PHP soon.

  7. Upon further review:

     

    YOu are doing two query calls. You are trying to grab data before you do the fetch, which I finally noticed.

     

    - do the query call (just once!)

    - check if it ran

    - check if there are rows

    If all this works:

    - loop thru the rows and grab the items from the $row and echo them

  8. Not the way one is supposed to design a database.

     

    You have people - persons as you call them. They each have some qualities - attributes in db lingo - which consist of things like:

    name

    gender

    address?

    title?

    phone?

     

    and other things. These all belong in one table unless you find that you have multiples of them, such as two addresses. (People often have multiple phone numbers but I like keeping them stored in the main table under unique names such as 'home','work','mobile' rather than using a second table.

     

    So - in your case - you should not be storing gender in a separate table. Especially since a person can only have one gender and it usually doesn't ever change.

  9. So - I'm guessing that you didn't write this code yourself since you can't even be bothered to look up how to do what I suggested, since you state that you 'echo' statements aren't showing anything.

     

    Being new to PHP (or any language) means that you have to do some homework, some reading, some learning, some attempt to comprehend what you are trying to achieve. Not just post some code that you gleaned and can't figure out and ask for someone else to teach you. Make the effort!

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