Jump to content

Mundane

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Mundane's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks for your reply guys. jdavidbakr, the data is added to the database by third party software which I can't edit. I'm trying to remove the HTML tags in case a malicious user was to insert some when submitting the data (as I said, I can't stop it being submitted). ignace, where exactly do I insert it in my code, the strlen is throwing me off.
  2. Hi, this is probably really simple for the majority here, but it's catching me out. I want to know what I need to add to the code below to strip <> HTML tags from the field post_title. Hope somebody can help. Thanks in advance. <?php mysql_connect("********", "********", "********") or die(mysql_error()); mysql_select_db("website_news") or die(mysql_error()); $data = mysql_query("SELECT * FROM news_posts ORDER BY post_date DESC LIMIT 0, 5") or die(mysql_error()); while($info = mysql_fetch_array( $data )) { Print "<font color='black' face='arial'><li><a href='/website/news/?p=".$info['ID'] . "'>"; if ( strlen($info['post_title']) > 60) { $PostTitle = substr($info['post_title'], 0, 60); print $PostTitle. "..."; } else { print $info['post_title']; } Print "</a> <font color=#666666><i> - posted on "; $date = date('j M \'y', strtotime($info['post_date'])); Print $date; Print "</i>"; } ?>
  3. Hi all, I've built a few amateur sites in the past but am keen to utilize php combined with mysql for my current project. However, I have little knowledge of php and am just picking it up as I go (same way I've done for all my computer knowledge) What I'm looking for may sound simple, but I really don't know where to start and I'm hoping there are some kind souls here that will lend a hand. I've got some fantastic help here before and am hoping I'll get lucky again. SQL Database meetingid venue 001 new york 002 chicago 003 new york 004 new york 005 new york 006 texas 007 texas 008 chicago 009 new york 010 new york Question If I hard code everything around it, I'm just looking for the code I would need to have it display as follows: (hard coded text in blue) "New York has been used * times." (Where * would count the number of times "New York" appears in the venue column of the database.) "The most consecutive times New York has been used is % ." (Where % would count the maximum number of consecutive times "New York" appears in the venue column of the database.) Giving the output: New York has been used 6 times. The most consecutive times New York has been used is 3.
  4. Wow, thank you so much simshaun, this code worked a dream, exactly what I was after. I appreciate you giving up your time to put this together for me
  5. Thanks for your speedy reply BlueSkyIS, what you said does sound like exactly what I'm after. As I said I really am pretty new to using php and I'm not quite sure how to go about what you've said. Can you point me to a tutorial/sample code (or if it's only a couple of lines could you type a sample code for me?). Hopefully I'm not asking for too much, thanks I appreciate your time and help.
  6. Hi all, this is my first post on this site. I've built a few amateur sites in the past but am keen to utilize php combined with mysql for my current project. However, I have little knowledge of php and am just picking it up as I go (same way I've done for all my computer knowledge) What I'm looking for may sound simple, but I really don't know where to start and I'm hoping there are some kind souls here that will lend a hand. SQL Database Name Score John 42 Peter 46 Michael 56 Angela 46 (many rows like this) I am looking to output on my page a table of the top ten scores like this. However it's not quite that simple, should there be a tie on any score I want it to appear like so: 1. Michael 56 2. Angela 46 Peter 46 4. John 42 (onwards to 10) I want this to run from positions 1 thru 10, but should the 10th score in the database be equal to the 11th (12th, 13th etc) I would like them displayed too. For example: 9. Rafael 31 10. Sandy 29 Bernard 29 Jackie 29 Is this possible or would I be better off just sorting the info in excel and hard coding the info everytime? Hope somebody can help. Thanks in advance.
×
×
  • 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.