Jump to content

Non-Connecting Database Code?


justlukeyou

Recommended Posts

Hi,

 

I found the following tutorial on a list of Top 20 tutorials.  However, I have gone through code and there doesn't seem to be any form database connection or config.php fille.  So how does this code write to a database if it doesn't connect to a database?

 

http://www.99points.info/2010/07/facebook-style-wallpost-and-comments-system-using-jquery-ajax-and-php-reloaded/

Link to comment
https://forums.phpfreaks.com/topic/229077-non-connecting-database-code/
Share on other sites

basically what you need to do is start a connection is below

 

$servername="localhost";
$dbusername="whateveryourusernameis";
$dbpassword="whateveryouruserpasswordis";
$dbname="whateveryourdatabasenameis";
mysql_connect($servername, $dbusername, $dbpassword) or $debug_message.=mysql_error()."Connect Error<br />";
mysql_select_db($dbname) or $debug_message.=mysql_error()."Select Error<br />";

 

if you put

$servername="localhost";
$dbusername="whateveryourusernameis";
$dbpassword="whateveryouruserpasswordis";
$dbname="whateveryourdatabasenameis";

 

in a file called config.php and include it, if you change the info you only have to change one file

 

i put the debug message in because when i am developing i can have it kick back a message to

show all is ok or i screwed up somewhere

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.