Syntax Errors

Thread Solved

Join Date: Oct 2008
Posts: 30
Reputation: streetrodfanati is an unknown quantity at this point 
Solved Threads: 0
streetrodfanati streetrodfanati is offline Offline
Light Poster

Syntax Errors

 
0
  #1
Oct 4th, 2008
Hello,

I'm having trouble with these syntax errors & need some help. Thanks!

Parse error: syntax error, unexpected T_STRING in /home/a3933825/public_html/require.inc.php on line 43

function footer() {
?>
<CENTER>
<table>
<tr>
<td class="font"align=center><a href="start.php?option=contact">-contact us-</a>&nbsp;&nbsp;<a href="privacy.htm" target="_NEW">-privacy policy-</a>&nbsp;&nbsp;<a href="spam.htm" target="_NEW">-spam policy-</a><br></td></tr>
</table>
</CENTER>
<?
}
?>



I also get the following syntax error:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting '{' in /home/a5957980/public_html/includes/functions.php on line 18

Here's the code:

<?
$conf = mysql_fetch_array(mysql_query("SELECT * FROM config WHERE id = 1"));
function get_num_websites()
{
$query = mysql_query("SELECT * FROM urls");
$numrows = mysql_num_rows($query);
return $numrows;
}
function get_num_banners()
{
$query = mysql_query("SELECT * FROM banners");
$numrows = mysql_num_rows($query);
return $numrows;
}
function get_num_users()
{
$query = mysql_query("SELECT * FROM users");
$numrows = mysql_num_rows($query); <<<<<<<<<<<< line 18
return $numrows;

}


I don't understand why i'm getting an error since I have the same string earlier in the code & I don't get an error on that.

Thank you,
StreeRodFanatik
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 234
Reputation: PoA is an unknown quantity at this point 
Solved Threads: 8
PoA PoA is offline Offline
Posting Whiz in Training

Re: Syntax Errors

 
0
  #2
Oct 4th, 2008
It would be better if you put your code in code tag. Easier to look through.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 849
Reputation: R0bb0b is on a distinguished road 
Solved Threads: 67
R0bb0b's Avatar
R0bb0b R0bb0b is offline Offline
Practically a Posting Shark

Re: Syntax Errors

 
0
  #3
Oct 4th, 2008
and post all of your code from require.inc.php because this is not 43 lines
  1. function footer() {
  2. ?>
  3. <CENTER>
  4. <table>
  5. <tr>
  6. <td class="font"align=center><a href="start.php?option=contact">-contact us-</a>&nbsp;&nbsp;<a href="privacy.htm" target="_NEW">-privacy policy-</a>&nbsp;&nbsp;<a href="spam.htm" target="_NEW">-spam policy-</a><br></td></tr>
  7. </table>
  8. </CENTER>
  9. <?
  10. }
  11. ?>
“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” - Dr. Seuss

-- The documentation is inevitable, you may get away with it for a little while but eventually you too will have to do the deed.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 30
Reputation: streetrodfanati is an unknown quantity at this point 
Solved Threads: 0
streetrodfanati streetrodfanati is offline Offline
Light Poster

Re: Syntax Errors

 
0
  #4
Oct 4th, 2008
<td class="font"align=center><a href="start.php?option=contact">-contact us-</a>&nbsp;&nbsp;<a href="privacy.htm" target="_NEW">-privacy policy-</a>&nbsp;&nbsp;<a href="spam.htm" target="_NEW">-spam policy-</a><br></td></tr>

^^^^^^^^^^^^^^^^^^^this is line 43

as far as "It would be better if you put your code in code tag. Easier to look through."

I don't know what that means. This is how it is in the script.
Last edited by streetrodfanati; Oct 4th, 2008 at 9:24 pm.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 524
Reputation: Will Gresham is on a distinguished road 
Solved Threads: 86
Sponsor
Will Gresham's Avatar
Will Gresham Will Gresham is offline Offline
Posting Pro

Re: Syntax Errors

 
0
  #5
Oct 4th, 2008
Originally Posted by streetrodfanati View Post
as far as "It would be better if you put your code in code tag. Easier to look through."

I don't know what that means. This is how it is in the script.

.... Read the rules of the forum before posting, the code tags are explained in the paragraph at the top of the PHP forum main page which also links to this page you should read the last paragraph on there which details the repercussions of not using code tags.

Also, you would have been asked to provide the code since problems can't be seen in the code you posted, it is possible PHP is reporting a line other than the one it appears to be which could be above or below what you quoted.
Last edited by Will Gresham; Oct 4th, 2008 at 9:37 pm.
AJAX is not a programming language, scripting language or any other sort of language.
It is acheived by using JavaScript http functions.
So, AJAX = JavaScript.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 30
Reputation: streetrodfanati is an unknown quantity at this point 
Solved Threads: 0
streetrodfanati streetrodfanati is offline Offline
Light Poster

