Help In 2 Parts

free web hosting
Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

Help In 2 Parts

ewcreators
Please HElp.

Can you teach me :
a) How to use smilies with php so that if i want to create a post office or forum , a person who posts with smile.gif or biggrin.gif will get a smiley pic instead of just smile.gif or biggrin.gif.

cool.gif How to divide mysql results into pages


~Thanks!

Reply

galexcd
For your smilies you can just use a php replace function. You could use preg_replace, but thats kind of a waist because smilies aren't as complex as bbcode so I suggest using str_replace
Here is an example of how you would do this:
CODE
$string=str_replace(array(":)",":P",":D",":("),array("<img src='/emoticons/happy.gif","<img src='/emoticons/toungue.gif","<img src='/emoticons/grin.gif","<img src='/emoticons/sad.gif"),$string);
echo $string;


or if you find it easier to write it out you could write it like this:
CODE
$search=array(":)",":P",":D",":(");
$replace=array("<img src='/emoticons/happy.gif","<img src='/emoticons/toungue.gif","<img src='/emoticons/grin.gif","<img src='/emoticons/sad.gif");
$string=str_replace($search,$replace,$string);
echo $string;



I found the best way to divide sql results into pages is by using limit. Take in a variable lets say "page" through the url via get, and use this code:
CODE
$rowsperpage=5;
mysql_query("SELECT * FROM whatever your sql query is goes here LIMIT ".($_GET['page']*$rowsperpage-$rowsperpage).",".($_GET['page']*$rowsperpage-1));

You should also add checks to make sure that $_GET['page'] is greater than 0

 

 

 


Reply

Saint_Michael
Well to start off I would check out this tutorial how up to set up a smilie system for your website, and since the posts is only a few months old it "should" work. Now to get the smilies to work besides using php would be images, what I suggestion is google emoticons, then click on images, then click small images and then download away which ones that work best for you.


Now for your second problem I would check out these tutorials and see which one works the most effectively.

http://www.phpfreaks.com/tutorials/73/0.php
http://www.phpfreaks.com/tutorials/73/0.php
http://www.interviewmyass.co.uk/tutorials/php/6

I would start with the second tutorial first as it seems less confusing as the others, and the fact its all on one page.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Recent Queries:-
  1. emoticons/toungue.gif - 64.05 hr back. (1)
Similar Topics

Keywords : parts

  1. Simple Page With Different Parts - (5)



Looking for 2, parts

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for 2, parts

*MORE FROM TRAP17.COM*
advertisement



Help In 2 Parts



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE