Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-01-2010, 02:28 AM   PM User | #16
DJCMBear
Senior Coder

 
DJCMBear's Avatar
 
Join Date: Mar 2010
Location: United Kindom
Posts: 1,173
Thanks: 14
Thanked 136 Times in 136 Posts
DJCMBear is on a distinguished road
For putting the text into the database just use a mysql insert code with validation for sql injection etc.

The code I posted with the sql query will do the id call after the "?id=" which $_GET['id'] will get that number so that should work.
__________________
Official BinPress hand picked coder.
For anyone worried about SQL injection go have a look at my small yet powerful script here.
Go Pledge for Light Table, if it hit's $300,000 Python and other languages will get added.
I am 1 of 65,608 people to get a Pebble Watch :P
DJCMBear is offline   Reply With Quote
Old 06-02-2010, 01:46 AM   PM User | #17
mlseim
Master Coder

 
mlseim's Avatar
 
Join Date: Jun 2003
Location: Cottage Grove, Minnesota
Posts: 9,045
Thanks: 8
Thanked 1,029 Times in 1,020 Posts
mlseim has a spectacular aura aboutmlseim has a spectacular aura aboutmlseim has a spectacular aura about
Since you do not even have the MySQL database yet ...

You need to go into your webhost and create a MySQL database.
Give it a username, password, and database name and enter those
into the script below. Follow your webhost configuration on the
name of the MySQL host.

This script creates the table you'll need.
Upload to your webhost and run it after you enter-in the account data:
PHP Code:
<?php
// Create the table and columns

// You should have already created the MySQL account
// with a database named "MyText".

// The name of your database goes here.
$dbname 'MyText';

// Enter in your host, username and password here.
$link mysql_connect("host","username","password") or die("Couldn't make connection.");

// Select the database
$db mysql_select_db($dbname$link) or die("Couldn't select database");

// This creates the table called "LinesOfText".
// The actual line of text (max of 255 characters),
// A timestamp ... you might want to use that later on,
// The submitters IP ... in case you want to use that,
// and an enable, if you later decide to "hide" or "enable" lines.

mysql_query("CREATE TABLE LinesOfText 
(
TextID int NOT NULL AUTO_INCREMENT, 
PRIMARY KEY(TextID),
TextLine varchar(255),
TimeStamp varchar(12),
UserIP varchar(20),
TextEnable varchar(3)
)"
) or die(mysql_error());  ;

echo 
"table created";

?>

Last edited by mlseim; 06-02-2010 at 01:49 AM..
mlseim is offline   Reply With Quote
Old 06-02-2010, 04:52 AM   PM User | #18
jeree
New Coder

 
Join Date: Jun 2010
Posts: 37
Thanks: 2
Thanked 0 Times in 0 Posts
jeree is an unknown quantity at this point
hi, im looking for this exact thing also!!
how do i create a website from scratch? i have the sql database ready and the domain, all i have to do is install files into the thing to make it work... where do i start?
i am doing EXACTLY as what the OP was looking for, how do i start out!?
thanks!! (:
jeree is offline   Reply With Quote
Old 06-02-2010, 05:43 AM   PM User | #19
jeree
New Coder

 
Join Date: Jun 2010
Posts: 37
Thanks: 2
Thanked 0 Times in 0 Posts
jeree is an unknown quantity at this point
Sorry for double posting as i dont know where to start,
can someone give me a STEP BY STEP how to install this whole script to make it work on my website?

thanks!!
URGNT also! (:
jeree is offline   Reply With Quote
Old 06-02-2010, 11:00 AM   PM User | #20
DJCMBear
Senior Coder

 
DJCMBear's Avatar
 
Join Date: Mar 2010
Location: United Kindom
Posts: 1,173
Thanks: 14
Thanked 136 Times in 136 Posts
DJCMBear is on a distinguished road
Quote:
Originally Posted by jeree View Post
Sorry for double posting as i dont know where to start,
can someone give me a STEP BY STEP how to install this whole script to make it work on my website?

thanks!!
URGNT also! (:
I have just created the full system for JonathanFenny if you want it also PM me an email to post the zip file to.
__________________
Official BinPress hand picked coder.
For anyone worried about SQL injection go have a look at my small yet powerful script here.
Go Pledge for Light Table, if it hit's $300,000 Python and other languages will get added.
I am 1 of 65,608 people to get a Pebble Watch :P
DJCMBear is offline   Reply With Quote
Reply

Bookmarks

Tags
?id=, box, php, simple, text

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:39 PM.


Advertisement
Log in to turn off these ads.