Parse Error

This forum is now closed as part of retiring phpBB2.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
Post Reply
mattmcb
Registered User
Posts: 43
Joined: Tue Oct 29, 2002 8:43 pm

Parse Error

Post by mattmcb »

Can anyone help with this error?

Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /home/seekide/public_html/storegroup/sg_forum/search.php on line 28
Thanks,
Matt

Check out my websites:
http://www.storegroup.org - Free website for online merchants to collaboarte and create joint ventures for higher profits
http://www.seekideas.com
http://www.polarclaws.com
http://www.seekshopping.com

mattmcb
Registered User
Posts: 43
Joined: Tue Oct 29, 2002 8:43 pm

here is the code

Post by mattmcb »

sorry, here is the code, I marked the line...

Code: Select all

// Search Query - Display Results
echo "<table width='100%' cellpadding='2' cellspacing='1' border='0' class='forumline'><tr><td class='catLeft' height='26'><img src='templates/phpib2/images/nav.gif'><span class='genmed'><font color='white'><b>Venture Results</b></font></a></span></td></tr>";
$result = mysql_query(
	"select sgforum_users.username, sgforum_users.companyname, sgforum_users.storename, sgforum_users.storewebsite, sgforum_users.storecategory, sgforum_users.orders, sgforum_users.hits, sgforum_users.customers, venture_master.venture_type, venture.products, venture.venture_desc 
	from sgforum_user, venture_master, venture 
	where sgforum_users.user_id = venture.user_id
	and venture.venture_id = venture_master.venture_id	
	and venture_master.venture_type = {$venture_name}
	order by venture.venture_date", $linkid); 
while ($row = mysql_fetch_array($result))
{    
   echo "<tr>
	<span class='genmed'>
	<td>
	****User Name: $row['username']<br>****
    Company Name: $row['sgforum_users.companyname']<br>
    Store Name: $row['sgforum_users.storename']<br>
    Store Website: <a href='$row['sgforum_users.storewebsite']' target='_blank'>$row['sgforum_users.storewebsite']</a><br>
    Store Category: $row['sgforum_users.storecategory']<br>
    Orders per Year: $row['sgforum_users.orders']<br>
    Hits per Month: $row['sgforum_users.hits']<br>
    Total Customers: $row['sgforum_users.customers']<br><br>
    Venture Type: $row['venture_master.venture_type']<br>
    Type of Products:<br>
	$row['venture.products']<br>
    Venture Details:<br>
	$row['venture.venture_desc']<br>
    <br>
	Click User Name to send Private Message
	</span>
    <img src='images/line_break.gif' width='555' height='2' align='absmiddle'><br>
    </td>
	</tr>";
}
echo "</table>";
Thanks,
Matt

Check out my websites:
http://www.storegroup.org - Free website for online merchants to collaboarte and create joint ventures for higher profits
http://www.seekideas.com
http://www.polarclaws.com
http://www.seekshopping.com

LifeIsPain
Former Team Member
Posts: 2148
Joined: Tue Oct 01, 2002 7:04 am
Location: Way Way Behind

Post by LifeIsPain »

Inside of an echo, you can't use array variables. You would need to go about that in the following way (and the same goes for each line using variable arrays):

Code: Select all

User Name: " . $row['username'] . "<br>
That said, this isn't really the best way to go about it, but it does work (but wouldn't make it into the MODs Database here for other reasons).
LifeIsPain - one who needs to be smackedLife is pain, highness! Anyone who says differently is selling something.

mattmcb
Registered User
Posts: 43
Joined: Tue Oct 29, 2002 8:43 pm

Post by mattmcb »

Should I use double or single quotes with the echo? I'm asking because it seems I've had parse errors inserting html with double quotes.

Thanks for the help!!!
Thanks,
Matt

Check out my websites:
http://www.storegroup.org - Free website for online merchants to collaboarte and create joint ventures for higher profits
http://www.seekideas.com
http://www.polarclaws.com
http://www.seekshopping.com

mattmcb
Registered User
Posts: 43
Joined: Tue Oct 29, 2002 8:43 pm

Post by mattmcb »

That didn't seem to work... what is the correct way of doing it that would be worthy of a MOD on this site.

I don't think I want it to be a MOD but I would prefer to do it the right way and learn the right way.

Thanks!
Thanks,
Matt

Check out my websites:
http://www.storegroup.org - Free website for online merchants to collaboarte and create joint ventures for higher profits
http://www.seekideas.com
http://www.polarclaws.com
http://www.seekshopping.com

LifeIsPain
Former Team Member
Posts: 2148
Joined: Tue Oct 01, 2002 7:04 am
Location: Way Way Behind

Post by LifeIsPain »

