Page 1 of 1

need help in code of php

Posted: Wed Mar 12, 2003 12:24 pm
by forgun
the error

Code: Select all

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/virtual/site13/fst/var/www/html/new/gets.php on line 28

Fatal error: Call to undefined function: build_table() in /home/virtual/site13/fst/var/www/html/new/gets.php on line 18
the code is

Code: Select all

<?php
define('ha' , true);
$root = './';
include ($root .'comm.inc');
function sets($menu) {
	switch ($menu) {
		case "main":
		include($root . 'includes/dbs.php' );
		error_reporting  ( E_ERROR | E_WARNING | E_NOTCIE );
		$lk = mysql_connect($serv,$user,$pass) or die ("unable to do connection \n" .mysql_error());
		mysql_select_db($dbname[0],$lk);
		$qur = "select * from linkssets where loc = 'main' order by id desc";
		$res = mysql_query($qur) or die ("error in the select " .mysql_error());
		while ($row = mysql_fetch_assoc($res)) {
			$out = array ( $row['desc'] => $row['name'] ); 
			$id = array ( $row['id'] );
		}
		build_table($out, $id);
		return $msg;
		close_db($lk,$res);
	}
}
function build_table( $data , $id) {
	foreach ($data as $desc => $menu) {
		foreach ($id as $kay => $val) {
			$msg = "<tr><td width='47%'  style='border-style: double; border-width: 3' height='18'>";
			$msg .= "<A href='index.php?id=" .$id[$kay] . "'><b>" .$menu  ."</b></a></td>";
			$msg .= "<td width='53%' style='border-style: double; border-width: 3' height='18'>" .$desc "</td></tr>";
			return $msg;
		}
	}
}			 
function close_db($lk,$re) {
	mysql_free_result($re);
	mysql_close($lk);
}

?>
the line is

Code: Select all

$msg .= "&lt;td width='53%' style='border-style: double; border-width: 3' height='18'&gt;" .$desc "&lt;/td&gt;&lt;/tr&gt;"; # line 28

Code: Select all

build_table($out, $id); #line 18

Posted: Wed Mar 12, 2003 12:36 pm
by BDKR
Line 28 is the line allright. It's a concatenation error.

Cheers,
BDKR

Posted: Wed Mar 12, 2003 1:10 pm
by forgun
so how i can make at work??

Posted: Wed Mar 12, 2003 1:27 pm
by net7
The fix for that line is this

Code: Select all

$msg .= "<td width='53%' style='border-style: double; border-width: 3' height='18'>" .$desc. "</td></tr>";

You just needed to add the period after the "$desc" to add the "</td></tr>". See ?

Posted: Wed Mar 12, 2003 1:33 pm
by forgun
lol 10x
like all ways i dont put a point