cancel
Showing results for 
Search instead for 
Did you mean: 
New

Help connecting to phpmyadmin through html form

Hello, I have sql tables in phpmyadmin and have created a html form. The output of the form when user clicks Submit will display the desired tables that are in phpmyadmin. I am using the following code to connect with the names below filled out:

If(mysqli_connect_errno($dbconnect) ) { echo "failed to connect"; } else {echo "connection successful"Smiley Wink But it is not working. I appreciate help in getting the code so that I can connect my html to the phpmyadmin tables and output the table in the html form when user clicks Submit. thanks in advance.

3 REPLIES 3
Community Manager
Community Manager

Re: Help connecting to phpmyadmin through html form

Hi @IDC. To clarify, you should be connecting your form to your MySQL database using a connection string and a server-side script (like PHP). You wouldn't have the ability to connect the form directly to phpMyAdmin directly. If that's already what you're doing, then you may want to share your website and code here. That may help others offer additional suggestions. 

 

JesseW - GoDaddy | Community Manager | 24/7 support available at x.co/247support | Remember to choose a solution and give kudos.
New

Re: Help connecting to phpmyadmin through html form

Hello,

 

I am pasting the code below. I have removed some things for privacy, such as log into server and replaced with their description instead. I have two connection codes. Are either of them correct? When I sign into phpmyadmin, it gives the Server Version, and under that are Server and User. I copy what is next to Server and User into the connection code when it requires.

 

First connection code:

<!--?php //Step1 $db = mysqli_connect('server IP via TCP/IP','user@userIP','password','databaseID') or die('Error connecting to MySQL server.'); ?-->

 

Second connection code:
// =======================================================================
// Connect to database
// statement below connects to your server you need to change it for your environment
// this is same as the workbench connect
// FALSE means there was an error
// =======================================================================

try {
$IDCDB = new PDO("server IP via TCP/IP','user@userIP','password','databaseID");
} catch (PDOException $e) {
echo "<span style="color: red; font-weight: bold;">ERROR Connecting to MySql server!</span>
";
return(-1); // returns to wordpress
}

Community Manager
Community Manager

Re: Help connecting to phpmyadmin through html form

@IDC - I'm not sure if that would work or not. I'm not proficient in writing PHP scripts. It doesn't look like the example code in the Help Center article I linked to though. Maybe give that a try. Others in the community might be able to comment though. 

 

JesseW - GoDaddy | Community Manager | 24/7 support available at x.co/247support | Remember to choose a solution and give kudos.