Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Have a form and an SQL database, but dont know how to get them to link Reply To: Have a form and an SQL database, but dont know how to get them to link

#250985
dannodzines
Participant

This may be a dumb question, but when I connect in php in a specific section, do I have to close it before moving on to the next set? This is what I have right now and I want to make sure all the work I have done is on the right track. You all have been great so far. The references were spot on and also were very helpful. I only want the information of a form to go to mysql so that is the plan… here are the codes so far.

<?php
$link=mysqli_connect (“104.168.177.4”, “rdhczoav_bowlers”, “bowlers”, “rdhczoav_bowlersagainstdepression”);
if($link===false){
die(“ERROR: Could not connect.”.mysqli_connect_error());}
$sql= “CREATE TABLE bowlers (bowler_id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, firstName VARCHAR (30) NOT NULL, lastName VARCHAR (30) NOT NULL, emailAddress VARCHAR (100), PhoneNumber VARCHAR (15) NOT NULL, Bowler VARCHAR (7) NOT NULL, Games VARCHAR (10) NOT NULL, Amount VARCHAR (5) NOT NULL, Per VARCHAR (10) NOT NULL”;
if (mysqli_queary ($link, $sqli)){
echo “Table bowlers created successfully”;}
else{
echo “Error: Could not able to execute $sqli.” . myysqli_error($link);
}
<form action=”insert.php” method=”post”>

<label for=”firstName”>First Name:</label>
<input type=”text” name=”firstname” id=”firstName”>

<label for=”lastName”>Last Name</label>
<input type=”text” name=”lastname” id=”lastName”>

<label for=”emailAddress”>Email Address:</label>
<input type=”text” name=”email” id=”emailAddress”>

<label for=”phoneNumber”>Phone Number:</label>
<input type=”text” name=”phone” id=”PhoneNumber”>

<input type=”text” name=”Sponsors Phone” style=”height: 35px; width: 500px; font-family: ‘times new roman’; font-size: 18px;”

<label for=”bowler”>Chris or David</label>
<input type=”text” name=”bowler” id=”Bowler”>

<label for=”games”>Game 1, 2, 3, or total (select as many as you want)</input>
<input type=”text” name=”games” id=”Games”>

<label for=”amount”>Amount in cents</label>
<input type=”text” name=”amount” id=”Amount”

<label for=”per”>Strike, mark, or Pins</label>
<input type=”text” name=”per” id=”Per”

<input type=”submit” value=”send” style=”height: 50px; width: 150px; font-size: 18px;”>
<input type=”reset” value=”reset” style=”height: 50px; width: 150px; font-size: 18px;”>
</form>
<h3 align=”center”>Website donated by DannoDzines. For more information on DannoDzine please email [email protected] or visit Dannodzines.</h3>
</main>
<?php
$link=mysqli_connect (“104.168.177.4”, “rdhczoav_bowlers”, “bowlers”, “rdhczoav_bowlersagainstdepression”);
if($link===false){
die(“ERROR: Could not connect.”.mysqli_connect_error());}
mysqli_close($link);
?>