datalee100 Posted July 14, 2007 Share Posted July 14, 2007 I'm getting: Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'sql06freemysqlnet' (1) in /home/.lafayette/musica/musica.clavis-sama.com/ttcg/members.php on line 6 But on the file my sql host is sql06.freemysql.net. Where did the periods go? The original coding is: $connection = mysql_connect(sql06.freemysql.net,daralee100,*******); $db = mysql_select_db(tcglinking, $connection); Link to comment https://forums.phpfreaks.com/topic/59891-error-cant-call-the-database/ Share on other sites More sharing options...
trq Posted July 14, 2007 Share Posted July 14, 2007 <?php $connection = mysql_connect('sql06.freemysql.net','daralee100','*******'); $db = mysql_select_db('tcglinking', $connection); ?> Link to comment https://forums.phpfreaks.com/topic/59891-error-cant-call-the-database/#findComment-297835 Share on other sites More sharing options...
yzerman Posted July 14, 2007 Share Posted July 14, 2007 you need to use single quotes. Should be $mysql_connect = mysql_connect('host','username','password'); Using a string like blah.somewhere.blah without quotes, php takes those and combines them as one value, which is why you have no periods in your warning. Link to comment https://forums.phpfreaks.com/topic/59891-error-cant-call-the-database/#findComment-297836 Share on other sites More sharing options...
datalee100 Posted July 14, 2007 Author Share Posted July 14, 2007 $sql = "SELECT username,siteurl,urlbanner FROM TABLE"; So to run that, it would be the same way? Link to comment https://forums.phpfreaks.com/topic/59891-error-cant-call-the-database/#findComment-297838 Share on other sites More sharing options...
trq Posted July 14, 2007 Share Posted July 14, 2007 So to run that, it would be the same way? What do you meen? That is valid php syntax. You have an sql error there though as TABLE is a reserved word. Link to comment https://forums.phpfreaks.com/topic/59891-error-cant-call-the-database/#findComment-297839 Share on other sites More sharing options...
teng84 Posted July 14, 2007 Share Posted July 14, 2007 we use quote for non variables and functions Link to comment https://forums.phpfreaks.com/topic/59891-error-cant-call-the-database/#findComment-297840 Share on other sites More sharing options...
trq Posted July 14, 2007 Share Posted July 14, 2007 teng... if your going to reply can you at least try and make sense. That last post says nothing. Link to comment https://forums.phpfreaks.com/topic/59891-error-cant-call-the-database/#findComment-297842 Share on other sites More sharing options...
teng84 Posted July 14, 2007 Share Posted July 14, 2007 teng... if your going to reply can you at least try and make sense. That last post says nothing. dude how old are you you always seems mad High blood lol what im trying to say is that all non varaibles and function are required to have a quote am i wrong with that lol cool thorpe cool Link to comment https://forums.phpfreaks.com/topic/59891-error-cant-call-the-database/#findComment-297849 Share on other sites More sharing options...
trq Posted July 14, 2007 Share Posted July 14, 2007 am i wrong with that Indeed you are wrong with that. The point I was making is that you often seem to poke in with a one liner that makes little sense. This doesn't help people who are trying to understand. Now even with your further explanation of your last comment we see that you where incorrect anyway. Its easier if you don't know what your talking about to just leave your comments out. Link to comment https://forums.phpfreaks.com/topic/59891-error-cant-call-the-database/#findComment-297851 Share on other sites More sharing options...
teng84 Posted July 14, 2007 Share Posted July 14, 2007 tell me why dude cool Link to comment https://forums.phpfreaks.com/topic/59891-error-cant-call-the-database/#findComment-297853 Share on other sites More sharing options...
datalee100 Posted July 14, 2007 Author Share Posted July 14, 2007 Alright, changing TABLE to my correct table takes away the errors, but now it's not calling the right stuff from the database... This is the link: http://musica.clavis-sama.com/ttcg/members.php Basically, it's written so that in one of the table boxes it's a button that links with the info from the database I.E.: $link = "<a href='$row[siteurl]'><img src='$row[urlbanner]'>"; Should bring up a link with the siteurl from the database as the link and the urlbanner variable as the image... Do these need the single quote around them as well? They're called in by: $sql = "SELECT username,siteurl,urlbanner FROM exchange"; And used as: echo "<table border=0 cellspacing=0 cellpadding=2 width=200>"; echo "<tr><td>Site Banner<td>Owner"; while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { echo "<tr><td>"; printf ("%s $td $link %s $el", $row[0], $row["username"]); Which also should show the username in the correct area. Comments? Link to comment https://forums.phpfreaks.com/topic/59891-error-cant-call-the-database/#findComment-297866 Share on other sites More sharing options...
datalee100 Posted July 14, 2007 Author Share Posted July 14, 2007 Anyone have any ideas? I won't be here to try stuff and reply until Thursday, but I would really like an answer... Thanks! Link to comment https://forums.phpfreaks.com/topic/59891-error-cant-call-the-database/#findComment-298072 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.