Jump to content

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

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.