Generating SQL for smilies witowt stress

Started on the old forum in August 2009 · view the original in the archive · old links redirect here

10 replies · 841 views · started 17 years ago · 1 min read

6 participants
CreativityKills Lead · 833 posts #1

I was working on d version 3.0 of my script and i had to make sql for about 200 gifs n jpgs bt u didnt really fink i'd do it one by one did u? O.o Okay i used to, anyway wit dis piece of codin u cud generate SQL dependin on ur smilies folder:

<?php
$han = dir("/");
while($fnm = $han->read()){
$file = explode(".",$fnm);
if(strlen($file[0])>2 && count($file)==2){
echo "INSERT INTO `ibwf_smilies` (`id`,`scode`,`imgsrc`,`hidden`)\n";
echo "VALUES (NULL,'-".$file[0]."-', 'smilies/".$fnm."','0');\n";
}
}
?>

ofcuz u can modify it easily. And oh make sure u rename ur files cuz d code for a haha.gif file would be -haha- and d code for a haha_01.gif wud be -haha_01- . To c d sql, view just view d source code of d display. It'l be ther. If u found dis useful, hola atchur boi. 🙂

👍 1
Share
something else Fellow · 2,296 posts #3

you might want to conect to db aswell 🙂 or in most peoples cases: include("../web/config.php"); include("../web/core.php");

CreativityKills Lead · 833 posts #4

nah u dnt need database. It just generates the sql query for files in the smilies folder. You just copy d sql code and paste in phpmyadmin.

something else Fellow · 2,296 posts #5

i didnt read your post properly lol* but u might aswell have it directly insert straight into db 🙂

WhiteWarrior Principal · 1,419 posts #6

this is pobably the most usful piece of coding ive seen on this whole forum since ive been here, simple, easy, something i wouldnt had fort of. lol. 🙂

CreativityKills Lead · 833 posts #7

Thanks. Oh btw, found a "bug". Add this 2 d code

change if( strlen($file[0])>2 && count($file)==2 ){

TO if( strlen($file[0])>2 && count($file)==2 && $file[2]!="php"){

REASON? So it doest pick up ur index.php file as well.

jedskiter Junior · 14 posts #9

what o you mean by run it. how? sorry newbie

metulj Super moderator Principal · 1,726 posts #11

makvanpor2000 wrote: am not getin the sql script oh

can you read ???

It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt. ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ ⓐⓡⓔ ⓐⓑⓛⓔ ⓣⓞ ⓗⓔⓐⓡ ! ιη тнєσяу, тнє ρяα¢тι¢є ιѕ α яєѕυℓт σƒ тнє тнєσяу, вυт ιη ρяα¢тι¢є ιѕ тнє σρρσѕιтє.

キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close