Jump to content

dannyb785

Members
  • Posts

    544
  • Joined

  • Last visited

Posts posted by dannyb785

  1. Ready for the complicated, in depth, difficult code to accomplish this task? It goes like this:

     

    you will have a file in your main directory called '.htaccess'(just that, no more no less). Open it in an editor, and add the following lines:

    RewriteEngine on
    RewriteRule ^([a-zA-Z0-9_-]+)$ viewprofile.php?user=$1
    RewriteRule ^([a-zA-Z0-9_-]+)/$ viewprofile.php?user=$1
    

     

    Granted, viewprofile.php and the $_GET['user'] variable needs to be replaced with whatever page you have that views the user's profile

  2. ok, i have looked at the enum docs.  so ENUM(0,1) will have the 0 false and 1 true values in it.

     

     

    How do i set that in phpmyAdmin?

     

     

    no.

     

    enum allows you to setup the column so only specified value can go into it. If you want 0 and 1 to be the only values allowed, then you'd do ( '0', '1' ). It has nothing to do with 0 false values and 1 true. You need to think about why you are making the column enumerated. Is it required that the column only be one of a few different choices? If not, just make it a varchar or an int

  3. on your submit button, you have onclick=wstxSubmitForm(this) but I dopnt see the wstxSubmitForm() anywhere on the page nor did I find any included .js files that had it in them.

     

     

    Also, for current medications, you have "check all that apply" but you have radio buttons... so a user can only check one at any given time... you need to change them to checkboxes.

  4. I am pretty sure that I have inserted the data into the database, and the search brings up this error.

     

    SQL query:

     

    WHERE fname LIKE '%mike%'

     

    MySQL said: 

     

    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE fname LIKE '%mike%'' at line 1

     

    fname is the column name, and mike has been inserted in there, I am pretty sure.

     

    lol dude, when I said "WHERE fname LIKE '%mike%' " I meant to add that to the end of the "SELECT * FROM table" statement.

  5. for the previous image, SELECT * FROM Image WHERE image_id < '$current_image_id' LIMIT 1

    for the the next image, SELECT * FROM Image WHERE image_id > '$current_image_id' LIMIT 1

    that won't work..

    okay current image is 5 i have 10 images (from 1 to 10)

    using the above selects next would be 6 BUT prevous would be 1.

     

    as i suggested before do some reseach on pagination, here some info

    http://www.tonymarston.net/php-mysql/pagination.html

    you could also search this forum.. when it comes to $rows_per_page just use 1

     

    My bad, for the 'previous' link, you'd need to order by image_id DESC. Then it'd be fine.

     

    MadTechie - I'm reading up on pagination as we speak ;-)

     

    Really appreciate your help.

     

    Loving this PHP stuff!

     

    good to know you didn't even acknowledge my help.

  6. Ok, I'm using the column names that you provided, here's what you should do

     

    SELECT *, (rating / (todays_date - dateJoined) ) AS sort_info  FROM 'table' ORDER BY sort_info DESC

     

    or make DESC into ASC if that corrects the order

     

     

    By doing the math with the columns and putting AS, you create a new column that is based on the function provided. And then you'd just sort by that new column.

  7. Is it a problem going backwards and forwards from the database like that?

     

    it's not bad, just probably uses more processing memory than needed. bc if one image is id #2 and the next is id#30, you have to check 28 images before you find one. Even though computers are pretty fast, kimagine if you have a few hundred(or thousand) users doing it at the same time. Not efficient!

     

    An easy method you could do would be

     

    for the previous image, SELECT * FROM Image WHERE image_id < '$current_image_id' LIMIT 1

     

    for the the next image, SELECT * FROM Image WHERE image_id > '$current_image_id' LIMIT 1

     

    where $current_image_id is the image currently being viewed(if that wasn't obvious).

  8. KEY is a MYSQL Reserved Word, you can't use it as a fieldname unless you backtick it.

     

     

    duuuuuude that's it.

     

     

    editL that's a perfect example of why, when I create a table, I name my rows according to the table's name. i.e. if my table name is downloads, I start ALL my column names with "dl_" or "d_" or something simialr. That way I never run a risk of naming a column after a keyword. Plus it's easier for me to identify which variables go to which values. I suggest you do the same.

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