DeveloperCube - Drawing A Blank - PHP Question
Discuss internet community strategy at CommunityAdmins.com
Username:    Password:
Remember Me?    
Drawing A Blank - PHP Question

 
Post new topic   Reply to topic    DeveloperCube Forum Index -> Scripts and Programming
 See a User Guidelines violation? Please contact us.
Author Message

Triumvirate

Joined: 24 Feb 2004
Posts: 169
Location: NY, USA

PostPosted: 7/12/2004, 1:30 am    Post subject: Drawing A Blank - PHP Question Reply with quote

Okay, I know that I can do this, and I know that I know how to do this, but I can't, for the life of me, get this to work (and I'm getting rather frustrated and feeling rather stupid.)

I've done this before, but for some reason I seem to be drawing a blank today.

Anyway, the problem is I have a page that is supposed to take a set of values and insert them into the database. I set up the database table so it looks like this:

Code:
id
name
age
race
class
bio


Then, I have the php file (located here in .txt form) which is supposed to take the form values and insert them into the database. The template file can be seen here. The problem is it is not inserting the values into the database.

I know that I'm going to kick myself when I get a response. But thanks in advance for the help. I've tried everything from post, to get, to simply assigning them as variables but nothing I do is working.

Thanks.
_________________
GamingMMO.com
Back to top

chrispian

Joined: 25 Jan 2004
Posts: 22
Location: Huntsville, AL USA

PostPosted: 7/12/2004, 5:39 pm    Post subject: Reply with quote

You define your query in your $sql variable, but you never execute it. I bet that's your problem. You need to add after that line:

Code:

$result = mysql_query($sql);
Back to top

Triumvirate

Joined: 24 Feb 2004
Posts: 169
Location: NY, USA

PostPosted: 7/12/2004, 8:19 pm    Post subject: Reply with quote

Thanks, I've updated the create.txt file. What you mentioned was certainly a problem (-kicks self-) but it still is not inserting into the database. This is most likely because I've been messing with the code for so long now I've created even more problems.

Thanks for the help.
_________________
GamingMMO.com
Back to top

A_Jelly_Doughnut

Joined: 25 Jun 2004
Posts: 13

PostPosted: 7/17/2004, 3:00 am    Post subject: Reply with quote

Couple things I notice immediately:
1) INSERT INTO (columns) VALUES (values) is the syntax I always use for SQL. Why? If you add another column to the database, that query you use might just not work

2) You don't do
Code:
if(!mysql_query($sql))
{
die(mysql_error());
}
to get any errors MySQL outputs

3) The sql query will be run on every page load because you use no logic Wink
_________________
CMSformE
Back to top
Display posts from previous:   
Post new topic   Reply to topic    DeveloperCube Forum Index -> Scripts and Programming All times are GMT
Page 1 of 1
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Links: Programming Forum - Art Schools Online

Network: iFroggy Network Blog - iFroggy Hosting - SportsForums.net - KarateForums.com - YanksBlog.com - phpBBHacks.com - PhotoshopForums.com - Managing Online Forums - ManagingCommunities.com - CommunityAdmins.com - DrGregHouse.com - Bad Boy Blog - SodaRatings.com - Patrick O'Keefe

We Support phpBBHacks.com. Forum Icons by Daz. Privacy Policy. Powered by phpBB © phpBB Group. phpBB SEO.
Copyright © 2003-2009. DeveloperCube, iFroggy Network. All Rights Reserved.

Advertising   Contact   Links   Link To Us   Staff   User Guidelines