Graphic Design Forum and Web Design Forum  

Go Back   Graphic Design Forum and Web Design Forum »Web Design Forum »Programming Forum

Notices

Programming Forum Web and Software Programming Forum - Java, PHP, SQL etc.


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-02-2008, 02:29 PM
jwade_m's Avatar
Graphic/Web Designer
 
Join Date: Aug 2007
Location: Indiana, United States
Posts: 196
Default connecting to database

Shouldn't there be a $db name = in this code somewhere to connect to a database?



$server = "servername"; // this is the server address and port
$username = "*****"; // change this to your jimmy username
$password = "********"; // change this to your jimmy password


$link = mysql_connect ($server, $username, $password)
or die ("Could not connect");
if (!@mysql_select_db("heartland_meds", $link)) { // leave the database name as anydb for now
echo "

There has been an error. This is the error message:

";
echo "

" . mysql_error() . "

";
echo "Please Contant Your Systems Administrator with the details";
}


?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!RSS Share on Facebook Share This Article & VoteForum Netvibes Page
Reply With Quote
  #2 (permalink)  
Old 01-02-2008, 02:49 PM
lolly's Avatar
Only Ask If You Want Truth™
 
Join Date: Feb 2007
Posts: 1,044
Default

I would say yes, without a doubt and not usually a servername but localhost
__________________
Harmony is the grandest artistic aim
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!RSS Share on Facebook Share This Article & VoteForum Netvibes Page
Reply With Quote
  #3 (permalink)  
Old 01-02-2008, 04:10 PM
LeadMagnet's Avatar
Mr. Tambourine Man
 
Join Date: Jun 2007
Location: Ireland
Posts: 1,081
Default

It is there

PHP Code:
$link mysql_connect ($server$username$password
$db is just a variable name, it can be anything. It can be $catpiss if you want. In this case, he chose $link instead. $server is the server name which is set on the first line.
__________________
Subtlety is my middle name... and first and last in case you didn't get the point.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!RSS Share on Facebook Share This Article & VoteForum Netvibes Page
Reply With Quote
  #4 (permalink)  
Old 01-02-2008, 06:28 PM
jwade_m's Avatar
Graphic/Web Designer
 
Join Date: Aug 2007
Location: Indiana, United States
Posts: 196
Default

Look at this one and compair the two:

function connect_db()
{
$DBhost = "servername";//change this line
$DBuser = "****";//change this line "****"
$DBpass = "********";//change this line "********"
$DBName = "nameofdatabase";//change this line ""
$conn = mysql_connect($DBhost , $DBuser, $DBpass,$DBName)
or die("There was a problem connecting to MySQL. Please try again later.");

if (!@mysql_select_db("nameofdatabase", $conn))//change this line ""
{
die ("There was a problem connecting to the database. Please try again later.");
}
return $conn;
}

?>




Notice that he has a variable there for the database name.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!RSS Share on Facebook Share This Article & VoteForum Netvibes Page
Reply With Quote
  #5 (permalink)  
Old 01-02-2008, 06:42 PM
Toon's Avatar
Netvibes is an Addiction™
 
Join Date: Jan 2007
Location: Sheffield, UK
Posts: 15,724
Default

Quote:
Originally Posted by LeadMagnet View Post
It can be $catpiss if you want.
Someone's trying to hack my database! Username: usethelittertray!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!RSS Share on Facebook Share This Article & VoteForum Netvibes Page
Reply With Quote
  #6 (permalink)  
Old 01-02-2008, 09:15 PM
LeadMagnet's Avatar
Mr. Tambourine Man
 
Join Date: Jun 2007
Location: Ireland
Posts: 1,081
Default

Sorry, mis-read it and misunderstood the confusion. Yeah, the database isn't being specified there, you're right.
__________________
Subtlety is my middle name... and first and last in case you didn't get the point.

Last edited by LeadMagnet; 01-02-2008 at 09:19 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!RSS Share on Facebook Share This Article & VoteForum Netvibes Page
Reply With Quote
  #7 (permalink)  
Old 03-02-2008, 12:06 PM
coloroutsidethelines!'s Avatar
since i was seventeen
 
Join Date: Feb 2008
Location: LDN
Posts: 18
Default

Quote:
Originally Posted by jwade_m View Post
Shouldn't there be a $db name = in this code somewhere to connect to a database?
yes ( Y )
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!RSS Share on Facebook Share This Article & VoteForum Netvibes Page
Reply With Quote
  #8 (permalink)  
Old 04-02-2008, 06:10 PM
jwade_m's Avatar
Graphic/Web Designer
 
Join Date: Aug 2007
Location: Indiana, United States
Posts: 196
Default

Ok. Now when I go to my website and click on a link, I get a blank page. For eample go here HeartlandMeds.com, anesthesia systems support company, anesthesia machines, medical supplies and click on new products. See the blank page. What can be causing this? It's probably something to do with the database.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!RSS Share on Facebook Share This Article & VoteForum Netvibes Page
Reply With Quote
  #9 (permalink)  
Old 04-02-2008, 06:16 PM
Toon's Avatar
Netvibes is an Addiction™
 
Join Date: Jan 2007
Location: Sheffield, UK
Posts: 15,724
Default

there's nothing in the source code?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!RSS Share on Facebook Share This Article & VoteForum Netvibes Page
Reply With Quote
  #10 (permalink)  
Old 04-02-2008, 06:30 PM
LeadMagnet's Avatar
Mr. Tambourine Man
 
Join Date: Jun 2007
Location: Ireland
Posts: 1,081
Default

That could indicate an error in your php code that's causing the script to fail. I recommend turning on error reporting while you're developing code to spot these kinda things.
__________________
Subtlety is my middle name... and first and last in case you didn't get the point.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!RSS Share on Facebook Share This Article & VoteForum Netvibes Page
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
WordPress Database has Come Back! Graphic Design Blog Graphic Design Blog 0 05-05-2008 03:00 AM
ISBN Database Solution swtectonics Graphic Design and Web Design Help 3 05-03-2008 02:21 PM
database question jwade_m Programming Forum 10 17-01-2008 12:13 PM
Database Toon Graphic Design Forum Announcements 12 07-01-2008 03:43 PM
Computerlove™ - Connecting Creative Talents Graphic Design Links Graphic Design Links 0 30-10-2007 01:20 AM


All times are GMT. The time now is 05:44 AM.



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC5