PDA

View Full Version : DHTML SoThink Menu Maker with PHP


lynettes
12-29-2004, 03:46 AM
I think I must be really tired; I can't find my error. I'm trying to implement a menu. I get the following error:

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in navbar.php on line 23

If it helps the instructions are at:

http://www.************/webtools/dhtmlmenu/store/phpdb/index.php?bResult=1

Here's my code:


<?PHP
include("webconnect.php");
$CONNECTION = mysql_connect($DB_SERVER, $DB_USER, $DB_PASS) OR DIE ('I cannot connect to the database because: ' . MYSQL_ERROR());
mysql_select_db($DB_NAME) OR DIE("Couldnt select database");

$query = "SELECT * FROM $DB_TABLE1";
$resultCat = mysql_db_query($DB_NAME, $query);
$numrowsCat = mysql_num_rows($resultCat);

for ($i = 0; $i < $numrowsCat; $i++)
{
$rowCat = mysql_fetch_array($resultCat);
$CatName = $rowCat["name"];
}

$queryPro = "SELECT * FROM $DB_TABLE2 WHERE cid = '.$rowCat['cid']'";
$resultPro = mysql_db_query($DB_NAME, $queryPro);
$numrowsPro = mysql_num_rows($resultPro);

for ($j = 0; $j<$numrowsPro; $j++)
{
$rowPro = mysql_fetch_array($resultPro);
$ProName = $rowPro["name"];
$Link = $rowPro["link"];
}
?>
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript1.2">
<!--
stm_bm(["menu27c2",400,"","blank.gif",0,"","",1,0,0,0,0,1,0,0]);
stm_bp("p0",[0,4,0,0,3,4,0,7,100,"",-2,"",-2,90,0,0,"#000000","#f1f2ee","",3,0,0,"#000000"]);
stm_ai("p0i0",[1,"<?=$CatName?>","","",-1,-1,0,"","_self","","","","",0,0,0,"arrow_r.gif","arrow_r.gif",7,7,0,1,2,"#ffffff",1,"#ffffff",1,"upline.gif","upline.gif",3,3,0,0,"#ffffff","#ffffff","#5c78aa","#00cc00","bold 8pt Verdana","bold 8pt Verdana",0,0]);
stm_bpx("p1","p0",[0,4,0,0,3,4,0,0]);
stm_ai("p1i0",[1,"<?=$ProName?>","","",-1,-1,0,"<?=$Link?>","_self","<?=$Link?>","","","",0,0,0,"","",-1,-1,0,1,2,"#5c788a",0,"#93a070",0,"","",3,3,0,0,"#fffff7","#000000","#000000","#ffffff","8pt Verdana","8pt 'Tahoma','Arial'",0,0]);
stm_ep();
stm_ep();
stm_em();
//-->
</SCRIPT>

fci
12-29-2004, 04:13 AM
$queryPro = "SELECT * FROM $DB_TABLE2 WHERE cid = '{$rowCat['cid']}'";

that might fix the problem

lynettes
12-29-2004, 04:19 AM
I ended up with the following

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in navbar.php on line 15

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in navbar.php on line 25

xiaodao
12-29-2004, 04:49 AM
$queryPro = "SELECT * FROM $DB_TABLE2 WHERE cid = '".$rowCat['cid']."'";

lynettes
12-29-2004, 05:01 AM
I tried it and a couple of different variations. Still the same.

fci
12-29-2004, 05:40 AM
your query probably has an error.. and.. mysql_db_query (http://www.php.net/mysql_db_query) has been deprecated since PHP 4.0.6.
$queryPro = "SELECT * FROM $DB_TABLE2 WHERE cid ='{$rowCat['cid']}'";
$resultPro = mysql_query($queryPro) or die(mysql_error());
$numrowsPro = mysql_num_rows($resultPro);

change your other call to mysql_db_query to mysql_query.