Къде бъркам

federer_11

Registered
Ето кода на файла groups.php:

Код:
<?php
session_start();
db_init();
include '../functions.php';
my_admin_header ("Администрация - Групи форуми");
if($_POST['ng']==1)

{
$name=addslashes(trim($_POST['group_name']));
$desc=addslashes(trim($_POST['description']));
$rs=mysql_query('SELECT * FROM group_cat WHERE name="' .$name.'"');
	if(mysql_numrows($rs)>0);
			{
			if($_POST['edit_id']>0)
			{
			mysql_query('UPDATE group_cat SET name="' .$name. ', desc="' .$desc. '" WHERE group_cat_id=' .$id);
			echo '<h2>Успешна промяна</h2>';
			}
			else
			{
			mysql_query('INSERT INTO group_cat (name,date_added,desc)
			VALUES("' .$name. '",' .time(). ', "' .$desc. '") ');
			echo '<h2>Успешен запис</h2>';
			}
			
			}
			else
			{
			echo '<h2>Името вече съществува</h2>';
			}
}

$rs=mysql_query('SELECT * FROM group_cat');
echo '<table border="1" bordercolor="red" />
<tr><td>Име</td><td>Описание</td></tr>';

while(row=mysql_fetch_assoc($rs))

{
<tr><td> '.$row['name'].' </td><td> '.$row['desc'].' </td></tr>
<td><a href="groups.php?mode=edit&id=' .$row['group_cat_id']. '">Редактирай</a></td></tr>
}

echo '</table';
if($_GET['mode']=="edit" && $_GET['id']>0)

{
$id=(int)$_GET['id'];
$rs=mysql_query('SELECT * GROM group_cat WHERE group_cat_id=' .$id);
$ed_info=mysql_fetch_assoc($rs);
}

echo '
<form method="post" action="groups.php" />
<input type="text" name="group_name" value="' .$ed_info['name']. '" /><br />
<input type="text" name="desc" value ="' .$ed_info['desc']. '" /><br />
<input type="submit" value="Запиши" /><br />
<input type="hidden" name="ng" value="1" /><br />';

if($_GET['mode']=="edit")

{
echo '<input type="hidden" name="edit_id" value="' .$_GET['id']. '">';
}

echo '</form>';
footer();
?>

Дава ми parse error, но не можах да я открия:

Parse error: parse error in D:\wamp\www\forum\admin\groups.php on line 27
+1 за този който ми помогне :cry:
 
Я пробвай така

<?php
session_start();
db_init();
include '../functions.php';
my_admin_header ("Администрация - Групи форуми");
if($_POST['ng']==1)

{
$name=addslashes(trim($_POST['group_name']));
$desc=addslashes(trim($_POST['description']));
$rs=mysql_query('SELECT * FROM group_cat WHERE name="' .$name.'"');
if(mysql_numrows($rs)>0);
{
if($_POST['edit_id']>0)
{
mysql_query('UPDATE group_cat SET name="' .$name. ', desc="' .$desc. '" WHERE group_cat_id=' .$id);
echo '<h2>Успешна промяна</h2>';
}
else
{
mysql_query('INSERT INTO group_cat (name,date_added,desc)
VALUES("' .$name. '",' .time(). ', "' .$desc. '") ');
echo '<h2>Успешен запис</h2>';
}

}
else
{
echo '<h2>Името вече съществува</h2>';
}
}

$rs=mysql_query('SELECT * FROM group_cat');
echo '<table border="1" bordercolor="red" />'
<tr><td>Име</td><td>Описание</td></tr>';

while(row=mysql_fetch_assoc($rs))

{
<tr><td> '.$row['name'].' </td><td> '.$row['desc'].' </td></tr>
<td><a href="groups.php?mode=edit&id=' .$row['group_cat_id']. '">Редактирай</a></td></tr>
}

echo '</table';
if($_GET['mode']=="edit" && $_GET['id']>0)

{
$id=(int)$_GET['id'];
$rs=mysql_query('SELECT * GROM group_cat WHERE group_cat_id=' .$id);
$ed_info=mysql_fetch_assoc($rs);
}

echo '
<form method="post" action="groups.php" />
<input type="text" name="group_name" value="' .$ed_info['name']. '" /><br />
<input type="text" name="desc" value ="' .$ed_info['desc']. '" /><br />
<input type="submit" value="Запиши" /><br />
<input type="hidden" name="ng" value="1" /><br />';

if($_GET['mode']=="edit")

{
echo '<input type="hidden" name="edit_id" value="' .$_GET['id']. '">';
}

echo '</form>';
footer();
?>
 
Така ?

Код:
 <?php
session_start();
db_init();
include '../functions.php';
my_admin_header ("Администрация - Групи форуми");
if($_POST['ng']==1)

{
$name=addslashes(trim($_POST['group_name']));
$desc=addslashes(trim($_POST['description']));
$rs=mysql_query('SELECT * FROM group_cat WHERE name="' .$name.'"');
   if(mysql_numrows($rs)>0);
         {
         if($_POST['edit_id']>0)
         {
         mysql_query('UPDATE group_cat SET name="' .$name. ', desc="' .$desc. '" WHERE group_cat_id=' .$id);
         echo '<h2>Успешна промяна</h2>';
         }
         else
         {
         mysql_query('INSERT INTO group_cat (name,date_added,desc)
         VALUES("' .$name. '",' .time(). ', "' .$desc. '") ');
         echo '<h2>Успешен запис</h2>';
         }
         
         }
         elseif
         {
         echo '<h2>Името вече съществува</h2>';
         }
}

$rs=mysql_query('SELECT * FROM group_cat');
echo '<table border="1" bordercolor="red" />
<tr><td>Име</td><td>Описание</td></tr>';

while(row=mysql_fetch_assoc($rs))

{
<tr><td> '.$row['name'].' </td><td> '.$row['desc'].' </td></tr>
<td><a href="groups.php?mode=edit&id=' .$row['group_cat_id']. '">Редактирай</a></td></tr>
}

echo '</table';
if($_GET['mode']=="edit" && $_GET['id']>0)

{
$id=(int)$_GET['id'];
$rs=mysql_query('SELECT * GROM group_cat WHERE group_cat_id=' .$id);
$ed_info=mysql_fetch_assoc($rs);
}

echo '
<form method="post" action="groups.php" />
<input type="text" name="group_name" value="' .$ed_info['name']. '" /><br />
<input type="text" name="desc" value ="' .$ed_info['desc']. '" /><br />
<input type="submit" value="Запиши" /><br />
<input type="hidden" name="ng" value="1" /><br />';

if($_GET['mode']=="edit")

{
echo '<input type="hidden" name="edit_id" value="' .$_GET['id']. '">';
}

echo '</form>';
footer();
?>
 
Така
Код:
 <?php
session_start();
db_init();
include '../functions.php';
my_admin_header ("Администрация - Групи форуми");
if($_POST['ng']==1)

{
$name=addslashes(trim($_POST['group_name']));
$desc=addslashes(trim($_POST['description']));
$rs=mysql_query('SELECT * FROM group_cat WHERE name="' .$name.'"');
   if(mysql_numrows($rs)>0);
         {
         if($_POST['edit_id']>0)
         {
         mysql_query('UPDATE group_cat SET name="' .$name. ', desc="' .$desc. '" WHERE group_cat_id=' .$id);
         echo '<h2>Успешна промяна</h2>';
         }
         else
         {
         mysql_query('INSERT INTO group_cat (name,date_added,desc)
         VALUES("' .$name. '",' .time(). ', "' .$desc. '") ');
         echo '<h2>Успешен запис</h2>';
         }
         
         
         else
         {
         echo '<h2>Името вече съществува</h2>';
         }
		 }
}

$rs=mysql_query('SELECT * FROM group_cat');
echo '<table border="1" bordercolor="red" />
<tr><td>Име</td><td>Описание</td></tr>';

while(row=mysql_fetch_assoc($rs))

{
<tr><td> '.$row['name'].' </td><td> '.$row['desc'].' </td></tr>
<td><a href="groups.php?mode=edit&id=' .$row['group_cat_id']. '">Редактирай</a></td></tr>
}

echo '</table';
if($_GET['mode']=="edit" && $_GET['id']>0)

{
$id=(int)$_GET['id'];
$rs=mysql_query('SELECT * GROM group_cat WHERE group_cat_id=' .$id);
$ed_info=mysql_fetch_assoc($rs);
}

echo '
<form method="post" action="groups.php" />
<input type="text" name="group_name" value="' .$ed_info['name']. '" /><br />
<input type="text" name="desc" value ="' .$ed_info['desc']. '" /><br />
<input type="submit" value="Запиши" /><br />
<input type="hidden" name="ng" value="1" /><br />';

if($_GET['mode']=="edit")

{
echo '<input type="hidden" name="edit_id" value="' .$_GET['id']. '">';
}

echo '</form>';
footer();
?>
 
Код:
<?php
session_start();
db_init();
include '../functions.php';
my_admin_header ("Администрация - Групи форуми");
if($_POST['ng']==1)

{
$name=addslashes(trim($_POST['group_name']));
$desc=addslashes(trim($_POST['description']));
$rs=mysql_query('SELECT * FROM group_cat WHERE name="' .$name.'"');
   if(mysql_numrows($rs)>0);
         {
         if($_POST['edit_id']>0)
         {
         mysql_query('UPDATE group_cat SET name="' .$name. ', desc="' .$desc. '" WHERE group_cat_id=' .$id);
         echo '<h2>Успешна промяна</h2>';
         }
         elseif
         {
         mysql_query('INSERT INTO group_cat (name,date_added,desc)
         VALUES("' .$name. '",' .time(). ', "' .$desc. '") ');
         echo '<h2>Успешен запис</h2>';
         }

         }else{
         echo '<h2>Името вече съществува</h2>';
         }
}

$rs=mysql_query('SELECT * FROM group_cat');
echo '<table border="1" bordercolor="red" />
<tr><td>Име</td><td>Описание</td></tr>';

while(row=mysql_fetch_assoc($rs))

{
<tr><td> '.$row['name'].' </td><td> '.$row['desc'].' </td></tr>
<td><a href="groups.php?mode=edit&id=' .$row['group_cat_id']. '">Редактирай</a></td></tr>
}

echo '</table';
if($_GET['mode']=="edit" && $_GET['id']>0)

{
$id=(int)$_GET['id'];
$rs=mysql_query('SELECT * GROM group_cat WHERE group_cat_id=' .$id);
$ed_info=mysql_fetch_assoc($rs);
}

echo '
<form method="post" action="groups.php" />
<input type="text" name="group_name" value="' .$ed_info['name']. '" /><br />
<input type="text" name="desc" value ="' .$ed_info['desc']. '" /><br />
<input type="submit" value="Запиши" /><br />
<input type="hidden" name="ng" value="1" /><br />';

if($_GET['mode']=="edit")

{
echo '<input type="hidden" name="edit_id" value="' .$_GET['id']. '">';
}

echo '</form>';
footer();
?>
?
 
Код:
<?php
session_start();
db_init();
include '../functions.php';
my_admin_header ("Администрация - Групи форуми");
if($_POST['ng']==1)

{
$name=addslashes(trim($_POST['group_name']));
$desc=addslashes(trim($_POST['description']));
$rs=mysql_query("SELECT * FROM group_cat WHERE name='$name'");
   if(mysql_numrows($rs)>0);
         {
         if($_POST['edit_id']>0)
         {
         mysql_query("UPDATE group_cat SET name='$name', desc='$desc' WHERE group_cat_id='$id'");
         echo '<h2>Успешна промяна</h2>';
         }
         else
         {
         mysql_query("INSERT INTO group_cat (name,date_added,desc)
         VALUES('$name','" . time() . "', '$desc') ");
         echo '<h2>Успешен запис</h2>';
         }
         
         }
         else
         {
         echo '<h2>Името вече съществува</h2>';
         }
}

$rs=mysql_query("SELECT * FROM group_cat");
echo '<table border="1" bordercolor="red" />
<tr><td>Име</td><td>Описание</td></tr>';

while(row=mysql_fetch_assoc($rs))

{
echo "
<tr><td> $row['name'] </td><td> $row['desc'] </td></tr>
<td><a href=\"groups.php?mode=edit&id=" . $row['group_cat_id'] . "\">Редактирай</a></td></tr>";
}

echo "</table>";
if($_GET['mode']=="edit" && $_GET['id']>0)

{
$id=(int)$_GET['id'];
$rs=mysql_query("SELECT * GROM group_cat WHERE group_cat_id='$id'");
$ed_info=mysql_fetch_assoc($rs);
}

echo '
<form method="post" action="groups.php" />
<input type="text" name="group_name" value="' .$ed_info['name']. '" /><br />
<input type="text" name="desc" value ="' .$ed_info['desc']. '" /><br />
<input type="submit" value="Запиши" /><br />
<input type="hidden" name="ng" value="1" /><br />';

if($_GET['mode']=="edit")

{
echo "<input type=\"hidden\" name=\"edit_id\" value=\"$_GET['id']\">";
}

echo "</form>";
footer();
?>
 
Не знам, нито един не става, просто не знам от къде излиза тази грешка :cry:
 
Честито, където беше възможно имаше грешка :D
<?php
session_start();
db_init();
include '../functions.php';
my_admin_header ("Администрация - Групи форуми");
if($_POST['ng']==1)

{
$name=addslashes(trim($_POST['group_name']));
$desc=addslashes(trim($_POST['description']));
$rs=mysql_query('SELECT * FROM group_cat WHERE name="' .$name.'"') or die(mysql_error());
if(mysql_numrows($rs)>0)
{
if($_POST['edit_id']>0)
{
mysql_query('UPDATE group_cat SET name="' .$name. ', desc="' .$desc. '" WHERE group_cat_id=' .$id) or die(mysql_error());
echo '<h2>Успешна промяна</h2>';
}
else
{
mysql_query('INSERT INTO group_cat (name,date_added,desc)
VALUES("' .$name. '",' .time(). ', "' .$desc. '") ') or die(mysql_error());
echo '<h2>Успешен запис</h2>';
}

}
else
{
echo '<h2>Името вече съществува</h2>';
}
}

$rs=mysql_query('SELECT * FROM group_cat') or die(mysql_error());
echo '<table border="1" bordercolor="red" />
<tr><td>Име</td><td>Описание</td></tr>';
while($row=mysql_fetch_assoc($rs))
{
echo'
<tr><td> '.$row['name'].' </td><td> '.$row['desc'].' </td></tr>
<td><a href="groups.php?mode=edit&id=' .$row['group_cat_id']. '">Редактирай</a></td></tr>';
}
echo '</table>';
if($_GET['mode']=="edit" && $_GET['id']>0)
{
$id=(int)$_GET['id'];
$rs=mysql_query('SELECT * GROM group_cat WHERE group_cat_id=' .$id) or die(mysql_error());
$ed_info=mysql_fetch_assoc($rs);
}

echo '
<form method="post" action="groups.php" />
<input type="text" name="group_name" value="' .$ed_info['name']. '" /><br />
<input type="text" name="desc" value ="' .$ed_info['desc']. '" /><br />
<input type="submit" value="Запиши" /><br />
<input type="hidden" name="ng" value="1" /><br />';

if($_GET['mode']=="edit")

{
echo '<input type="hidden" name="edit_id" value="' .$_GET['id']. '">';
}

echo '</form>';
footer();
?>
 

Горе