[ define @ 23.03.2005. 15:16 ] @
Ovako, nesto experimentisem i eto kao radio neku scriptu za ubacivanje linkova. napravio sam stranicu gde mozete editovati neki post, medjutim javlja se greska kada ga pokrenem. Ovako izgleda strana gde se ispisuju svi linkovi i do njih pise edit i delete ako kliknem edit ono predje u stranicu za unosenje vrednosti i popuni vrednosti onog linka ciji je ID u ovom slucaju row Code: $conn=db_connect(); $sql="select * from linkovi order by id desc"; $result=mysql_query($sql); print '<table>'; while($row=mysql_fetch_array($result)){ print '<tr><td style="border:1px dotted silver">'; print '[<a href="'.$row['adress'].'">'.$row['adress'].'</a>]'; print '</td>'; print '<td>'; print $row['about']; print '</td><td>'; print '[<a href="dellink.php?row='.$row['id'].'">brisi</a>]'; print '</td><td>'; print '[<a href="unesi.php?row='.$row['id'].'">edit</a>]'; print '</td></tr>'; } echo '</table>'; kada editujem kako hocu kliknem na unos i ono prebaci na sledecu stranu Code: $adresa=addslashes($adresa); $title=addslashes($title); $about=addslashes($about); $category=addslashes($category); $conn=db_connect(); if(!$conn) { echo 'Greskica'; } if (isset($HTTP_POST_VARS['row']) && $HTTP_POST_VARS['row']!='') { // It's an update $row = $HTTP_POST_VARS['row']; $sql = "update linkovi set title = '$title', adress = '$adresa', about = '$about', category = '$category', where id = '$row'"; } else { // It's a new story $sql="insert into linkovi (title, adress, about, category) values ('".$title."','".$adresa."','".$about."','".$category."')"; } $result = mysql_query($sql, $conn); if (!$result) { print "There was a database error when executing <pre>$sql</pre>"; print mysql_error(); exit; } Ukoliko vidi da je postojeci id onda samo updatuje taj unos, a ako vidi da ga nema onda upise novu. E sada sve je to teoretski tacno medjutim javlja mi se ovo Code: There was a database error when executing update linkovi set title = 'Auto Pijac', adress = 'http://www.autopijac.com', about = 'Auto Pijacasc', category = 'Politicki', where id = '20' You have an error in your SQL syntax near 'where id = '20'' at line 6 U cemu je problem |