Re: Syntax Errors

 
0
  #6
Oct 5th, 2008
  1. <td class="font"align=center><a href="start.php?option=contact">-contact us-</a>&nbsp;&nbsp;<a href="privacy.htm" target="_NEW">-privacy policy-</a>&nbsp;&nbsp;<a href="spam.htm" target="_NEW">-spam policy-</a><br></td></tr>
^^^ line 43

  1. <?
  2. $conf = mysql_fetch_array(mysql_query("SELECT * FROM config WHERE id = 1"));
  3. function get_num_websites()
  4. {
  5. $query = mysql_query("SELECT * FROM urls");
  6. $numrows = mysql_num_rows($query);
  7. return $numrows;
  8. }
  9. function get_num_banners()
  10. {
  11. $query = mysql_query("SELECT * FROM banners");
  12. $numrows = mysql_num_rows($query);
  13. return $numrows;
  14. }
  15. function get_num_users()
  16. {
  17. $query = mysql_query("SELECT * FROM users");
  18. $numrows = mysql_num_rows($query); <<<<<<<<<<<< line 18
  19. return $numrows;
  20.  
  21. }
I'm new to this- I hope this is what you meant
Last edited by streetrodfanati; Oct 5th, 2008 at 12:48 am. Reason: added data
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 849
Reputation: R0bb0b is on a distinguished road 
Solved Threads: 67
R0bb0b's Avatar
R0bb0b R0bb0b is offline Offline
Practically a Posting Shark

Re: Syntax Errors

 
0
  #7
Oct 5th, 2008
Originally Posted by streetrodfanati View Post
  1. <td class="font"align=center><a href="start.php?option=contact">-contact us-</a>&nbsp;&nbsp;<a href="privacy.htm" target="_NEW">-privacy policy-</a>&nbsp;&nbsp;<a href="spam.htm" target="_NEW">-spam policy-</a><br></td></tr>
^^^ line 43
Think about it this way, php is trying to tell you the correct line the error is on, But it is usually unable to if there is a syntax error because the interpreter is unable to parse the file correctly. It usually comes fairly close but not exact. What I am saying is that your first error:
Originally Posted by streetrodfanati View Post
Parse error: syntax error, unexpected T_STRING in /home/a3933825/public_html/require.inc.php on line 43
Cannot be diagnosed until you post all the code from require.inc.php.
Last edited by R0bb0b; Oct 5th, 2008 at 12:58 am.
“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” - Dr. Seuss

-- The documentation is inevitable, you may get away with it for a little while but eventually you too will have to do the deed.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 30
Reputation: streetrodfanati is an unknown quantity at this point 
Solved Threads: 0
streetrodfanati streetrodfanati is offline Offline
Light Poster

Re: Syntax Errors

 
0
  #8
Oct 5th, 2008
ok here it is
  1. <?
  2. global $username;
  3. require 'dconn.php';
  4. session_start();
  5.  
  6. $username = @$_SESSION["username"];
  7.  
  8. $connection = mysql_connect($db_server,$db_user,$db_pass) or die(mysql_error());
  9. mysql_select_db($db_name, $connection) or die(mysql_error());
  10.  
  11. // A few important variables to set
  12. $title = "Surfanatiks SuperSurf";
  13. $motto = "Free hits without the bandwidth";
  14. $siteUrl = "http://www.surfanatiks.site50.net/new/"; // remember to include the end slash
  15. $contact_email = "streetrodfanatik@gmail.com";
  16. $paypal= "streetrodfanatik@yahoo.com";
  17. $emailFooter = " - You are receiving this email because you are currently a member of ".$title."Surfanatiks";
  18.  
  19. // misc settings
  20. $signPoints = 1000; //points for signing up
  21. $surfTime = 20; //time to view each website
  22. $goldSurfTime = 15; //time for each gold member to surf
  23. $maxSites = 10; //total links one can put in the system
  24. $goldPrice = 1; // the monthly price of gold membership. Changing this will not affect current gold members
  25. $sreturn = .75; // points user gets per site visited (1 point = 1 hit)
  26. $goldreturn = 1; // points gold members get per site visited
  27.  
  28. // advertising
  29. $bannerCost = 5; //cost per month of banners.
  30.  
  31. // this is shown on the main page. This can be any html code
  32. $mainText = "Welcome to Surfanatiks Supersurf, the no-fuss traffic exchange website, where you can get visits to your websites for absolutely free, just by visiting others. We have a <b>4:3</b> ratio, that means for however many sites you visit, you get 75% of those back!<br><br>
  33.  
  34. // ***********************************
  35. // ** Do not edit beyond this point **
  36. // ***********************************
  37.  
  38. function footer() {
  39. ?>
  40. <CENTER>
  41. <table>
  42. <tr>
  43. <td class="font"align=center><a href="start.php?option=contact">-contact us-</a>&nbsp;&nbsp;<a href="privacy.htm" target="_NEW">-privacy policy-</a>&nbsp;&nbsp;<a href="spam.htm" target="_NEW">-spam policy-</a><br></td></tr>
  44. </table>
  45. </CENTER>
  46. <?
  47. }
  48. ?>
  49.  
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 524
Reputation: Will Gresham is on a distinguished road 
Solved Threads: 86
Sponsor
Will Gresham's Avatar
Will Gresham Will Gresham is offline Offline
Posting Pro

