Steven_belfast Posted September 26, 2008 Share Posted September 26, 2008 Hello folks, Need some help on this one , I am trying to make a shout box for my site and found this code , But i get the following errors : Parse error: syntax error, unexpected T_STRING in /home/a3785887/public_html/comment.php on line 6 Do you think you could give me a hand some one , code is <?php //Edit only the line below $dbcnx = mysql_connect("servername","dbname","username","password") mysql_select_db("comments"); $result = @mysql_query("SELECT * FROM comtbl ORDER BY postID DESC"); if (!$result) { echo("<b>Error performing query: " . mysql_error() . "</b>"); exit(); } while ($row = mysql_fetch_array($result) ) { $msgTxt = $row["postTXT"]; $msgId = $row["postID"]; $SigName = $row["posterNAME"]; $SigDate = $row["postTIME"]; $msgTitle = $row["postTITLE"]; $url = $row["posterEMAIL"]; $yr = substr($SigDate, 2, 2); $mo = substr($SigDate, 4, 2); $da = substr($SigDate, 6, 2); $hr = substr($SigDate, 8, 2); $min = substr($SigDate, 10, 2); if ($hr > "11") { $x = "12"; $timetype = "PM"; $hr = $hr - 12; }else{ $timetype = "AM"; } if (!$url) { $url = "#"; }else{ $stat = $url; $url = "mailto:" . $url . ""; } echo("<p><b>$msgTitle</b> $msgTxt<br><div align=right> $hr:$min $timetype | $mo/$da/$yr | $msgId, <a href='$url'>$SigName</a></div></p>"); } ?> Many thanks Link to comment https://forums.phpfreaks.com/topic/126003-shoutbox-code-help/ Share on other sites More sharing options...
peranha Posted September 26, 2008 Share Posted September 26, 2008 this line $dbcnx = mysql_connect("servername","dbname","username","password") You forgot the ; $dbcnx = mysql_connect("servername","dbname","username","password"); Link to comment https://forums.phpfreaks.com/topic/126003-shoutbox-code-help/#findComment-651597 Share on other sites More sharing options...
Steven_belfast Posted September 26, 2008 Author Share Posted September 26, 2008 OMFG How dumb do i look now :'( Well thats what i get for not taking a break , Thanks man for the help . Cant see why dreamweaver did not pick up on that ??? Lol Now i am just getting denied for user 'user@'localhost' (using password: YES) I know the logins are good i have them on the other page . But if i remove the name of the databade i get Error performing query: No database selected Am i just being thick ? Link to comment https://forums.phpfreaks.com/topic/126003-shoutbox-code-help/#findComment-651599 Share on other sites More sharing options...
peranha Posted September 26, 2008 Share Posted September 26, 2008 $dbcnx = mysql_connect("servername","dbname","username","password") mysql_select_db("comments"); Should be $dbcnx = mysql_connect("servername","username","password"); mysql_select_db("dbname"); Link to comment https://forums.phpfreaks.com/topic/126003-shoutbox-code-help/#findComment-651611 Share on other sites More sharing options...
Steven_belfast Posted September 27, 2008 Author Share Posted September 27, 2008 Thanks man , Got it after all , Many thanks Link to comment https://forums.phpfreaks.com/topic/126003-shoutbox-code-help/#findComment-651630 Share on other sites More sharing options...
Steven_belfast Posted September 27, 2008 Author Share Posted September 27, 2008 As it turns out that shout box code was very plain, Does any one know where i can get a nice shout box from ? Link to comment https://forums.phpfreaks.com/topic/126003-shoutbox-code-help/#findComment-651634 Share on other sites More sharing options...
xoligy Posted September 27, 2008 Share Posted September 27, 2008 One the best i know of is yshout. Its wrote in Ajax and you need to donate 5dollers for it, im sure there are free alternatives out there tho Link to comment https://forums.phpfreaks.com/topic/126003-shoutbox-code-help/#findComment-651771 Share on other sites More sharing options...
Steven_belfast Posted September 27, 2008 Author Share Posted September 27, 2008 Hello , Yeah i seen that one looks good , thanks Link to comment https://forums.phpfreaks.com/topic/126003-shoutbox-code-help/#findComment-652059 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.