разбиваем массив в строку, между значение например '|', при доставании из базы функцией бьем обратно в массив
Код (PHP): $result2 = mysql_query ("INSERT INTO vizitka_client (company, profile, profile2, name1,name2,job,job2,address,address2,phone,phone2,email,www,script_pos) VALUES ('$company','$profile','$profile2','$name1','$name2','$job', '$job2','$address','$address2','$phone','$phone2','$email','$www','$script_pos_k')"); $result = mysql_query("SELECT script_pos FROM vizitka_def", $db); $myrow = mysql_fetch_array($result); echo $myrow ["script_pos"]; Nu i kak na mojom primere eto zdelat? uze vso pereprobival nekak nepolu4aetsa....
kas1e ja smotru ti was liba sam neznaew kak eto zdelat liba prosta pokazuew 4to silna krutoj a tolkam kak i ja znaew a pomo4 realno nemozew vot na helpi i kidaew.... =_(
Просто тебе и так разжевато как и чем сделать. Может быть за тебя это еще все и написать, и деньги за работу тоже за тебя получить?
спасите я еще тока учусь!!! спасите я еще тока учусь!!! вот такая беда =( Parse error: parse error, unexpected ',', expecting T_STRING or T_VARIABLE or '{' or '$' in /home/vas/www/components/com_cb_search/cb_search.html.php(504) : eval()'d code on line 9 PHP: <?php //Search Component// /** * Front End Code *@package *@Copyright *@ ALl Rights reserved *@license *@version */ //ensure this file is being included by a parent file defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); class HTML_advancedsearch { function simple($option, $rowFields, $rowFieldValues, $regErrorMSG){ global $mosConfig_absolute_path, $mosConfig_live_site, $Itemid; require ("/home/vas/www/administrator/components/com_cb_search/cb_search.config.php"); $Itemid = mosGetParam( $_REQUEST, 'Itemid', '' ); $option_itemid = "&Itemid=".$Itemid; $tmpl = & cb_as :: createTemplate(); $tmpl->readTemplatesFromInput('cb_search.simple.tmpl.html'); $tmpl->addVar('header', 'calendar', cb_as::cbCalendars(2) ); //$tmpl->addVar('header', 'index', sefRelToAbs("index.php") ); $tmpl->displayParsedTemplate('header'); if ( $cbsa_show_title ) { $tmpl->addVar('header_1', 'cb_as_title', _CB_AS_TITLE ); $tmpl->displayParsedTemplate('header_1'); } $searchphrase = mosGetParam( $_REQUEST, 'searchphrase', 'any' ); $searchphrases = array(); $phrase = new stdClass(); $phrase->value = 'any'; $phrase->text = _SEARCH_ANYWORDS; $searchphrases[] = $phrase; $phrase = new stdClass(); $phrase->value = 'all'; $phrase->text = _SEARCH_ALLWORDS; $searchphrases[] = $phrase; $phrase = new stdClass(); $phrase->value = 'exact'; $phrase->text = _SEARCH_PHRASE; $searchphrases[] = $phrase; $lists['searchphrase']= mosHTML::radioList( $searchphrases, 'searchphrase', '', $searchphrase ); $image_url = $mosConfig_live_site."/home/vas/www/components/com_cb_search/images/search.gif"; $tabs = new mosTabs(0); $tabs->startPane("searchPane"); if ( $cbsa_allow_search_1 ){ $tabs->startTab(_CB_AS_SHOW_SIMPLE,"simple-page"); $tmpl->addVar('search_1', 'cb_as_search_title_1', _CB_AS_SEARCH_TITLE_1 ); $tmpl->addVar('search_1', 'option', $option ); $tmpl->addVar('search_1', 'url', ampReplace(sefRelToAbs("index.php?option=".$option.$option_itemid)) ); $tmpl->addVar('search_1', 'cb_as_search_gif', $image_url ); $tmpl->addVar('search_1', 'cb_as_button', _CB_AS_BUTTON ); $tmpl->addVar('search_1', 'prompt_keyword', _CB_AS_ALL_FIELDS ); $tmpl->addVar('search_1', 'list', $lists['searchphrase'] ); $tmpl->displayParsedTemplate('search_1'); $tabs->endTab(); } //$tmpl->displayParsedTemplate('search_1_footer'); if ( $cbsa_allow_search_2 ){ $tabs->startTab(_CB_AS_SHOW_ADVANCED,"advanced-page"); $tmpl->addVar('search_2', 'url', ampReplace(sefRelToAbs("index.php?option=".$option.$option_itemid)) ); $tmpl->addVar('search_2', 'cb_as_search_title_2', _CB_AS_SEARCH_TITLE_2 ); $tmpl->displayParsedTemplate('search_2'); $pfields=''; $title=''; $searchoperators=''; $searchoperators2=''; for($i=0, $n=count( $rowFields ); $i < $n; $i++) { $colspan = 3; $pfields=''; if($rowFields[$i]->type=='delimiter') { $tmpl->addVar('search_2_delimiter', 'colspan', $colspan ); $tmpl->addVar('search_2_delimiter', 'title', unHtmlspecialchars(getLangDefinition($rowFields[$i]->title)) ); $tmpl->displayParsedTemplate('search_2_delimiter'); } else { if(getLangDefinition($rowFields[$i]->title)!="") { $title = getLangDefinition($rowFields[$i]->title); $colspan=1; } if($regErrorMSG!==null && isset($_POST[$rowFields[$i]->name])) { if (!is_array($_POST[$rowFields[$i]->name])) $oValue = htmlentities($_POST[$rowFields[$i]->name]); if($rowFields[$i]->type=='date') $oValue=dateConverter($oValue,$ueConfig['date_format'],'Y-m-d'); if($rowFields[$i]->type=='webaddress' && $rowFields[$i]->rows==2) $oValue=$oValue."|*|".$_POST[$rowFields[$i]->name."Text"]; } else $oValue = ""; if(!ISSET($rowFields[$i]->id)) $rowFields[$i]->id=""; if(!ISSET($rowFieldValues['lst_'.$rowFields[$i]->name])) $rowFieldValues['lst_'.$rowFields[$i]->name]=""; if ($rowFields[$i]->type=='multicheckbox' || $rowFields[$i]->type=='multiselect' || $rowFields[$i]->type=='radio'){ $pfields = "<input readonly type=\"hidden\" name=\"".$rowFields[$i]->name."[]\" value=\"no_check\" checked />"; } $pfields .= cb_as::getFieldEntry(1,$calendars,$rowFields[$i]->type,$rowFields[$i]->name,$rowFields[$i]->description,$rowFields[$i]->title,$oValue,$rowFields[$i]->required,$rowFields[$i]->title,$rowFields[$i]->id,$rowFields[$i]->size, $rowFields[$i]->maxlength, $rowFields[$i]->cols, $rowFields[$i]->rows,$rowFields[$i]->profile,$rowFieldValues['lst_'.$rowFields[$i]->name],$rowFields[$i]->readonly); } //we get the default value for the searchoperator switch ($cbsa_logical_default){ case "0": $logical_default = "="; break; case "1": $logical_default = "AND"; break; case "2": $logical_default = "OR"; break; case "3": $logical_default = "NOT"; break; default: $logical_default = "AND"; break; } $searchoperator = mosGetParam( $_REQUEST, 'searchoperator', $logical_default ); $searchoperators = array(); $search_op_count = 0; $search_op_count2 = $cbsa_logical_equal + $cbsa_logical_and + $cbsa_logical_or + $cbsa_logical_not; $op_tag_attribs= ''; $op_hidden = ''; if ($cbsa_logical_equal==1){ $operator = new stdClass(); $operator->value = '='; $operator->text = _CB_AS_OPERATORS_EQUAL; $searchoperators[] = $operator; $search_op_count++; $op_hidden = "radio"; } if ($cbsa_logical_and==1){ $operator = new stdClass(); $operator->value = 'AND'; $operator->text = _CB_AS_OPERATORS_AND; $searchoperators[] = $operator; $search_op_count++; $op_hidden = "radio"; } if ($cbsa_logical_or==1){ $operator = new stdClass(); $operator->value = 'OR'; $operator->text = _CB_AS_OPERATORS_OR; $searchoperators[] = $operator; $search_op_count++; $op_hidden = "radio"; } if ($cbsa_logical_not==1){ $operator = new stdClass(); $operator->value = 'NOT'; $operator->text = _CB_AS_OPERATORS_NOT; $searchoperators[] = $operator; $search_op_count++; $op_hidden = "radio"; } if ($search_op_count==0){ $operator = new stdClass(); $operator->value = 'AND'; $operator->text = _CB_AS_OPERATORS_AND; $searchoperators[] = $operator; $searchoperator = "AND"; $op_tag_attribs = 'readonly checked'; $op_hidden = "hidden"; } elseif ( $search_op_count==1 && $search_op_count2 == 1 ){ $op_hidden = "hidden"; } $lists['searchoperator']= cb_as::radioList( $searchoperators, 'searchoperator'.$i, $op_tag_attribs, $searchoperator, $op_hidden ); $tmpl->addVar('search_2_list', 'title', $title ); $tmpl->addVar('search_2_list', 'colspan', $colspan ); $tmpl->addVar('search_2_list', 'field', $pfields); $tmpl->addVar('search_2_list', 'operators', $lists['searchoperator'] ); $tmpl->displayParsedTemplate('search_2_list'); $tmpl->clearTemplate('search_2_list'); } //Age Search -- START if($cbsa_enable_age_search) { $tmpl->addVar('search_2_ageint','title',_CB_AS_AGE); $tmpl->addVar('search_2_ageint','to',_CB_AS_TOAGE); //create the select list $ages = array(); $j = $cbsa_lower_age_limit; for($i=0; $j < ($cbsa_upper_age_limit+1); $i++) { $age = new StdClass(); $age->value = $j; $age->text = $j; $j++; $ages[] = $age; } $startAge = mosGetParam($_REQUEST,'startage',$cbsa_lower_age_limit); $endAge = mosGetParam($_REQUEST,'endage',$cbsa_upper_age_limit); $selStartAge = mosHTML::selectList($ages,'startage','','value','text',$startAge); $selEndAge = mosHTML::selectList($ages,'endage','','value','text',$endAge); $tmpl->addVar('search_2_ageint','field1',$selStartAge); $tmpl->addVar('search_2_ageint','field2',$selEndAge); $tmpl->displayParsedTemplate('search_2_ageint'); } //Age Search -- END //Photo only --START if($cbsa_enable_photo_only_search) { $photoonly = intval(mosGetParam($_REQUEST,'photoonly',0)); $cb_sa_photo_only = mosHTML::yesnoRadioList('photoonly','',$photoonly); $tmpl->addVar('search_2_photoonly','title',_CB_AS_EXTRA_FILTER); $tmpl->addVar('search_2_photoonly','cb_as_photo_only',_CB_AS_PHOTO_ONLY); $tmpl->addVar('search_2_photoonly','checked',($photoonly ? ' checked' : '')); $tmpl->displayParsedTemplate('search_2_photoonly'); } $tmpl->addVar('search_2_list_footer', 'cb_as_search_gif', $image_url ); $tmpl->addVar('search_2_list_footer', 'option', $option ); $tmpl->addVar('search_2_list_footer', 'cb_as_button', _CB_AS_BUTTON ); $tmpl->displayParsedTemplate('search_2_list_footer'); $tabs->endTab(); } if($cbsa_allow_adv_search){ $tabs->startTab(_CB_AS_SHOW_ADVANCED2,"advanced2-page"); $cb_sa_adv_url = sefRelToAbs( "index.php?option=com_cb_search&task=advanced&Itemid=$Itemid"); $cb_sa_adv_url = ampReplace($cb_sa_adv_url); $tmpl->addVar('allow', 'allow_url', $cb_sa_adv_url ); $tmpl->addVar('allow', 'allow_text', _CB_AS_ALLOW_ADV_USER ); $tmpl->addVar('allow', 'cb_as_search_title_3', _CB_AS_SEARCH_TITLE_3 ); $tmpl->displayParsedTemplate('allow'); $tabs->endTab(); } $tmpl->addVar('footer', 'option', $option ); $tmpl->addVar('footer', 'cb_as_button', _CB_AS_BUTTON ); //$tmpl->displayParsedTemplate('footer'); $tabs->endPane(); //End of Function } function advanced($option, $rowFields, $rowFieldValues, $regErrorMSG){ global $mosConfig_absolute_path, $mosConfig_live_site, $Itemid; require ($mosConfig_absolute_path."/home/vas/www/administrator/components/com_cb_search/cb_search.config.php"); echo cb_as::cbCalendars(2); ?> <form action="<?php echo ampReplace(sefRelToAbs("index.php")); ?>" method="post" id="adminForm" name="adminForm"> <table cellpadding="5" cellspacing="0" border="0" width="98%" class="contentpane" id="registrationTable"> <?php if ( $cbsa_show_title ) { ?> <tr> <td colspan="3" width="100%" class="componentheading"><?php echo _CB_AS_TITLE; ?></td> </tr> <?php } $pfields=''; $searchoperators=''; $searchoperators2=''; for($i=0, $n=count( $rowFields ); $i < $n; $i++) { //echo "Anzahl Felder:".count($rowFields).":".$rowFields[$i]->type.":".$rowFields[$i]->name.":".$rowFields[$i]->description."<br>"; //echo "Anzahl Werte:".count($rowFieldValues).":"."<br>"; $pfields .= "\t\t<tr>\n"; $colspan = 5; if($rowFields[$i]->type=='delimiter') { $pfields .= "\t\t\t<td colspan=\"".$colspan."\" class=\"delimiterCell\">". unHtmlspecialchars(getLangDefinition($rowFields[$i]->title)) ."</td>\n"; if ($rowFields[$i]->description) $pfields .= "\t\t\t</tr><tr><td colspan=\"".$colspan."\" class=\"descriptionCell\">". unHtmlspecialchars(getLangDefinition($rowFields[$i]->description)) ."</td>\n"; } else { if(getLangDefinition($rowFields[$i]->title)!="") { $pfields .= "\t\t\t<td align=\"right\">" . cb_as::operator2($i, 2) . "</td>"; $pfields .= "\t\t\t<td align=\"right\">" . getLangDefinition($rowFields[$i]->title) . ":</td>"; $colspan=1; } if($regErrorMSG!==null && isset($_POST[$rowFields[$i]->name])) { if (!is_array($_POST[$rowFields[$i]->name])) $oValue = htmlentities($_POST[$rowFields[$i]->name]); if($rowFields[$i]->type=='date') $oValue=dateConverter($oValue,$ueConfig['date_format'],'Y-m-d'); if($rowFields[$i]->type=='webaddress' && $rowFields[$i]->rows==2) $oValue=$oValue."|*|".$_POST[$rowFields[$i]->name."Text"]; } else $oValue = ""; if(!ISSET($rowFields[$i]->id)) $rowFields[$i]->id=""; if(!ISSET($rowFieldValues['lst_'.$rowFields[$i]->name])) $rowFieldValues['lst_'.$rowFields[$i]->name]=""; $pfields .= "\t\t\t<td colspan=\"".$colspan."\" class=\"fieldCell\">" . cb_as::operator2($i, 1) ."</td><td>\n" . cb_as::getFieldEntry(1,$calendars,$rowFields[$i]->type,$rowFields[$i]->name,$rowFields[$i]->description,$rowFields[$i]->title,$oValue,$rowFields[$i]->required,$rowFields[$i]->title,$rowFields[$i]->id,$rowFields[$i]->size, $rowFields[$i]->maxlength, $rowFields[$i]->cols, $rowFields[$i]->rows,$rowFields[$i]->profile,$rowFieldValues['lst_'.$rowFields[$i]->name],$rowFields[$i]->readonly); if ($rowFields[$i]->type=='multicheckbox' || $rowFields[$i]->type=='multiselect' || $rowFields[$i]->type=='radio'){ $pfields .= "<input readonly type=\"hidden\" name=\"".$rowFields[$i]->name."[]\" value=\"no_check\" checked />"; } $pfields .= "</td>\n"; } $pfields .= "\t\t</tr>\n"; } print $pfields; ?> <tr> <td colspan="3"> <?php echo cb_as::operator2($i, 2); ?> </td> </tr> <tr> <td colspan="2"> <input type="hidden" name="id" value="0" /> <input type="hidden" name="gid" value="0" /> <input type="hidden" name="option" value="<?php echo $option; ?>" /> <input type="hidden" name="task" value="advancedsearch" /> <input type="submit" value="<?php echo _CB_AS_BUTTON; ?>" class="button" /> </td> </tr> </table> </form> <?php //End of Function } function usersList($row,$lfields,$lists,$listid, $search_sql, $where, $whattitle){ global $database,$limitstart,$search,$mosConfig_absolute_path, $mosConfig_sitename,$ueConfig,$_POST,$acl,$_REQUEST, $Itemid; global $mosConfig_live_site; //$search_sql = cbEscapeSQLsearch(cbGetEscaped(trim( strtolower( $search_sql)))); $search_sql = cb_as::correct_search($search_sql); $where = "cb_as::correct_search($where)"; $Itemid = mosGetParam( $_REQUEST, 'Itemid', '' ); $limitstart = mosGetParam( $_REQUEST, 'limitstart', $limitstart ); //$option_itemid = "&Itemid=".$Itemid; $option_itemid = (isset($_REQUEST['Itemid'])) ? "&Itemid=".htmlspecialchars($_REQUEST['Itemid']) : cb_as::getCBprofileItemid(true); $ue_base_url = "index.php?option=com_comprofiler&task=usersList&listid=".$listid.$option_itemid; // Base URL string //$ue_base_url = "index.php?option=com_cb_search&task=usersList&listid=".$listid.$option_itemid; // Base URL string $adminimagesdir = "/home/vas/www/components/com_comprofiler/images/"; require ($mosConfig_absolute_path."/administrator/components/com_cb_search/cb_search.config.php"); $allusergids=array(); $usergids=explode(",",$row->usergroupids); foreach($usergids AS $usergid) { $allusergids[]=$usergid; if ($usergid==29 || $usergid==30) { $groupchildren = array(); $groupchildren = $acl->get_group_children( $usergid, 'ARO','RECURSE' ); $allusergids = array_merge($allusergids,$groupchildren); } } $usergids=implode(",",$allusergids); // Total $database->setQuery("SELECT count(u.id) FROM #__users u, #__comprofiler ue WHERE u.id=ue.id AND u.block !=1 AND ue.approved=1 AND ue.banned=0 AND ue.confirmed=1 AND u.gid IN (".$usergids.")"); $total_results = $database->loadResult(); // Select query if($row->sortfields!='') $orderby = " ORDER BY ".$row->sortfields; $filterby=""; if($row->filterfields!='') $filterby = " AND ".utf8RawUrlDecode(substr($row->filterfields,1)); // Search total $query = "SELECT count(u.id) FROM #__users u, #__comprofiler ue WHERE u.id=ue.id AND u.block !=1 AND ue.approved=1 AND ue.banned=0 AND ue.confirmed=1 AND u.gid IN (".$usergids.")"; $query .= $where; $query .= " ".$filterby; if(!$database->setQuery($query)) print $database->getErrorMsg(); $total = $database->loadResult(); if (empty($limitstart)) $limitstart = 0; $limit = $ueConfig['num_per_page']; if ($limit > $total) { $limitstart = 0; } $query = "SELECT *, '' AS 'NA' FROM #__users u, #__comprofiler ue WHERE u.id=ue.id AND u.block!=1 and ue.approved=1 AND ue.banned=0 AND ue.confirmed=1 AND u.gid IN (".$usergids.")"; //$query .= $query2; $query .= $where; $query .= " ".$filterby; $query .= " ".$orderby; $query .= " LIMIT $limitstart, $limit"; //echo $query; $cb_sa_base_url = sefRelToAbs("index.php?option=com_cb_search&task=advancedsearch&listid=".$listid.$option_itemid); $cb_sa_base_url = ampReplace($cb_sa_base_url); $database->setQuery($query); //We check the query worked if ($cbsa_show_sql_error) { if (!$database->query()) { echo "<script>alert('".$database->getErrorMsg()."'); window.history.go(-1);</script>\n"; exit; } } $users=$database->loadObjectList(); //Calculate the Total $query_total = "SELECT *, '' AS 'NA' FROM #__users u, #__comprofiler ue WHERE u.id=ue.id AND u.block!=1 and ue.approved=1 AND ue.banned=0 AND ue.confirmed=1 AND u.gid IN (".$usergids.")"; $query_total .= $where; $query_total .= " ".$filterby; $query_total .= " ".$orderby; $database->setQuery( $query_total ); $total_count =$database->loadObjectList(); $results_found = count( $total_count ); ?> <table width="100%" cellpadding="4" cellspacing="0" border="0" align="center" class="contentpane"> <tr> <td colspan="2"><span class="contentheading"><?php if ($whattitle == 0){ echo _CB_AS_SEARCH_RESULTS; } else { echo getLangDefinition($row->title);; } ?></span></td> </tr> <tr> <td valign="top" class="contentdescription" colspan="2"> <?php echo $mosConfig_sitename . " " . _UE_HAS . ": <b>" . $total_results . "</b> " . _UE_USERS; ?> </td> </tr> <?php if ($whattitle == 0 ){ ?> <tr> <td valign="top" class="contentdescription"> <?php echo _CB_AS_RESULTS_FOUND . ": <b>" . $results_found . "</b> "; ?> </td> <form name="adminForm" method="post" action="<?php echo ampReplace(sefRelToAbs($ue_base_url));?>" > <td valign = "right"><?php echo $lists['plists']; ?> </td> </form> </tr> <?php } else { ?> <tr> <form name="adminForm" method="post" action="<?php echo ampReplace(sefRelToAbs($ue_base_url));?>" > <td style="width:100%;text-align:right;"><?php echo $lists['plists']; ?> </td> </form> </tr> <?php } ?> <tr> <td colspan="2"> <a href="<?php echo ampReplace(sefRelToAbs("index.php?option=com_cb_search&task=simple&Itemid=$Itemid")); ?>"><?php echo _CB_AS_TITLE; ?></a> </td> </tr> <tr> <td colspan="2"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><a href="<?php echo ampReplace(sefRelToAbs($ue_base_url)); ?>" onclick="javascript:adminForm.search.value=''"><?php echo _UE_LIST_ALL; ?></a></td> <td align="right"></td> </tr> </table> <?php if ($cbsa_page_nav == 0 || $cbsa_page_nav == 2){ if ($results_found > $limit){ ?> <div style="width:100%;text-align:center;"><?php echo cb_as::writePagesLinks($limitstart, $limit, $total, $cb_sa_base_url,$where); ?></div> <hr noshade="noshade" size="1" /> <?php } } ?> <script src="<?php echo $mosConfig_live_site; ?>/home/vas/www/components/com_cb_search/js/sorttable.js"></script> <table class="sortable" id="t1" width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <?php echo "<th><b>".getLangDefinition($row->col1title)."</b></th>\n"; if ($row->col2enabled) echo "<th><b>".getLangDefinition($row->col2title)."</b></th>\n"; if ($row->col3enabled) echo "<th><b>".getLangDefinition($row->col3title)."</b></th>\n"; if ($row->col4enabled) echo "<th><b>".getLangDefinition($row->col4title)."</b></th>\n"; ?> </tr> <?php $i = 1; foreach($users as $user) { $evenodd = $i % 2; if ($evenodd == 0) { $class = "sectiontableentry1"; } else { $class = "sectiontableentry2"; } //print $user->name; if($ueConfig['allow_profilelink']==1) { $onclick = "onclick=\"javascript:window.location='".ampReplace(sefRelToAbs("index.php?option=com_comprofiler&task=userProfile&user=".$user->id))."'\""; $style="style=\"cursor:hand;cursor:pointer;\""; } print "\t<tr class=\"$class\" ".$style." ".$onclick.">\n"; //print $lfields; $str = null; eval("\$str = \"$lfields\";"); echo $str. "\n"; print "\t</tr>\n"; $i++; } ?> </table> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> </td> <td align="right"></td> </tr> </table> <?php if ($cbsa_page_nav == 1 || $cbsa_page_nav == 2){ if ($results_found > $limit){ ?> <hr noshade="noshade" size="1" /> <div style="width:100%;text-align:center;"><?php echo cb_as::writePagesLinks($limitstart, $limit, $total, $cb_sa_base_url, $where ); ?></div> <?php } } ?> </td> </tr> </table> <?php } // End of Class } ?>
dan_hak Пожалуйста, когда выкладываете такие куски кода, заключайте их в тег PHP, блин! Для подсветки и удобочитаемости. Спасибо.
Подскажите плиз новичку Код PHP: <?php $label = array("Домой", "Полезные ссылки", "Пользователи", "Обратная связь"); foreach($label as $text) { print("<a href=\"$SERVER['PHP_SELF']}\">"); // (это 76 строка) print("<img src=\"button.php"); print("?label=" . htmlenttities($text)); print("&width=145"); print("&height=25"); print("\" border=\"0\""); print("width=\"145\" height=\"25\">"); print("</a><br>\n"); } ?> выдает Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in Z:\home\192.168.1.1\www\index.php on line 76
А не лучше ли так: PHP: <?php $label = array("Домой", "Полезные ссылки", "Пользователи", "Обратная связь"); foreach($label as $text) { ?> <a href="?"> <img src="button.php?label=<? echo htmlentities($text); ?>&width=145&height=25" border="0" width="145" height="25"> </a><br> <?php } ?>
Кто-то людей напугал, что оператор не может выводить строки, длиннее 20 символов. Наверное, учительница в школе по бейсику.
Никто не пугал - набирал листинг с книги РНР5 Библиотека профессинала, Аткинсона и Сураски. Получается, это их учительница напугала бейсиком???
Вполне возможно. Если не ошибаюсь, то в каких-то древних языках было ограничение. А потом это просто вошло в привычку. А программисты имеют склонность навязывать свой образ программирования.
у меня возникла ошибка Parse error: parse error, unexpected T_STRING, expecting T_VARIABLE or '$' in T:\home\users\test\nawigacion.php on line 7 в коде 1<table class="npanel"> 2 <?php 3 @ $o=fopen('nawigacion.txt','rb'); 4 if(!$o) 5 {echo '<h1>фаил пуст</h1>'; 6 exit; 7 } 8 $tamer =1; 9 while(!feof($o)){ 10 $name=fgets($o,999); 11 echo "<tr> \n <td> \n"; 12 echo "<a href='HOME".$i."\.php' class='npanel'>"; 13 echo "</td> \n </tr> \n" 14 $tamer++; 15 } 16 fclose($o); 17 ?> 18</table> ПОМОГИТЕ ПОЖАЛУСТА!!! :cry: