» »

Seškoti...PHP ali MySql

Seškoti...PHP ali MySql

rkasteli ::

Glih kar sm se spravu pisat skripto ki bo spremijala tekst v smeškote in se ne moram odločt oziroma ne vem kaj je bolš.Ena varjanta je da skripto napišem v php-ju tko kukr je že cela aplikacija do zdej druga pa da vstavim še eno tabelo v mysql bazo ki bo to delala.Se je kdo že kej igral s čem podobnim?
rkasteli

Kami ::

Kak misliš z mysql bazo?

Saj druge izbire kot php (str_replace oz kaka podobna funkcija) niti nimaš :)

drugače pa naprimer:

$besedilo = str_replace(":)", "<img src=\"slika/smajli.gif\" />", $besedilo);

Zgodovina sprememb…

  • spremenil: Kami ()

Gorky ::

V obeh primerih boš potreboval PHP. Bi pa jaz absolutno uporabil bazo za storniranje smeškov.

lp
Jutri pa je že nov dan.

rkasteli ::

Na netu sm najdu en primer baze in php-ja....se ti zdi vredu?

< ? php
/*
This script has been written for mysql but the code shouldnt be too different to this. The table required is a table called: smilies below the sql query to create such a table.

CREATE TABLE smilies (
id INT( 10 ) NOT NULL AUTO_INCREMENT ,
smilie VARCHAR( 10 ) NOT NULL ,
image VARCHAR( 30 ) NOT NULL ,
PRIMARY KEY ( id )
);

example usage:
After pulling information from the database call the function smilies eg:
smilies($row['somedate']); would replace all instances of the smilies from the database with the appropriate html/image.

*/
function smilies($text){
$path="image"; //Specify the direcory in which images are stored
$sql = "SELECT smilie, image FROM smilies"; //Select the smilies from the database
//along with the names of the image files to
//replace them
$rs = mysql_query($sql); //Run the query
while($row = mysql_fetch_array($rs)) { //Loop through the results creating two arrays
$smilies[] = $row['smilie']; //Create array of smilie texts
$images[] = " < img s r c='" . $p a t h . "/" . $r ow ['i m a g e'] . "'>"; //create array of image replacments with the html in it.
}
$text=str_replace($smilies, $images, $text);//Replace the smilies with the images.
}
?>
rkasteli

trnvpeti ::

sej se lahko tudi naredi z mysql bazo

pac napises namesto
select neko polje from

select replace(neko_polje,':)','html tag img....') from

rkasteli ::

Vem da se lahko naredi z PHP-jem in MySQL bazo...Gorky dej poglej zgornjo kodo ki sem jo prejle postal če se ti zdi vredu,k se mi ne da preveč komlicirat tko da bi sam to not vrgu k je že napisana.
rkasteli


Vredno ogleda ...

TemaSporočilaOglediZadnje sporočilo
TemaSporočilaOglediZadnje sporočilo
»

[PHP]Zamenjava šumnikov z html kodami

Oddelek: Programiranje
153907 (2185) mikesr
»

Spletna videoteka

Oddelek: Programiranje
243733 (2923) nuclear
»

php skripta za registracijo uporabnikov

Oddelek: Izdelava spletišč
162000 (1581) skorpio
»

MySQL in czs

Oddelek: Izdelava spletišč
423499 (2589) krho
»

SQL problem

Oddelek: Programiranje
91453 (1290) Bossek

Več podobnih tem