Hello.

I am beginning to re-develop a small database using PHP/MyQL; I have already sucessfully done this a year ago but no longer have access to the machine, code or credentials. It worked great! But now, I'm rebuilding it.

The test site (PHP) seems to be fine. I see no problems with the MySQL on the server.

The problem seems to be the connection between the two systems.

Honestly, I always have trouble with the smaller things such as this problem.

I am submitting data via the site, but the tables are still empty.

I'm confused at this point.

It may have something to do with this snippet:

<?php
if(isset($_POST['add']))
{
$dbhost = sql2**.********.com;
$dbuser = b8_14160***;
$dbpass = c*******;
$port = 3306;
$conn = mysql_connect($dbhost, $dbuser, $dbpass, $port);
if(! $conn )
.
.
.

Any help, hint or point in the proper direction would be greatly appreciated

Thank you in advance!
Matthew

The variable values, in this case, must be strings, so surround them with quotes:

$dbhost = "sql.domain.tld";
$dbuser = "username";
$dbpass = "password";

The port value can be submitted as integer, so you can omit the quotes. Anyhow, by adding mysql_error() you should be able to see the error.

Since you're rewriting the code I suggest you to switch to PDO or MySQLi libraries, because the one you're currently using is going to be removed from PHP, so check:

Thank you!

Still working on it...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.