cableuser Posted June 23, 2006 Share Posted June 23, 2006 Finally! I think I may have found a site that can help me with my problem. I am very much a noob at all this so dont try to give me any techno php lingo on how to go about things. I am pretty sure I am just missing something little but I have no idea what to look for so thats why I am here. I did actually get connected to the database though! I am proud of that accomplishment. [img src=\"style_emoticons/[#EMO_DIR#]/laugh.gif\" style=\"vertical-align:middle\" emoid=\":laugh:\" border=\"0\" alt=\"laugh.gif\" /] Now its just a matter of guess, test, and revise for me as I do not know what is supposed to be there and what is not. So now I am getting this:Parse error: parse error, unexpected T_STRING in /home/www/maxabileousexchange.com/bannerrotator.php on line 16That line of code goes as follows:[code]mysql_select_db("xxxxxxxxxx_xxx") or die("Could not select database")[/code]Ok here is the entire code [code]<?// This script is copyrighted to Pullan Enterprises// You are not allowed to copy this script// If you modify this script you may not claim copyrights. // You are not allowed to remove this header// We will take legal action against all violators. function brotator($br_rid) {foreach (array_keys($GLOBALS) as $i) {if(!isset(${$i})) global ${$i};}$br_exptype = "Date (YYYYMMDDHHMMSS)";if (!$db) {$db = mysql_pconnect("xxxxxxx", "xxxxxxxx", "xxxxxx") or die("Could not connect")mysql_select_db("xxxxxxxx") or die("Could not connect")} $br_updatesql = "UPDATE bannerrotator SET status='Expired' WHERE exptype='$br_exptype' AND expires<=$now"; $br_updateresult = mysql_query($br_updatesql);$br_sql2 = "SELECT * FROM bannerrotator WHERE adgroup='$br_rid' AND status='Normal' ORDER BY RAND() LIMIT 1"; $br_result2 = mysql_query($br_sql2) or die("Query failed"); $br_myrow2 = mysql_fetch_array($br_result2);$br_tid = $br_myrow2["id"];$br_newviews = $br_myrow2["views"] + 1;if ($br_myrow2["exptype"] == "Views" && $br_newviews == $br_myrow2["expires"]) { $br_sql3 = "UPDATE bannerrotator SET views=views+1,status='Expired' WHERE id='$br_tid'";} else { $br_sql3 = "UPDATE bannerrotator SET views=views+1 WHERE id='$br_tid'";} $br_result3 = mysql_query($br_sql3) or die("Query failed");if ($br_myrow2["type"] == "HTML") {echo $br_myrow2["html"];} elseif ($br_myrow2["type"] == "Image") {?><a href="<?php echo $url ?>/bclick.php?go=<?php echo $br_myrow2["id"] ?>" target="_blank"><img src="<?php echo $br_myrow2["image"] ?>" ALT="<?php echo $br_myrow2["alt"] ?>" border="0" height="<?php echo $br_myrow2["ih"] ?>" width="<?php echo $br_myrow2["iw"] ?>"></a><?php}} ?>[/code]I am assuming I am missing an some little puntuation of some sort so please advise. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/12707-need-help-getting-this-script-running/ Share on other sites More sharing options...
paul2463 Posted June 23, 2006 Share Posted June 23, 2006 HelloI am a noobie too but I think I may have found your fault, your line16 code printed below has a fault[code]mysql_select_db("xxxxxxxxxx_xxx") or die("Could not select database")[/code]I think what it should read is the following[code]mysql_select_db('xxxxxxxxxx_xxx') or die("Could not select database")[/code]note the single quote marks around the databse namethat should clear the fact that it found T_STRING marks where it wasnt expecting themhave a go anyway, its cant be made any worse by that change but I think that is the problem(apart from any spelling mistakes made by me in this post for which there is an amnesty) Quote Link to comment https://forums.phpfreaks.com/topic/12707-need-help-getting-this-script-running/#findComment-48739 Share on other sites More sharing options...
cableuser Posted June 23, 2006 Author Share Posted June 23, 2006 I will try that, thank you. Edit: I tried that but it still does not work. Quote Link to comment https://forums.phpfreaks.com/topic/12707-need-help-getting-this-script-running/#findComment-48769 Share on other sites More sharing options...
paul2463 Posted June 23, 2006 Share Posted June 23, 2006 try this one for size then, I have tried to run the script and to clear the faults I changed your script to the following[code]if (!$db) {$db = mysql_pconnect("xxxxxxx", "xxxxxxxx", "xxxxxx") or die("Could not connect");mysql_select_db("xxxxxxxx") or die("Could not connect");}[/code]notice the semi-colon's at the end of the two lines of code in the IF statement, the errors went away but I dont know if the script fully works, you will though as you will have all the databsae names etc for it to connect tohope it helps anyway Quote Link to comment https://forums.phpfreaks.com/topic/12707-need-help-getting-this-script-running/#findComment-48782 Share on other sites More sharing options...
cableuser Posted June 24, 2006 Author Share Posted June 24, 2006 Ok thanks. That problem is fixed. Now the only error I get is a query failed whatever that means. Please tell me what I should do to fix a query failed error. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/12707-need-help-getting-this-script-running/#findComment-48955 Share on other sites More sharing options...
AndyB Posted June 24, 2006 Share Posted June 24, 2006 "Query failed" is a pretty useless error message as it doesn't provide anything worth knowing. For test purposes, change your code to generate a useful error message and then you'll know where to look to fix it (or we will). For example, adjust your query lines from:[code]$br_result2 = mysql_query($br_sql2) or die("Query failed");[/code]to this:[code]$br_result2 = mysql_query($br_sql2) or die("Error: ". mysql_error(). " with query ". $br_sql2);[/code]Make a similar change to the other query/queries and tell us exactly what you get. Quote Link to comment https://forums.phpfreaks.com/topic/12707-need-help-getting-this-script-running/#findComment-48963 Share on other sites More sharing options...
cableuser Posted June 24, 2006 Author Share Posted June 24, 2006 Ok, just adding the little thing you told be to the br_result one. I know get this error message.Error: Table 'bertschkid_max.bannerrotator' doesn't exist with query SELECT * FROM bannerrotator WHERE adgroup='Main' AND status='Normal' ORDER BY RAND() LIMIT 1 Quote Link to comment https://forums.phpfreaks.com/topic/12707-need-help-getting-this-script-running/#findComment-49079 Share on other sites More sharing options...
cableuser Posted June 24, 2006 Author Share Posted June 24, 2006 $dbhost = '50webs.net'MySQL said: Documentation#1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '$dbhost = '50webs.net'' at line 1 this could be what is wrong. for some reason this line is wrong but I do not know why please advise. Quote Link to comment https://forums.phpfreaks.com/topic/12707-need-help-getting-this-script-running/#findComment-49107 Share on other sites More sharing options...
paul2463 Posted June 24, 2006 Share Posted June 24, 2006 [!--quoteo(post=387492:date=Jun 24 2006, 11:22 AM:name=cableuser)--][div class=\'quotetop\']QUOTE(cableuser @ Jun 24 2006, 11:22 AM) [snapback]387492[/snapback][/div][div class=\'quotemain\'][!--quotec--]$dbhost = '50webs.net' //this is the line you typed$dbhost = '50webs.net'' //this is the documentation line in your post[/quote]the fault could be one of two things in my mind1. either the error is the fact that you have a single quote at the start of 50webs.net and a double quote at the end.2. you are missing the ; at the end of the statementhave a look at the first one and see if there is a mix of quote marks otherwise try option 2 Quote Link to comment https://forums.phpfreaks.com/topic/12707-need-help-getting-this-script-running/#findComment-49111 Share on other sites More sharing options...
cableuser Posted June 24, 2006 Author Share Posted June 24, 2006 There is no double quotes at the end I do not know why the error message says I have double quotes but I do not. I just checked the php files. Also I do have a ; at the end of the statement. This doesnt make any since as I am positive what is in the mysql file is 100% correct. Here I will post what I have in there. [code]$dbhost = 'xxxxx.xxx';$dbuser = 'xxxxxxxxxx_xxx';$dbpass = 'xxxxxxxxx';$dbport = '3306';$conn = mysql_connect(xxxxxx.xxx, xxxxxxxxxx_xxx, xxxxxxxxx) or die ('Error connecting to mysql');$dbname = 'xxxxxxxxxx_xxx';mysql_select_db(xxxxxxxxxx_xxx);[/code] Quote Link to comment https://forums.phpfreaks.com/topic/12707-need-help-getting-this-script-running/#findComment-49117 Share on other sites More sharing options...
AndyB Posted June 24, 2006 Share Posted June 24, 2006 Unless your's is a pretty weird server set-up, the host is almost always 'localhost'. try $dbhost = 'localhost';I'd assumed you were NOT having any problem connecting to the database since you posted a query error report.[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Error: Table 'bertschkid_max.bannerrotator' doesn't exist[/quote]That's pretty clear. Maybe you have the database name wrong, maybe you have the table name wrong. The names are case-sensitive. Quote Link to comment https://forums.phpfreaks.com/topic/12707-need-help-getting-this-script-running/#findComment-49143 Share on other sites More sharing options...
cableuser Posted June 24, 2006 Author Share Posted June 24, 2006 50webs.net is the site where I get my hosting from. The site says what login info I am supposed to use and I entered it in exactly as it said. I tried using local host but with same results as before. Quote Link to comment https://forums.phpfreaks.com/topic/12707-need-help-getting-this-script-running/#findComment-49151 Share on other sites More sharing options...
AndyB Posted June 24, 2006 Share Posted June 24, 2006 There are [b]forty[/b] php files in that zip!! I'd suggest you either post a request for help in the freelancing forum and offer something in exchange for getting it working, or ask for help at the site where you got the script in the first place. Quote Link to comment https://forums.phpfreaks.com/topic/12707-need-help-getting-this-script-running/#findComment-49165 Share on other sites More sharing options...
cableuser Posted June 24, 2006 Author Share Posted June 24, 2006 I finally got the script working. I cant believe how much of an idiot I am as it had nothing to do with the script I just uploaded the wrong file to the database. Silly me [img src=\"style_emoticons/[#EMO_DIR#]/laugh.gif\" style=\"vertical-align:middle\" emoid=\":laugh:\" border=\"0\" alt=\"laugh.gif\" /] Quote Link to comment https://forums.phpfreaks.com/topic/12707-need-help-getting-this-script-running/#findComment-49167 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.