Re: Syntax Errors

 
0
  #9
Oct 5th, 2008
Theres the problem, the line above the comment telling you not to edit, line 32, does not have an " or ; on the end and that is whats causing the problem here.

change
  1. $mainText = "Welcome to Surfanatiks........you visit, you get 75% of those back!<br><br>
  2.  

to
  1. $mainText = "Welcome to Surfanatiks........you visit, you get 75% of those back!<br><br>";
AJAX is not a programming language, scripting language or any other sort of language.
It is acheived by using JavaScript http functions.
So, AJAX = JavaScript.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 30
Reputation: streetrodfanati is an unknown quantity at this point 
Solved Threads: 0
streetrodfanati streetrodfanati is offline Offline
Light Poster

Re: Syntax Errors

 
0
  #10
Oct 7th, 2008
Great that did it! TY any ideas on the other error, it says :

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'a5957980_monte'@'192.168.0.9' (using password: YES) in /home/a5957980/public_html/includes/.connect.php on line 6

Free Web Hosting

PHP Error Message

Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'nobody'@'localhost' (using password: NO) in /home/a5957980/public_html/includes/.connect.php on line 7

Free Web Hosting

PHP Error Message

Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /home/a5957980/public_html/includes/.connect.php on line 7

Free Web Hosting

PHP Error Message

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting '{' in /home/a5957980/public_html/includes/functions.php on line 18

Free Web Hosting


[code<?
$conf = mysql_fetch_array(mysql_query("SELECT * FROM config WHERE id = 1"));
function get_num_websites()
{
$query = mysql_query("SELECT * FROM urls");
$numrows = mysql_num_rows($query);
return $numrows;
}
function get_num_banners()
{
$query = mysql_query("SELECT * FROM banners");
$numrows = mysql_num_rows($query);
return $numrows;
}
function get_num_users()
{
$query = mysql_query("SELECT * FROM users");
$numrows = mysql_num_rows($query);
return $numrows;
}
function email_content($layout)
{
$GetConfig = mysql_query("SELECT * FROM config WHERE id = 1");
$conf = mysql_fetch_array($GetConfig);
$fp = fopen("includes/email_messages/".$layout.".txt", "r");
$content = '';
while(!feof($fp)) {
$content .= fread($fp, 1024);
}
fclose($fp);
$content = str_replace("{site_name}", $conf[site_name], $content);
$content = str_replace("{site_url}", $conf[site_url], $content);
return $content;
}
function optimize_tables()
{
$query = mysql_query("OPTIMIZE TABLE coonfig,users,banners,urls,sessions ");
}
function get_user_info($id)
{
$query = mysql_query("SELECT * FROM users WHERE id = '$id'");
$rows = mysql_fetch_array($query);
return $rows;
}
function get_banner_info($id)
{
$query = mysql_query("SELECT * FROM banners WHERE id = '$id'");
$rows = mysql_fetch_array($query);
return $rows;
}
function get_url_info($id)
{
$query = mysql_query("SELECT * FROM urls WHERE id = '$id'");
$rows = mysql_fetch_array($query);
return $rows;
}
function get_num_user_website($id)
{
$query = mysql_query("SELECT * FROM urls WHERE user_id = '$id'");
$numrows = mysql_num_rows($query);
return $numrows;
}
function get_num_user_banners($id)
{
$query = mysql_query("SELECT * FROM banners WHERE user_id = '$id'");
$numrows = mysql_num_rows($query);
return $numrows;
}
function check_email_exists($email)
{
$query = mysql_query("SELECT * FROM users WHERE email = '$email'");
$numrows = mysql_num_rows($query);
return $numrows;
}
function get_user_info_email($email)
{
$query = mysql_query("SELECT * FROM users WHERE email = '$email'");
$rows = mysql_fetch_array($query);
return $rows;
}
?>[/code]


thanks.
Last edited by streetrodfanati; Oct 7th, 2008 at 2:21 pm.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC