Go to Post Competing at multiple regionals or Championship events has no bearing on the life lessons you will learn or the unbelievable memories you will have--for that is what FIRST is truly all about. - Alivia [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 08-03-2006, 21:12
general's Avatar
general general is offline
That's me!
AKA: Bryan
FRC #0213 (Dirty Birds)
Team Role: Webmaster
 
Join Date: Feb 2006
Rookie Year: 2005
Location: Keene
Posts: 48
general is an unknown quantity at this point
Send a message via AIM to general
php/forms/posting/I NEED HELP!!!!!!!!!

I want to put a comment/quotes page on my teams site, and let people submit their own, but I don't know anything about php or any other database. Can some one help me?
__________________
http://www.khsfirst.com/
  #2   Spotlight this post!  
Unread 09-03-2006, 07:51
chris31 chris31 is offline
Team 2021 Captain
AKA: Chris Davidson
FRC #2021 (FA Robotics)
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 2006
Location: Atlanta, GA/ Fredericksburg,VA
Posts: 949
chris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond repute
Send a message via AIM to chris31
Re: php/forms/posting/I NEED HELP!!!!!!!!!

There are a few options. One is to use a free shoutbox type program. Another is to use php and log all of the comments to a text file. The last option is to use php and save it all to a database. The last will be the hardest to code but could allow for more features to be added. If i have any free tome today i will write you some sample code.
  #3   Spotlight this post!  
Unread 09-03-2006, 11:14
chris31 chris31 is offline
Team 2021 Captain
AKA: Chris Davidson
FRC #2021 (FA Robotics)
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 2006
Location: Atlanta, GA/ Fredericksburg,VA
Posts: 949
chris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond repute
Send a message via AIM to chris31
Re: php/forms/posting/I NEED HELP!!!!!!!!!

CHeck out these links. http://www.project-angel.com/index.p...&cat=PHP&id=13 and http://www.project-angel.com/index.p...&cat=PHP&id=14 . Hopefully that will get you started. If you need any help just ask.
  #4   Spotlight this post!  
Unread 11-03-2006, 23:59
MattD's Avatar
MattD MattD is offline
Registered User
AKA: Matthew Douglas
FRC #0228 (GUS Robotics)
Team Role: Alumni
 
Join Date: Feb 2006
Rookie Year: 2005
Location: Indianapolis, IN
Posts: 185
MattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to behold
Send a message via AIM to MattD
Re: php/forms/posting/I NEED HELP!!!!!!!!!

Quote:
Originally Posted by chris31
There are a few options. One is to use a free shoutbox type program. Another is to use php and log all of the comments to a text file. The last option is to use php and save it all to a database. The last will be the hardest to code but could allow for more features to be added. If i have any free tome today i will write you some sample code.
I actually think that writing it to use a database (MySQL for example) would be easier than using the text file. That's just what I'd do, though. Either that or use XML..
  #5   Spotlight this post!  
Unread 12-03-2006, 16:22
chris31 chris31 is offline
Team 2021 Captain
AKA: Chris Davidson
FRC #2021 (FA Robotics)
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 2006
Location: Atlanta, GA/ Fredericksburg,VA
Posts: 949
chris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond repute
Send a message via AIM to chris31
Re: php/forms/posting/I NEED HELP!!!!!!!!!

Quote:
Originally Posted by MattD
I actually think that writing it to use a database (MySQL for example) would be easier than using the text file. That's just what I'd do, though. Either that or use XML..
With a text file there would be no need for a MySQL database (not sure if he has one). Plus, he wouldnt need to know SQL or and knowledge of XML. WIth XML you have to parse all of it. With a text file he could just log everything as a line of text.
  #6   Spotlight this post!  
Unread 12-03-2006, 17:32
general's Avatar
general general is offline
That's me!
AKA: Bryan
FRC #0213 (Dirty Birds)
Team Role: Webmaster
 
Join Date: Feb 2006
Rookie Year: 2005
Location: Keene
Posts: 48
general is an unknown quantity at this point
Send a message via AIM to general
Re: php/forms/posting/I NEED HELP!!!!!!!!!

Could some one give me the code for the text file option.
__________________
http://www.khsfirst.com/
  #7   Spotlight this post!  
Unread 12-03-2006, 18:49
chris31 chris31 is offline
Team 2021 Captain
AKA: Chris Davidson
FRC #2021 (FA Robotics)
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 2006
Location: Atlanta, GA/ Fredericksburg,VA
Posts: 949
chris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond repute
Send a message via AIM to chris31
Re: php/forms/posting/I NEED HELP!!!!!!!!!

Just to confirm what you want, you want a box that holds the posts of the shoutbox, under that you want a spot for people to input a nickname and message. Will that work for you? Also, do you know what version of php your webserver is running?
  #8   Spotlight this post!  
Unread 14-03-2006, 14:43
general's Avatar
general general is offline
That's me!
AKA: Bryan
FRC #0213 (Dirty Birds)
Team Role: Webmaster
 
Join Date: Feb 2006
Rookie Year: 2005
Location: Keene
Posts: 48
general is an unknown quantity at this point
Send a message via AIM to general
Re: php/forms/posting/I NEED HELP!!!!!!!!!

Here is the server info:

__________________
http://www.khsfirst.com/

Last edited by general : 14-03-2006 at 14:46.
  #9   Spotlight this post!  
Unread 14-03-2006, 15:02
general's Avatar
general general is offline
That's me!
AKA: Bryan
FRC #0213 (Dirty Birds)
Team Role: Webmaster
 
Join Date: Feb 2006
Rookie Year: 2005
Location: Keene
Posts: 48
general is an unknown quantity at this point
Send a message via AIM to general
Re: php/forms/posting/I NEED HELP!!!!!!!!!

And I would want it to look like this
http://www.khsfirst.com/insert.html for the submiting page, and http://www.khsfirst.com/Quotes.html for the pageit would show up on.
__________________
http://www.khsfirst.com/
  #10   Spotlight this post!  
Unread 14-03-2006, 15:45
Uberbots's Avatar
Uberbots Uberbots is offline
Mad Programmer
AKA: Billy Sisson
FRC #1124 (ÜberBots)
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Avon
Posts: 739
Uberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond repute
Re: php/forms/posting/I NEED HELP!!!!!!!!!

ya know, it would be a ton easier to just use a database.
if you have PHPmyAdmin, then use it.

PHP Code:
mysqlServer mysql_pconnect("server","username","password"//server is typically "127.0.0.1"
mysql_select_db("siteData"mysqlServer);

$getNews mysql_query("SELECT * FROM `news` ORDER BY `id` DESC");
$rowGetNews mysql_fetch_assoc($getNews);
$numRowsGetNews mysql_num_rows($getNews);

do {
echo 
$rowGetNews['body'];
} while(
$rowGetNews mysql_fetch_assoc($getNews)); 
im assuming that you have a database, schema name "siteData", with a table called "news".
columns should be AT LEAST:
id INTEGER AUTO_INCREMENT, title VARCHAR(35), body TEXT


adding news to the DB is a different story.
__________________
A few of my favorite numbers:
175 176 177 195 230 558 716 1024 1071 1592 1784 1816
RPI 2012
BREAKAWAY
  #11   Spotlight this post!  
Unread 14-03-2006, 17:54
general's Avatar
general general is offline
That's me!
AKA: Bryan
FRC #0213 (Dirty Birds)
Team Role: Webmaster
 
Join Date: Feb 2006
Rookie Year: 2005
Location: Keene
Posts: 48
general is an unknown quantity at this point
Send a message via AIM to general
Re: php/forms/posting/I NEED HELP!!!!!!!!!

Ya what is PHPmyAdmin? And how do I Use it?
__________________
http://www.khsfirst.com/
  #12   Spotlight this post!  
Unread 15-03-2006, 08:01
chris31 chris31 is offline
Team 2021 Captain
AKA: Chris Davidson
FRC #2021 (FA Robotics)
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 2006
Location: Atlanta, GA/ Fredericksburg,VA
Posts: 949
chris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond repute
Send a message via AIM to chris31
Re: php/forms/posting/I NEED HELP!!!!!!!!!

Quote:
Originally Posted by general
Ya what is PHPmyAdmin? And how do I Use it?
phpMyAdmin is a php based MySQL admin tool. If you have CPanel then it is included, else you have to set it up.

The databases can be created without phpMyAdmin. I can write up some code for inputing data and createing the tables if you want me to. Also, can you find out if your webserver supports PHP and if so what version. If you cant find it, please post a link to the people who provide your hosting.

EDIT: I wrote this up quickly so its not that great but it will work.


PHP Code:
Database Layout

Database --> "siteData"
Table --> "news"
columns --> id INTEGER AUTO_INCREMENT, title VARCHAR(35), body TEXT


=================================

// Code for printing out all of the news

// Connecting, selecting database
$link = mysql_connect ("server","username","password") or die ('I cannot connect to the database because: ' . mysql_error());//Open up the specific database
mysql_select_db ("siteData");


$query = ""SELECT * FROM `news` ORDER BY `id` DESC"";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());


echo "<table>\n";
echo "\t<tr>\n";
echo "\t\t<td>Name</td>\n";
echo "\t\t<td>Post</td>\n";
echo "\t</tr>\n";


while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) 
{
   echo "\t<tr>\n";
   foreach ($line as $col_value) 
   {
       echo "\t\t<td>$col_value</td>\n";
   }
   echo "\t</tr>\n";
}
echo "</table>\n";