In order to get this to be accepted here, it would need to use the templating system. Basically, you can't use echo statements, you would need to assign the values to an array, and then parse a template file (either edit an existing one, or create your own). That would mean looking at this Knowledge Base Article and knowing your php fairly well actually. For your own job, this should work.

For your current code though, you would need to change all the lines to look similar to what I gave, not just that one line.
LifeIsPain - one who needs to be smackedLife is pain, highness! Anyone who says differently is selling something.

mattmcb
Registered User
Posts: 43
Joined: Tue Oct 29, 2002 8:43 pm

Post by mattmcb »

I changed that line and all others and still got the same error... could it be anything else?
Thanks,
Matt

Check out my websites:
http://www.storegroup.org - Free website for online merchants to collaboarte and create joint ventures for higher profits
http://www.seekideas.com
http://www.polarclaws.com
http://www.seekshopping.com

LifeIsPain
Former Team Member
Posts: 2148
Joined: Tue Oct 01, 2002 7:04 am
Location: Way Way Behind

Post by LifeIsPain »

I used the following for that echo section and all was good:

Code: Select all

echo "<tr>
   <span class='genmed'>
   <td>
   ****User Name: ".$row['username']."<br>****
    Company Name: ".$row['sgforum_users.companyname']."<br>
    Store Name: ".$row['sgforum_users.storename']."<br>
    Store Website: <a href='".$row['sgforum_users.storewebsite']."' target='_blank'>".$row['sgforum_users.storewebsite']."</a><br>
    Store Category: ".$row['sgforum_users.storecategory']."<br>
    Orders per Year: ".$row['sgforum_users.orders']."<br>
    Hits per Month: ".$row['sgforum_users.hits']."<br>
    Total Customers: ".$row['sgforum_users.customers']."<br><br>
    Venture Type: ".$row['venture_master.venture_type']."<br>
    Type of Products:<br>
   ".$row['venture.products']."<br>
    Venture Details:<br>
   ".$row['venture.venture_desc']."<br>
    <br>
   Click User Name to send Private Message
   </span>
    <img src='images/line_break.gif' width='555' height='2' align='absmiddle'><br>
    </td>
   </tr>";
Note how one of the lines has two of those variables you have to account for :P
LifeIsPain - one who needs to be smackedLife is pain, highness! Anyone who says differently is selling something.

mattmcb
Registered User
Posts: 43
Joined: Tue Oct 29, 2002 8:43 pm

Post by mattmcb »

Now I'm getting this error message:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/seekide/public_html/storegroup/sg_forum/search.php on line 23

Code: Select all

$result = mysql_query(
	"select sgforum_users.username, sgforum_users.companyname, sgforum_users.storename, sgforum_users.storewebsite, sgforum_users.storecategory, sgforum_users.orders, sgforum_users.hits, sgforum_users.customers, venture_master.venture_type, venture.products, venture.venture_desc 
	from sgforum_user, venture_master, venture 
	where sgforum_users.user_id = venture.user_id
	and venture.venture_id = venture_master.venture_id	
	and venture_master.venture_type = {$venture_name}
	order by venture.venture_date", $linkid); 
***LINE 23***while ($row = mysql_fetch_array($result))
Thanks,
Matt

Check out my websites:
http://www.storegroup.org - Free website for online merchants to collaboarte and create joint ventures for higher profits
http://www.seekideas.com
http://www.polarclaws.com
http://www.seekshopping.com

LifeIsPain
Former Team Member
Posts: 2148
Joined: Tue Oct 01, 2002 7:04 am
Location: Way Way Behind

Post by LifeIsPain »

Probably your call to sgforum_user instead of sgforum_users

Beyond that though, I don't know what your other table contain, and it comes down to debugging your SQL statement.
LifeIsPain - one who needs to be smackedLife is pain, highness! Anyone who says differently is selling something.

mattmcb
Registered User
Posts: 43
Joined: Tue Oct 29, 2002 8:43 pm

Post by mattmcb »

is this correct syntax for including a variable in the query...

Code: Select all

and venture_master.venture_type = {$venture_name}
Thanks,
Matt

Check out my websites:
http://www.storegroup.org - Free website for online merchants to collaboarte and create joint ventures for higher profits
http://www.seekideas.com
http://www.polarclaws.com
http://www.seekshopping.com

LifeIsPain
Former Team Member
Posts: 2148
Joined: Tue Oct 01, 2002 7:04 am
Location: Way Way Behind

Post by LifeIsPain »

no, but I don't know what your value of $venture_name is. if it is a list, it should be:

Code: Select all

and venture_master.venture_type IN ($venture_name)
if it isn't, then you need to have $venture_name in quotes
LifeIsPain - one who needs to be smackedLife is pain, highness! Anyone who says differently is selling something.

Post Reply

Return to “[2.0.x] MOD Writers Discussion”