Beginner Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOtherBeginner Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 14th, 2003, 09:31 PM
sbilheimer sbilheimer is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 24 sbilheimer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I'm totally lost!

I know this can't be rocket science, but I'm lost. I created a MySQL database table in Godaddy, and a form in my HTML. But I can't figure out how to make the PHP file work! At least I'm not getting an error, but no records are going into the database.

Here is my form in my website:

<form action="email.php" method="post" enctype="multipart/form-data">
<table cellpadding="0" cellspacing="0" border="0" bgcolor="#999999"><tr><td>
<table cellpadding="10" cellspacing="1"><tr bgcolor="#F2F4FA">
<td bgcolor="#FFFFFF">
<font face="Verdana,Arial,Helvetica"><b>Your first name:</b></font><br />
<input type="text" name="first name" size="20" /><br />
<font face="Verdana,Arial,Helvetica"><b><br>
Your email</b></font><br />
<input type="text" name="email" size="20"><br />
<br /><div align="center">
<input type="submit" name="submit" value=" Send ">
<input type="reset" name="reset" value=" Clear ">
</div></td></tr></table></td></tr></table>
</form></div>


Here is the sample code for the PHP (without my specific info), and I really think this should be SIMPLE!!!!

(of course, I put in the right values, but it still didn't make it into the database--no error--but no record)

<?php
//Sample Database Connection Syntax for PHP and MySQL.

//Connect To Database

$hostname="mysql.secureserver.net";
$username="MYUSERNAME";
$password="MYPASSWORD";
$dbname="NAMEOFGODADDYDATABASE";
$usertable="NAMEOFTABLE";
$yourfield = "NUMBEROFFIELDS";

mysql_connect($hostname,$username, $password) OR DIE ("<html><script language='JavaScript'<alert('Unable to connect to database! Please try again later.'),history.go(-1)</script></html>");
mysql_select_db($dbname);

# Check If Record Exists

$query = "SELECT * FROM $usertable";

$result = mysql_query($query);

if($result)
{
while($row = mysql_fetch_array($result))
{
$name = $row["$yourfield"];
echo "Name: ".$name."<br>";
}
}
?>

PLEASE help. Thanks, Susan (susan@perimenopausesupport.com)

Reply With Quote
  #2  
Old August 15th, 2003, 08:27 AM
karsh44's Avatar
karsh44 karsh44 is offline
Just another guy
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jun 2003
Location: Wisconsin
Posts: 2,915 karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 13 h 13 m 21 sec
Reputation Power: 76
First, use a more descriptive title for your posts. Many people simply ignore posts with titles like "HELP" or "N00b question" or "I'm lost". Just a tip. You also might want to post future php questions in the PHP forum.

Ok, now as to your problem. PHP is not really my language, but from looking at your code, you don't have anything that inserts data into your database. As I see it, your current php checks username and password against a database (where the username and password are coming from, I don't know). But to insert data into the database, you'll need another query, along the lines of
Code:
INSERT INTO tablename VALUES value1, value2...
which you would execute with mysql_query.

Try making an INSERT statement with the data (probably form field names?) that you want to insert. If it still doesn't work, post a question in the PHP forum (with a descriptive title!), and some of our resident PHP gurus will help you out. I know at least one guy specializes in PHP and mySQL, so they can help you fine tune your code.
Good Luck!
Dave
__________________
--Dave--

U2kgSG9jIExlZ2VyZSBTY2lzLCBOaW1pdW0gRXJ1ZGl0aW9uaXMgSGFiZXM=

Last edited by karsh44 : August 15th, 2003 at 08:40 AM.

Reply With Quote
  #3  
Old August 15th, 2003, 08:32 AM
sbilheimer sbilheimer is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 24 sbilheimer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Oh, I thought this WAS the PHP forum. Ahhh well. I will look at the code you sent, and appreciate your suggestions. Susasn

Reply With Quote
Reply

Viewing: Dev Shed ForumsOtherBeginner Programming > I'm totally lost!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT