Jump to content

Need help getting this script running


cableuser
 Share

Recommended Posts

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 16
That 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
Link to comment
Share on other sites

Hello

I 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 name
that should clear the fact that it found T_STRING marks where it wasnt expecting them

have 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)
Link to comment
Share on other sites

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 to

hope it helps anyway
Link to comment
Share on other sites

"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.
Link to comment
Share on other sites

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
Link to comment
Share on other sites

$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.
Link to comment
Share on other sites

[!--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 mind
1. 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 statement

have a look at the first one and see if there is a mix of quote marks otherwise try option 2
Link to comment
Share on other sites

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]
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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\" /]
Link to comment
Share on other sites

This thread is more than a year old. Are you sure you have something important to add to it?

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.

 Share

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