Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 132,685 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,247 people online right now. Registration is fast and FREE... Join Now!




Please help me find syntax error

2 Pages V  1 2 >  
Reply to this topicStart new topic

Please help me find syntax error

King8654
post 2 Jun, 2008 - 11:10 AM
Post #1


D.I.C Head

Group Icon
Joined: 4 Mar, 2008
Posts: 91


My Contributions


stupid me accid deleted a comma or ;, and now getting

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/king8654/public_html/browse.php on line 71

can someone please spot where im missing it please, already burned hole in retinas trying to find lol

its somewhere within here

CODE

<tr>
          <td height="25" align="left" valign="middle">
<big><font color="#000000" size="1.5" face="Georgia,Times New Roman,serif">
            <a href=index.php?cmd=browse&&mainsub=<?=$_GET['mainsub'];?>&&chieldsub=<?=$_GET['chieldsub'];?>&&decid=<?=$row[0];?>><?=$row[2];?></a>
          </big></td>
        </tr>
        <?
            }
            ?>
      </table>
    </td>
    <td width="150" align="left" valign="top">
      <table width="100%" border="0" cellpadding="1" cellspacing="1">
        <tr>
          <td height="40" align="center" valign="middle" bgcolor="#CDE4FE"> <font color="#003366" size="2" face="Georgia,Times New Roman,serif"><strong>Other
            Categories in
            <?=strtoupper(substr($mainsubject,0,1)).strtolower(substr($mainsubject,1));?>
            </strong><b> </b></font> </td>
        </tr>
        <?
            while($row1=@mysql_fetch_array($r2, MYSQL_BOTH))
            {
                $sub2=explode("-",$row1[1]);
            ?>
        <tr>
          <td align="left" valign="middle" height="25"> <a href=index.php?cmd=browse&&mainsub=<?=$_GET['mainsub'];?>&&chieldsub=<?=$row1[1];?>><font color="#000033" size="2" face="Georgia,Times New Roman,serif">
            <?=strtoupper(substr(str_replace("_"",",$sub2[1]),0,1)).strtolower(substr(str_replace("_"", ",$sub2[1]),1));?>
            </font></a> </td>
        </tr>
User is offlineProfile CardPM

Go to the top of the page

snoj
post 2 Jun, 2008 - 11:18 AM
Post #2


$Null

Group Icon
Joined: 31 Mar, 2003
Posts: 3,304



Thanked 5 times

Dream Kudos: 700
My Contributions


*flexes mentor muscles*

Moved to PHP.

This post has been edited by snoj: 2 Jun, 2008 - 11:19 AM
User is offlineProfile CardPM

Go to the top of the page

King8654
post 2 Jun, 2008 - 11:36 AM
Post #3


D.I.C Head

Group Icon
Joined: 4 Mar, 2008
Posts: 91


My Contributions


my bad snoj, wasent thinking straight. opps
User is offlineProfile CardPM

Go to the top of the page

akozlik
post 2 Jun, 2008 - 11:49 AM
Post #4


D.I.C Addict

Group Icon
Joined: 25 Feb, 2008
Posts: 596



Thanked 22 times

Dream Kudos: 750
My Contributions


Which line is line 71? That will help us.
User is offlineProfile CardPM

Go to the top of the page

King8654
post 2 Jun, 2008 - 11:54 AM
Post #5


D.I.C Head

Group Icon
Joined: 4 Mar, 2008
Posts: 91


My Contributions


this whole code for browse page, but even though it said line 71, still couldnt find it, prob me just missing it, but any help would be much apprec

CODE
<?
    require('config.php');
    if($_SESSION['login']!="true")
    {
        echo "You are not Authorised Person To See This Page. <br><br> Please Do <b>Login</b>";
    }
    else
    {
        $desc=$_GET['decid'];
        if($desc!="")
        {
            include('description.php');
            echo "<br><br><br>";
        }
        if($_GET['mainsub']!="" && $_GET['chieldsub']!="")
        {
            


                        $q="select * from `".$_GET['chieldsub']."`";
            $r=mysql_query($q);
            $n=@mysql_num_rows($r);
            $q1="select * from `subjects` where `id`='".$_GET['mainsub']."'";
            $r1=mysql_query($q1);
            $m=@mysql_fetch_array($r1);
            $mainsubject=$m['2'];
            $q2="select * from `subjects` where `sub_head`='".$mainsubject."'";
            $r2=mysql_query($q2);
            
?>
<table width="525" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="left" valign="top">
      <table width="100%" border="0" cellpadding="1" cellspacing="1">
        <tr>
          <td width="400" height="40" align="center" valign="middle" bgcolor="#CDE4FE">
            <font color="#003366" size="2" face="Georgia,Times New Roman,serif"><b>
            Exams Found In This Category (<?=$n;?>) </b></font>
          </td>
        </tr>
        <?
            while($row=@mysql_fetch_array($r, MYSQL_BOTH))
            {
            ?>
        <tr>
          <td height="25" align="left" valign="middle">
<big><font color="#000000" size="1.5" face="Georgia,Times New Roman,serif">
            <a href=index.php?cmd=browse&&mainsub=<?=$_GET['mainsub'];?>&&chieldsub=<?=$_GET['chieldsub'];?>&&decid=<?=$row[0];?>><?=$row[2];?></a>
          </big></td>
        </tr>
        <?
            }
            ?>
      </table>
    </td>
    <td width="150" align="left" valign="top">
      <table width="100%" border="0" cellpadding="1" cellspacing="1">
        <tr>
          <td height="40" align="center" valign="middle" bgcolor="#CDE4FE"> <font color="#003366" size="2" face="Georgia,Times New Roman,serif"><strong>Other
            Categories in
            <?=strtoupper(substr($mainsubject,0,1)).strtolower(substr($mainsubject,1));?>
            </strong><b> </b></font> </td>
        </tr>
        <?
            while($row1=@mysql_fetch_array($r2, MYSQL_BOTH))
            {
                $sub2=explode("-",$row1[1]);
            ?>
        <tr>
          <td align="left" valign="middle" height="25"> <a href=index.php?cmd=browse&&mainsub=<?=$_GET['mainsub'];?>&&chieldsub=<?=$row1[1];?>><font color="#000033" size="2" face="Georgia,Times New Roman,serif">
            <?=strtoupper(substr(str_replace("_"",",$sub2[1]),0,1)).strtolower(substr(str_replace("_"", ",$sub2[1]),1));?>
            </font></a> </td>
        </tr>
        <?
            }
            ?>
      </table></td>
  </tr>
</table>
<?
    }
    }
?>
User is offlineProfile CardPM

Go to the top of the page

akozlik
post 2 Jun, 2008 - 12:05 PM
Post #6


D.I.C Addict

Group Icon
Joined: 25 Feb, 2008
Posts: 596



Thanked 22 times

Dream Kudos: 750
My Contributions


It looks like the problem is with your str_replace() function

CODE

str_replace("_"", ",$sub2[1])



What stringa re you searching for and what string are you trying to replace it with. If you are searching for "_" and replacing it with ", ", then you are missing your comma. Both str_replace instances should be replaced with


CODE

str_replace("_", ", ",$sub2[1])


Basically

CODE

<?=strtoupper(substr(str_replace("_"",",$sub2[1]),0,1)).strtolower(substr(str_replace("_"", ",$sub2[1]),1));?>


Should be

CODE

<?=strtoupper(substr(str_replace("_", ",", $sub2[1]),0,1)).strtolower(substr(str_replace("_", ", ",$sub2[1]),1));?>


Let me know if that helps. On a side note, you might want to consider breaking down those functions into smaller tasks. Like to the str_replace first, save it to a variable, then do the substr, then do the strtolower, etc. If the way you're doing it works though, just keep it going.
User is offlineProfile CardPM

Go to the top of the page

King8654
post 2 Jun, 2008 - 12:41 PM
Post #7


D.I.C Head

Group Icon
Joined: 4 Mar, 2008
Posts: 91


My Contributions


major thanks!! damn quotes got all blurred on me
User is offlineProfile CardPM

Go to the top of the page

akozlik
post 2 Jun, 2008 - 12:46 PM
Post #8


D.I.C Addict

Group Icon
Joined: 25 Feb, 2008
Posts: 596



Thanked 22 times

Dream Kudos: 750
My Contributions


QUOTE(King8654 @ 2 Jun, 2008 - 01:41 PM) *

major thanks!! damn quotes got all blurred on me


Cool, no problem. If you don't mind, click on the "This post was helpful" link under my solution. The board's trying to get in the habit of thanking people who give helpful posts. Post more if you run into problems. Take care.

This post has been edited by akozlik: 2 Jun, 2008 - 12:47 PM
User is offlineProfile CardPM

Go to the top of the page

King8654
post 2 Jun, 2008 - 01:22 PM
Post #9


D.I.C Head

Group Icon
Joined: 4 Mar, 2008
Posts: 91


My Contributions


one more thing m8 if possible!! this is code to list the most recent exams uploaded to my site, and it worked fine until i changed some small things. my freelancer is from india, and lately i havent been able to stay up till 3am to ask him to fix it back, and maybe i would understand it better if someone here told me the fix.

CODE
<?
              $qlu="select * from `topics` order by `upload_date` ASC limit 0,10";
            $reslu=mysql_query($qlu);
            while($rowlu=@mysql_fetch_array($reslu, MYSQL_BOTH))
            {
                echo strtoupper(substr($rowlu['topic_name'],0,1)).strtolower(substr($rowlu['topic_name'],1,20))." ... <br>";
            }
          ?>

User is offlineProfile CardPM

Go to the top of the page

akozlik
post 2 Jun, 2008 - 01:25 PM
Post #10


D.I.C Addict

Group Icon
Joined: 25 Feb, 2008
Posts: 596



Thanked 22 times

Dream Kudos: 750
My Contributions


What is the error that you're getting?

Hmmmm . . . freelancers in India . . . I was just talking about that topic.

Should you ever need to switch coders let me know, as I may be available.
User is offlineProfile CardPM

Go to the top of the page

King8654
post 2 Jun, 2008 - 01:26 PM
Post #11


D.I.C Head

Group Icon
Joined: 4 Mar, 2008
Posts: 91


My Contributions


see its only showing the first ten uploads in abc order to the site, not the most recent ten. hes a great lancer, but hours are rough for both of us. since the site is officially done, just small tid bits hes fixing free of charge, just gotta catch him.
User is offlineProfile CardPM

Go to the top of the page

akozlik
post 2 Jun, 2008 - 01:28 PM
Post #12


D.I.C Addict

Group Icon
Joined: 25 Feb, 2008
Posts: 596



Thanked 22 times

Dream Kudos: 750
My Contributions


Can you show me what it's displaying, and then show me what it should display? That looks like it should be working.
User is offlineProfile CardPM

Go to the top of the page

2 Pages V  1 2 >
Fast ReplyReply to this topicStart new topic
Time is now: 11/23/08 07:13AM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month