• Forum
  • Doc
  • Screenshots
  • Download
  • Donate
  • Contributors
  • Contact
  • Follow @phpfreechat
  • DEMO
  • Board index ‹ Version 1.x branch ‹ General Support (v1.x)
  • Change font size
  • FAQ
  • Register
  • Login

insert an array from a database

Moderators: OldWolf, re*s.t.a.r.s.*2

Post a reply
3 posts • Page 1 of 1

Postby truetorak » Sun Jan 21, 2007 9:38 pm

I'm trying to insert an array from a database so I can use a database to store badwords.
Currently it is done this way
$params["proxies_cfg"]["censor"]["words"] = array('badword1',badword2');
And this is what I have so far.
$result = $db->sql_query("SELECT word FROM badwords");
$content = array();
while (list($word) = $db->sql_fetchrow($result)) {
$content = "'".$word."',";
}
$badword = array($content);
$params["proxies_cfg"]["censor"]["words"] = $badword;

How would this be done? Or should I do it differently?
I would also like to do this with the smilies as well too.. :)
truetorak
New member
 
Posts: 1
Joined: Sun Jan 21, 2007 9:27 pm
Top

Postby mikez » Mon Jan 22, 2007 10:15 pm

Unless you plan on making frequent updates to your smilies and badword entries, I would recommend hardcoding your data as-is rather than store in a database. You will suffer a performance hit if you use a database.
mikez
Member
 
Posts: 29
Joined: Wed Dec 13, 2006 1:24 am
Top

Postby phpfreechat » Mon Jan 22, 2007 10:18 pm

another solution to improve performances, is to keep the data that you query from the database in session cache.
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top


Post a reply
3 posts • Page 1 of 1

Return to General Support (v1.x)

Who is online

Users browsing this forum: No registered users and 13 guests

  • Board index
  • The team • Delete all board cookies • All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
cron
Sign in
Wrong credentials
Sign up I forgot my password
.
jeu-gratuit.net | more partners
Fork me on GitHub