Jump to content

ow-design

Members
  • Posts

    56
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ow-design's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello, I need help as i cannot figure this out with other coding i have tried. If you have a look at the following site: baseyouthproject.org.uk you will see under 'Ask Auntie Annie' that i need a title pulled from a mysql database but only to be displayed with limited characters to neatly be displayed over 3 lines. I could really do with help with this and if possible i also need help to pull the newest 3 titles to be displated underneath each other as shown on site. If anybody could help it would be greatly appreciated as this one has really got me! Thank you.
  2. No it is still giving the message Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/deswo/public_html/clients/baseyouthproject/shorten_a_text_string1.php on line 27 Any ideas?? Sorry.
  3. the word table isnt in there?? and yes the column i am pulling up is called title
  4. <?php $con = mysql_connect("localhost","user","pass"); if (!$con) { die('Could not connect: ' . mysql_error()); } ?> <?php function ShortenText($text, $chars=80) { $text = substr($text,0,$chars); $text = substr($text,0,strrpos($text,' ')); $text .= '...'; return $text; } // get the latest 3 news feeds $sql = 'SELECT title from table ORDER by id LIMIT 3'; $result = mysql_query($sql); // display news while($row = mysql_num_rows($result)) { // display shortened title, returns the first 30 chars. echo shortText($row['title'], 80); } ?> however the following is displayed now Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/deswo/public_html/clients/baseyouthproject/shorten_a_text_string1.php on line 27 line 27 is while($row = mysql_num_rows($result)) please help Thank You
  5. Hi everybody i am a little stuck at the moment, I am creating a site that needs to display on the home page a shortened title of a news story that a user can click to get full story. I have the shortening code: <?php function ShortenText($text) { // Change to the number of characters you want to display $chars = 80; $text = $text."database row would go here"; $text = substr($text,0,$chars); $text = substr($text,0,strrpos($text,' ')); $text = $text."..."; return $text; } ?><p></p> <?php echo ShortenText($text); ?> But i need this code to bring up the newest 3 rows of a database table that holds the news stories and display the shortened content. Any ideas? Thank You
  6. Its okay i have orked this out now, thankyou for all your help
  7. okay i dont know what i am doing wrong but this is not working... Would you be able to give me a complete code... To connect to a database to select from a table called pages and looking for the ?page= and the code i need to pick the title, content and author from the table row and display them individually.?? Really appreciate any help. Thank You
  8. Right so that is displaying the entire row, So what is i just want to display information in diffent places of the webpage? If i do a php echo that is not working???
  9. Hi, Okay i am struggling with this one as a PHP newby, I can get information from a database using id?=(numeric figure) but how do i call from a database using a title. I have for example a table with the following columns, title, Content, Added how can i get information from a row with an address such as. www.site.com?page=Home Thank You, Ollie
  10. Okay the basic code i have so far is: <?php $link = mysql_connect('localhost', 'myusername', 'mypassword') or die(mysql_error()); mysql_select_db('opportunities'); $category = mysql_real_escape_string ($_POST['category']); $q="select * from opportunities where title like \'%$title%\' or category like \'%$category%\'"; mysql_query($q); ?> <form method="POST" action="search1.php"> <p><input type="text" name="title" size="22"></p> <p><select size="1" name="category"> <option>solicitor</option> <option>lawyer</option> <option>builder</option> </select><input type="submit" value="Submit" name="B1"></p> </form> When a user submits the form i want to be able to get info from the database where titles match 'keywords' entered in the title field. Is the above code right for this and how do i then display the results.? Thanks.
  11. Okay, the one i used for Joomla, for another non-paid community website. Right.
  12. What Templates please explain??
  13. Wow You people are all so helpful. and i think you will find im not charging my client as he is a neighbour of mine. i just needed some friendly advice of the best way to go about this... Im sure none of you ever needed help and PHP happened to come naturally to you.
  14. I dont really understand your point... I am on this site asking for help which is the point of this site being here... As i said its urgent to me... of course its not urgent to you. And if you think that it is "Your Problem" then perhaps you should read the description of this site... "PHP Support". .. Again if anyone can help me that would be great.
×
×
  • 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.