Jump to content

Odd T_Var error


ThunderAI

Recommended Posts

I am getting the following error:

 

Parse error: syntax error, unexpected T_VARIABLE xxxxxx on line 67

 

But I only get the error on GoDaddies server not on my own development server. It is very odd.  Here is the source close to the problem area:

 

<?php
									$mainurl	= $mainURL;
									//echo "<br><br>".$mainurl."<br><br>";
									$flink 		= friendly_url($r_cat1[name]);
									//echo "<br><br>".$flink."<br><br>";
									$productid 	= $r_cat1[id];
									//echo "<br><br>".$productid."<br><br>";
									$name		= $r_cat1[name];
									//echo "<br><br>".$name."<br><br>";
									$select = $select."<option value='".$mainurl."products.php?cn=".$flink."&cid=".$productid."'>".$name."</option>";
?>					

 

Line 67 is the last line of code

Link to comment
https://forums.phpfreaks.com/topic/133930-odd-t_var-error/
Share on other sites

<?php
                              $mainurl   = $mainURL;
                              //echo "<br><br>".$mainurl."<br><br>";
                              $flink       = friendly_url($r_cat1[name]);
                              //echo "<br><br>".$flink."<br><br>";
                              $productid    = $r_cat1[id];
                              //echo "<br><br>".$productid."<br><br>";
                              $name      = $r_cat1[name];
                              //echo "<br><br>".$name."<br><br>";


$select = "<option value='".$mainurl."products.php?cn=".$flink." cid=".$productid."'>".$name."</option>";


echo "<select>";
echo $select;
echo "</select>";


?>  

Link to comment
https://forums.phpfreaks.com/topic/133930-odd-t_var-error/#findComment-697164
Share on other sites

This code looks ok. except for

$r_cat1[name]

that should be

$r_cat1['name']

(same for $r_cat1[id])

 

Also you could simplify things a bit like this

$select .= "<option value='{$mainurl}products.php?cn=$flink&cid=$productid'>$name</option>";

 

But I can see nothing that could cause this error. Which line is the line 67?

Link to comment
https://forums.phpfreaks.com/topic/133930-odd-t_var-error/#findComment-697169
Share on other sites

Here is the full select code:

 

<?php
if ($sub_select=='1') {
							// Display the sub folders of this catalog as a select function and not as indisual lists
							// TO do this we highjack the normal process and ensure a proper select statement is created
							// Start by creating the select statement
							$select = "<FORM NAME='".$r_cat[name]."' style='margin:0; padding:0'>";
							$select = $select."    •<select name='select' ONCHANGE='goto(this.form)' style='margin:0; padding:0'>";
							$select = $select."<option value='#'>--Select ".$r_cat[name]."--</option>";
							// Now loop through the information like we normaly would incerting the information into the select statement
							do{
									//LEVEL 2
									$category_style1='';
									if($cid==$r_cat1[id]){
											$category_style1=" id='show_this_category'";
										}

									$mainurl	= $mainURL;
									$flink 		= friendly_url($r_cat1[name]);
									$productid 	= $r_cat1[id];
									$name		= $r_cat1[name];
									$select 	= $select."<option value='".$mainurl."products.php?cn=".$flink."&cid=".$productid."'>".$name."</option>";
									//echo "<select>";
									//echo $select;
									//echo "</select>";


								}
								while($r_cat1=mysql_fetch_assoc($q_cat1));

							$select = $select."</select></form>";
							$categories_list = $categories_list.$select;

						}
?>

Link to comment
https://forums.phpfreaks.com/topic/133930-odd-t_var-error/#findComment-697182
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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