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.
|
|
|
|
|
![]() |
||
Help with PHP
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
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 |
|
|
|
||||
|
Re: Help with PHP
What's happening? What's not working?! Do you get an error?
|
|
|||
|
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
|
|
|||
|
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 |
|
|||
|
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?
|
|
||||
|
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.
|
|
|||
|
Re: Help with PHP
ok i iwll give it a try, thanks again for the help
|
![]() |
| Tags |
| help with php |
| Thread Tools | |
|
|