=================================

// Code for adding news to the db

Add Post

<FORM ACTION="<?=$PHP_SELF?>" METHOD="POST" NAME="newsentry" type="text">

Name:

<BR>

<INPUT TYPE="text" SIZE="50" NAME="name" type="text">

<BR>

Post:

<BR>

<INPUT TYPE="text" SIZE="50" NAME="post" type="text">

<BR>


<INPUT TYPE="submit" NAME="submit" VALUE="Submit">
<BR>


</FORM>

<?

if($HTTP_POST_VARS['submit'])
{

        if(!
$HTTP_POST_VARS['name'])
        {
            echo 
"You must enter a name";
            exit;
        }
        if(!
$HTTP_POST_VARS['post'])
        {
            echo 
"You must enter a post";
            exit;
        }


    
$query "INSERT INTO news VALUES ('', '$HTTP_POST_VARS['name']', '$HTTP_POST_VARS['post']')";
     
$result mysql_query($query);
}

?>

Last edited by chris31 : 15-03-2006 at 09:53.
  #13   Spotlight this post!  
Unread 29-03-2006, 14:36
general's Avatar
general general is offline
That's me!
AKA: Bryan
FRC #0213 (Dirty Birds)
Team Role: Webmaster
 
Join Date: Feb 2006
Rookie Year: 2005
Location: Keene
Posts: 48
general is an unknown quantity at this point
Send a message via AIM to general
Re: php/forms/posting/I NEED HELP!!!!!!!!!

ok so it works great, but now theres like 25 quotes. I want to make a second page so you dont have to scroll forever to get to the bottom. Do i have to make a new database or can i use the same one?
__________________
http://www.khsfirst.com/
Closed Thread


Thread Tools
Display Modes 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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 03:13.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi