Jump to content
php.lv forumi

nepieciešama palīdzība ar Heredoc


GatisB

Recommended Posts

par Heredoc

http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc

 

visā visumā, izmantoju funkciju

 

print <<<HERE

 

HERE;

 

bet nenostrādā kā vajadzētu

<?
if (!isset($id))

{

$result = mysql_query("SELECT title,id FROM scripts");

$myrow = mysql_fetch_array($result);

do

{

printf ("<p><a href='edit_script.php?id=%s'>%s</a></p>",$myrow["id"],$myrow["title"]);
} 
while ($myrow = mysql_fetch_array($result));      
}
else
{
print <<<HERE
<form name="form1" method="post" action="add_script.php">
          <p>
          <label>Enter script name<br>
          <input type="text" name="title" id="title">
          </label></p>
          <p>
          <label>Enter short description of the script<br>
          <input type="text" name="meta_d" id="meta_d">
          </label>
          </p>
          <p>
          <label>Enter keywords<br>
          <input type="text" name="meta_k" id="meta_k">
          </label>
         </p>
          <p>
          <label>Enter date<br>
          <input name="date" type="text" id="date" value="2009-01-01">
          </label>
        </p>
         <p>
         <label>Enter short description of the script (with tags)
        <textarea name="description" id="description" cols="45" rows="5"></textarea>
        </label>
       </p>
       <p>
      <label>Enter full description of the script (with tags)
      <textarea name="text" id="text" cols="45" rows="20"></textarea>
       </label>
        </p>
         <p>
       <label>Enter Author of the script<br>
      <input name="author" type="text" id="author" value="USA">
       </label>
       </p>
       <p>
      <label>Enter script version<br>
      <input type="text" name="version" id="version">
      </label>
      </p>
      <p>
      <label>Enter script price<br>
      <input type="text" name="price" id="price">
       </label>
      </p>
     <p>
     <label>
      <input type="submit" name="submit" id="submit" value="Add Script">
     </label>
     </p>
    </form>
HERE;

}        
?>

 

respektīvi man izvada sarakstu no DB, bet pēc uzspieshanas uz konkrētā ieraksta, nekas nenotiek, adrese paradas klat ?id=xx un viss, formu neizmet.

 

Var būt tā ka tieši Heredoc ie kautkur jaatkomentē iekš php.ini faila?

Link to comment
Share on other sites

Problēmu atrisināju

pievienoju dokumenta ugšpusē uzreiz pec savienošanās ae DB sekojošu rindu

 

if (isset($_GET['id'])) {$id = $_GET['id'];}

 

nezinu kur īsti bija problēma, bet šādi sanāca, tagad izvada normāli tabulas pēc nospiešanas uz kadu no ierakstiem

 

Bet tas mani gudrāku nepadarīja, līdz arto īsti tāpat problēmu neizpratu

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...