Help with PHP

This is a discussion on "Help with PHP" within the PHP Forum section. This forum, and the thread "Help with PHP are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Feb 27th, 2007, 15:11
Junior Member
Join Date: Feb 2007
Location: Baltimore, MD
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Help with PHP

I am a pretty novice programmer, I am a designer so please excuse my stupid mistakes. I am attempting to make a form that put info into a data base that can be called upon at a later time. I think I created the form, and part of the database, but it is not working, here is my code, if anyone can help.

This is the forms code:

<html>
<body>
<form action="http://www.tsunamiproductions.com/tsunami_db.php" method="post">
<strong>Episode Name</strong>:
<input type="text" name="name" />
<strong>Episode Number</strong>:
<input type="text" name="number" />
<p><strong>Segment 1 Run Time</strong>:
<input type="text" name="runtime" /></p>
National Spots Name: <input type="text" name="national_spot_name" />
National Spots Run Time: <input type="text" name="national_spot_run_time" />
<br><br>Local Spots Name: <input type="text" name="local_spot_name" />
Local Spots Run Time: <input type="text" name="local_spot_run_time" /></br></br>

<p><strong>Segment 2 Run Time</strong>:
<input type="text" name="2runtime" /></p>
National Spots Name: <input type="text" name="2national_spot_name" />
National Spots Run Time: <input type="text" name="2national_spot_run_time" />
<br><br>Local Spots Name: <input type="text" name="2local_spot_name" />
Local Spots Run Time: <input type="text" name="2local_spot_run_time" /></br></br>

<p><strong>Segment 3 Run Time</strong>:
<input type="text" name="3runtime" /></p>
National Spots Name: <input type="text" name="3national_spot_name" />
National Spots Run Time: <input type="text" name="3national_spot_run_time" />
<br><br>Local Spots Name: <input type="text" name="3local_spot_name" />
Local Spots Run Time: <input type="text" name="3local_spot_run_time" /></br></br>

<p><strong>Segment 4 Run Time</strong>:
<input type="text" name="4runtime" /></p>
National Spots Name: <input type="text" name="4national_spot_name" />
National Spots Run Time: <input type="text" name="4national_spot_run_time" />
<br><br>Local Spots Name: <input type="text" name="4local_spot_name" />
Local Spots Run Time: <input type="text" name="4local_spot_run_time" /></br></br>

<p><strong>Segment 5 Run Time</strong>:
<input type="text" name="5runtime" /></p>

<p><strong>Total Run Time</strong>:
<input type="text" name="total_runtime" /></p>
<input type="submit" />
</form>
</body>
</html>

and here is the database code for a database called tsunami_db.php

<html>
<head>
<title>Untitled Document</title>
</head>

<body>
<?php
$con = mysql_connect("server","user","PW");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
if (mysql_query("CREATE DATABASE tsunamishows_db",$con))
{
echo "Database created";
}
else
{
echo "Error creating database: " . mysql_error();
}
// Create table in tsunamishows_db database
mysql_select_db("tsunamishows_db", $con);
$sql = "CREATE TABLE GirlsGoneFishin
(
runtime varchar(25),
national_spot_name varchar(25),
Age int
)";
mysql_query($sql,$con);
mysql_close($con);
?>
</body>
</html>

obviously, i covered up the password and user name and all of that for privacy, but can anyone help me figure out what is wrong with this code???

Thank You for your help.

-Scott
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Feb 27th, 2007, 15:31
Elite Veteran
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help with PHP

What's happening? What's not working?! Do you get an error?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Feb 27th, 2007, 15:36
Junior Member
Join Date: Feb 2007
Location: Baltimore, MD
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help with PHP

i don't get anything, I am not sure what is supposed to happen. It just kinda freezes up, which is why I feel like I have something wrong in the code. Like I said I am very beginner with this sort of stuff. What is supposed to happen?? Thanks for your help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Feb 27th, 2007, 15:38
Junior Member
Join Date: Feb 2007
Location: Baltimore, MD
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help with PHP

Could not connect: Lost connection to MySQL server during query

Now it gives me this error after about a minute or two
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Feb 28th, 2007, 13:29
Elite Veteran
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help with PHP

Why are you creating the database and the table every time? You should have it created only once.

BTW ... I trashed the thread you just created in the New to Web Design section ... don't double-post!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Feb 28th, 2007, 13:32
Junior Member
Join Date: Feb 2007
Location: Baltimore, MD
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help with PHP

ok, thats fine. I really don't know what I'm doing, like I said. So is that the problem? that I am creating them twice?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Feb 28th, 2007, 13:51
Elite Veteran
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help with PHP

Maybe... I'm not sure. I don't have access to my server from here so I can't test but you should definately fix that. You should create the DB twice and the table twice. Check if it's created, if not, create, then go do the inserts.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Feb 28th, 2007, 13:52
Junior Member
Join Date: Feb 2007
Location: Baltimore, MD
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help with PHP

ok i iwll give it a try, thanks again for the help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Feb 28th, 2007, 13:53
Elite Veteran
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Help with PHP

No problem ... let us know how it goes.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
help with php

Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 16:02.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42