Jump to content

phpocean

Members
  • Posts

    35
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

phpocean's Achievements

Member

Member (2/5)

0

Reputation

  1. nvm, i got it working. I created two page, one page for the thumb and all the information and another page for just the img itself. When the img page is view, there's a code in there that add count 1 to column but when page with info and thumb viewed, no add 1 to column, tho all the info and image are in one row. It work out so I'm going with that.
  2. It seen I made thing harder than it's suppose to be. Lets see if I can explain this a little better. I have my full image path stored in a column in a row, which has other columns such as title and hit and thumbnail full path and description in this same row. I can also create another table and have only the image path stored there and have all other information, such as thumbnail and description stored in another table if needed. On one page, I pulled all the information except for my image path. I also created a link on this page which will download the image because I don't want to show the image on this page due to its large size. All in all, I just wanted a code in which it would add + 1 count to my hit count every time my image is viewed.
  3. Hello, This code, which is in my page1, upate my hit count by 1 every time the page is viewed. <?php // update hit + 1 mysql_query("UPDATE wallpaper_large SET hit=(hit + 1) WHERE id = '".$Article."'"); ?> Note: Small img colum has the full link to my small img and so does median and large. What I have in my MySQL: I have row with column small img, median img, and large img. Page1 only used median img, but there is a link on page1 to get the large img. What I wanted to achieve: As I stated above, I have the update hit + 1 on that very same page (Page1), but I don't want the update to + 1 to my column when Page1 is viewed, UNLESS the link to large img is clicked. I was thinking maybe I can use "IF" but I don't know where to start. If you have anyway of doing this at all, please let me know. Thanks. ------------------------------- D=P Ocean+Love+PhD
  4. Thank Maq. All is working now. Only one little problem, can you check my syntax here for me? <?php echo (substr(html_entity_decode($list['title'])))>36) ? substr(html_entity_decode($list['title']), 0, 31) . "..." : $list['title']; ?> using it without the html_entity_decode is good and in perfect condition but when I added html_entity_decode in, I must have done something wrong with the syntax as well. I'll try to solve it, but just thought I'll post it in case you can find the problem before I do.
  5. I red the substr() from php.net but don't find anything on cutting off long title and add ... to the end. Ok to refresh back, what I wanted is how can I make it that if the title is too long, it would cut it off at 36 characters and add ... to the end, noting that the title is too long to show all the words. <?php print substr($list['title'], 0, 36); ?>
  6. Ok I got the second part working now. I am currently studying the 1 part now... which involve having the last 3 characters as ... instead of their actual characters. Thank Maq, for the great services.
  7. What I want is to have the numbers of characters to be displayed on my php page to be limited to 36 characters and for the last 3 characters to be displayed as ... telling my viewer that there is more but just not shown. Currently I am using this code and it solved 1 of my 3 problems. <?php print substr($list['title'], 0, 36); ?> This code limited the characters show on my page to 36. What i still want is: 1. Have ... be displayed on my page as the 3 last characters to tell my viewer there's more but not shown. i.e. 36characters... 2. The second issue I still have is not a big deal but would still be nice to have is how can I get < and > to count as two characters and not 8? FYI: < and > are just < and > symbols. I have try to tackles this issue for a while now and come to no solution, please help me out a little. Ocean
  8. When I store them in MySQL as < and >, it won't show my on my php page. Say if I store it like <News> in MySQL, it will show as News without the <> on my php page. By the way, are you saying if I input them through php INSERT code instead of phpMyAdmin, it will show? But isn't there a way to do it using phpMyAdmin?
  9. I have a question but can't search on google since google doesn't do < > search. In my MySQL, I wanted to input < > instead of < and > because < and > only take 2 characters as suppose to 8 with < and > Or is there another way?
  10. Ok it work like charm. Just on the side, MySQL doesn't read < and > so I used < and > instead, well that kinda takes away 8 characters instead of 2, is there a way to solve this issue? Also I wanted it to add ... to the end when the character is at 15, something like this: 012345678912345... Maybe I am asking for too much but please bear with me a little while. Ocean
  11. I have but didn't work. Ok i will next time, post in right section. Ok i'm stuck, here is my complete query: <?php // Connect to database. // get the info from the db $sql = "SELECT * FROM home ORDER BY id DESC LIMIT 5"; $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); ?> <?php // while there are rows to be fetched... while ($list = mysql_fetch_assoc($result)) { ?> <tr> <td class="tal vam"><div style="margin:7px 0 5px 3px;"><a href="<?php print $list['link']; ?>" style="color:white">[<?php print $list['class']; ?>] <?php print $list['title']; ?></a></div></td> <td class="tar" style="color:white"><?php print $list['date']; ?></td> </tr> <tr style="height:1px;"><td colspan="2" style="background:white;"></td></tr> <?php } // end while ?>
  12. Can I do this: <?php // while there are rows to be fetched... while ($title = mysql_fetch_assoc($result) substr('$row[title]',0,15)) { ?>
  13. Hi, What I want: How can I limit the number of characters shown from mysql database? I wanted it to incorporate it into my current query: $query = "SELECT * FROM home ORDER BY id DESC LIMIT 5"; Say I called for $row[title]; and wanted not all the title characters to show but only about 15 characters. Much appreciated. Edited: by the way, is white space count as a character? Ocean
  14. Thank Ken. I only used this part of the code and it seen to do the trick beautifully but I don't know if using it this way posses any threat to my database. <? mysql_query("UPDATE news SET hit=(hit + 1) WHERE id = '".$Article."'"); ?>
  15. Ken, do you know how to do what y2yang say? Updating the column every time it's accessed using php.
×
×
  • 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.