Storing Data in DB

PHP coding talk.

Moderator: Moderators

Storing Data in DB

Postby =cipher= on Sat May 14, 2005 7:43 pm

Hello,

I would like to know how would I create a script so that I can enter information in the ACP and then store into my DB and output it on another. Can someone help me with this?
Best Regards:
Aaron McGowan / =cipher=

Status: Programming / Coding
Head Programmer for The Tech Base
Junior Programmer for Triplentry

www.thetechbase.com
User avatar
=cipher=
banned
banned
 
Posts: 189
Joined: Sat May 07, 2005 4:03 pm
Location: A Network Near You

Postby Thatbitextra on Sat May 14, 2005 7:51 pm

User avatar
Thatbitextra
Moderator
Moderator
 
Posts: 1821
Joined: Thu Mar 24, 2005 1:11 pm
Location: A place where something is or could be located; a site.

Postby =cipher= on Sat May 14, 2005 8:33 pm

Ya I looked. Those KB Articles didnt help me really. Doesnt say anything that I am wanting. I want to be able go to the ACP, input information like a description or something on the Configuration Page then output it on another page that the public can see. Can someone tell me how I can do this or where I can find the information to do this please and thanks! :D
Best Regards:
Aaron McGowan / =cipher=

Status: Programming / Coding
Head Programmer for The Tech Base
Junior Programmer for Triplentry

www.thetechbase.com
User avatar
=cipher=
banned
banned
 
Posts: 189
Joined: Sat May 07, 2005 4:03 pm
Location: A Network Near You

Postby Thatbitextra on Sat May 14, 2005 8:36 pm

Read what pentapenguin wrote. All the information you need is in that post.
User avatar
Thatbitextra
Moderator
Moderator
 
Posts: 1821
Joined: Thu Mar 24, 2005 1:11 pm
Location: A place where something is or could be located; a site.

Postby pentapenguin on Sat May 14, 2005 9:42 pm

Look at my Adjust Gzip Compression Level MOD.
It does exactly what you want so just tweak it. ;)
User avatar
pentapenguin
Moderator
Moderator
 
Posts: 1466
Joined: Tue Sep 14, 2004 4:15 pm
Location: Georgia, USA

Postby =cipher= on Sat May 14, 2005 10:15 pm

Hey,

Thanks! :D :D :D This is most appreciated.
Best Regards:
Aaron McGowan / =cipher=

Status: Programming / Coding
Head Programmer for The Tech Base
Junior Programmer for Triplentry

www.thetechbase.com
User avatar
=cipher=
banned
banned
 
Posts: 189
Joined: Sat May 07, 2005 4:03 pm
Location: A Network Near You

Postby =cipher= on Sat May 14, 2005 10:17 pm

I got one question though... in your MOD you have:
INSERT INTO phpbb_config (config_name, config_value) VALUES ('gzip_level', '9');


Well ... In mine, I wnat to have the "9" part to be a large paragraph of words and etc that html can be used in also so that that information entered is outputted on another page. How do I do that?
Best Regards:
Aaron McGowan / =cipher=

Status: Programming / Coding
Head Programmer for The Tech Base
Junior Programmer for Triplentry

www.thetechbase.com
User avatar
=cipher=
banned
banned
 
Posts: 189
Joined: Sat May 07, 2005 4:03 pm
Location: A Network Near You

Postby pentapenguin on Sat May 14, 2005 11:14 pm

Just replace the 9 with your HTML.
Make sure you add a backslash before any single quotes like \'
User avatar
pentapenguin
Moderator
Moderator
 
Posts: 1466
Joined: Tue Sep 14, 2004 4:15 pm
Location: Georgia, USA

Postby =cipher= on Sun May 15, 2005 2:17 am

Hey,

Thanks! :D But, how do I change that "HTML" or "9" with in the database?
Best Regards:
Aaron McGowan / =cipher=

Status: Programming / Coding
Head Programmer for The Tech Base
Junior Programmer for Triplentry

