Quantcast
Viewing all articles
Browse latest Browse all 812

Connecting to Database (1 reply)

I am using Godaddy hosting, PHP 5.
I have tried numerous codes, but this is the one given to me by the Godaddy website itself and it is still not working.


<?php
//same database connection for PHP and MySQl.

//Connect To Database
$hostname="myhostname";
$username="myusername";
$password="mypass";
$dbname="mydatabase";

After I do this I get this error message...
Error
MySQL said:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '<?php
//same database connection for PHP and MySQl.

//Connect To Database
$' at line 1

Everytime I try a code I get an error in my SQL syntax, but there should be no error at all...I have no clue what is going on.

Viewing all articles
Browse latest Browse all 812

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>