www.thetechbase.com
User avatar
=cipher=
banned
banned
 
Posts: 189
Joined: Sat May 07, 2005 4:03 pm
Location: A Network Near You

Postby =cipher= on Sun May 15, 2005 2:44 am

Hey,

I have another question, how am I suppose to recode this:
$new['gzip_level'] = preg_replace("#[^0-9]#", '9', $new['gzip_level']);
... What should mine be?
Best Regards:
Aaron McGowan / =cipher=

Status: Programming / Coding
Head Programmer for The Tech Base
Junior Programmer for Triplentry

www.thetechbase.com
User avatar
=cipher=
banned
banned
 
Posts: 189
Joined: Sat May 07, 2005 4:03 pm
Location: A Network Near You

Postby UseLess on Sun May 15, 2005 6:04 am

Greetings,

A couple of things...

1. You can only store a maximum of 255 chars in the config table
2. You should use 'prepare_message' so it will be stored in the db correctly and 'unprepare_message' when you want to display it again.

So you should really create another table and then use a field type of 'text' if you want to store more than 255 characters.
Movie Quote:
It's not the years honey, it's the mileage...

I do not provide any install services for phpBB, Mods or Styles.
Please do not pm me for support/scripting help - you won't get any reply. If you have a question then make a post in the appropriate forum.
User avatar
UseLess
Registered User
Registered User
 
Posts: 6220
Joined: Mon Sep 27, 2004 2:14 am
Location: North East, UK

Postby =cipher= on Sun May 15, 2005 1:25 pm

Hey,

Yes I want to store more then 255 characters. :D Thanks! :D but ... what about this thing? $new['gzip_level'] = preg_replace("#[^0-9]#", '9', $new['gzip_level']);??
Best Regards:
Aaron McGowan / =cipher=

Status: Programming / Coding
Head Programmer for The Tech Base
Junior Programmer for Triplentry

www.thetechbase.com
User avatar
=cipher=
banned
banned
 
Posts: 189
Joined: Sat May 07, 2005 4:03 pm
Location: A Network Near You

Postby UseLess on Sun May 15, 2005 1:35 pm

Greetings,

As you have stated that you want to store more than 255 characters then you won't be using the config table and you can therefore ignore that as you won't be using the $new array. Your going to have to create the sql queries in order to store the data in the table you create.
Movie Quote:
It's not the years honey, it's the mileage...

I do not provide any install services for phpBB, Mods or Styles.
Please do not pm me for support/scripting help - you won't get any reply. If you have a question then make a post in the appropriate forum.
User avatar
UseLess
Registered User
Registered User
 
Posts: 6220
Joined: Mon Sep 27, 2004 2:14 am
Location: North East, UK

Postby =cipher= on Sun May 15, 2005 1:46 pm

Hey,

Would this be the proper SQL Syntax to use to create a table with longtext ??

CREATE TABLE phpbb_exbb_portal (welcome message LONGTEXT NOT NULL);
Best Regards:
Aaron McGowan / =cipher=

Status: Programming / Coding
Head Programmer for The Tech Base
Junior Programmer for Triplentry

www.thetechbase.com
User avatar
=cipher=
banned
banned
 
Posts: 189
Joined: Sat May 07, 2005 4:03 pm
Location: A Network Near You

Postby UseLess on Sun May 15, 2005 3:58 pm

Greetings,

Well have you tried it and did it work?

Or did you get a complaint about: welcome message not being in quotes and a space in the middle?

This is what you should have;

Code: Select all
CREATE TABLE `phpbb_exbb_portal` (
     `welcome_message` longtext NOT NULL
   );
Movie Quote:
It's not the years honey, it's the mileage...

I do not provide any install services for phpBB, Mods or Styles.
Please do not pm me for support/scripting help - you won't get any reply. If you have a question then make a post in the appropriate forum.
User avatar
UseLess
Registered User
Registered User
 
Posts: 6220
Joined: Mon Sep 27, 2004 2:14 am
Location: North East, UK

Next

Return to PHP Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron