monZy Posted May 8, 2005 Report Share Posted May 8, 2005 (edited) tātad man ar $_GET['virsraksts'] izdod no SQL DB visus rakstu virsrakstus, blakus man ir LABOT , ar echo "<a href='labot.php?action=labot&id=$id'>LABOT</a>"; bet tālāk, bet nelabo neko! a labot.php izkatās: http://paste.php.lv/1935 ! Bet pie katra raksta vish nenorāda kuru id tad sanāk pliks: http://localhost/labot.php?action=labot&id= <- tukshums Bet izmet error : Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in c:\program files\apache group\apache\htdocs\labot.php on line 10 kā lai uztaisa lai varētu normāli izlabot visu! Edited May 8, 2005 by monZy Link to comment Share on other sites More sharing options...
ohmygod Posted May 8, 2005 Report Share Posted May 8, 2005 tev tas id, kam tjip jaaparaadaas pie linka galaa - tiek njemts no GET, netvis no datubāzes!! Panjem no datubaazes un tad stum vinju klaat linkam! A tad tu tjip gribi, lai links gjenereejas jau no taa pasha $GET_[id] (šitas ņem id no linka - piemēram index.php?id=90), nevis no datubāzes! Link to comment Share on other sites More sharing options...
monZy Posted May 8, 2005 Author Report Share Posted May 8, 2005 bet man vaig ka no DB rakstu ID katram virsrakstam piemet klat to ID man ir salikts SORT BY id DESC Link to comment Share on other sites More sharing options...
ohmygod Posted May 8, 2005 Report Share Posted May 8, 2005 (edited) Fuu, bik aatrumaa paarkjeeru pirmiit ;DD bet eniivei tev tas kods ir galiigi liiks. Vien spiemērs - $query="UPDATE * FROM raksts WHERE id='$id'"; ko te dara FROM ?? Es saprotu, ka pie SELECT tas ir vajadziigs, bet nejau pie UPDATE Un labāk selectu būtu organizēt aptuveni šādi: $row=mysql_query("SELECT * FROM tabula WHERE id='$id'") or die(mysql_error()); while($ro=mysql_fetch_array($row)) { echo'<br /><a href="?id='.$ro[id].'">'; } rakstīju ātrumā no galvas - bet nu kaut kā šitā... Edited May 8, 2005 by ohmygod Link to comment Share on other sites More sharing options...
monZy Posted May 8, 2005 Author Report Share Posted May 8, 2005 (edited) nu tas ir mazsvarīgi! nu ok pārlaboju uz: $query = "UPDATE raksti SET virs = '$virs', raksts = '$raksts' WHERE id = '$id'"; šitā labāk :D , a kā <textarea> ieliek value??? Edited May 8, 2005 by monZy Link to comment Share on other sites More sharing options...
hmnc Posted May 8, 2005 Report Share Posted May 8, 2005 (edited) <?php echo '<textarea>'.$value.'</textarea>'; ?> vai <textarea><?=$value;?></textarea> Edited May 8, 2005 by hmnc Link to comment Share on other sites More sharing options...
monZy Posted May 8, 2005 Author Report Share Posted May 8, 2005 ne nu es domāju vnk tāpat kā <input name="bla" value="lol"</input> tip 'ta tikai vai tā var ar textbox? Link to comment Share on other sites More sharing options...
hmnc Posted May 8, 2005 Report Share Posted May 8, 2005 nu jopcik! ja tev saka, ka ir tā tad ir tā un viss! <textarea> jābūt noslēdzošajam tegam (nevis kā input - <input/>) </textarea> respektīvi viss value būs IEKŠ <textarea> tegiem. tieši tāpat kā <div> <a> vai <p> Link to comment Share on other sites More sharing options...
monZy Posted May 8, 2005 Author Report Share Posted May 8, 2005 ir visu uztaisīju, paldies, bet tagad tikai pašā tajā failā kurā rādās virsrakstsi lai pie href vēl id automatiski met klāt, nevis manāli jāvieda! Link to comment Share on other sites More sharing options...
bubu Posted May 9, 2005 Report Share Posted May 9, 2005 tagad tikai pašā tajā failā kurā rādās virsrakstsi lai pie href vēl id automatiski met klāt, nevis manāli jāvieda! Nu a nevar vienkārši izvadot ierakstus, izvadīt to ierakstu id? ar visprastāko echo $result['id']; Link to comment Share on other sites More sharing options...
monZy Posted May 10, 2005 Author Report Share Posted May 10, 2005 echo "<a href='labot.php?action=labot&id=$result['id']'>LABOT</a>"; kur te kļūda???? Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in c:\program files\apache group\apache\htdocs\rakst.php on line 32 Link to comment Share on other sites More sharing options...
bubu Posted May 10, 2005 Report Share Posted May 10, 2005 echo "<a href='labot.php?action=labot&id=$result['id']'>LABOT</a>"; Kā tu domā, kā lai php parseris saprot, ka tu gribi izvadīt $result masīva 'id' elementu, vai $result mainīgo un ['id'] tekstu? Raksti šādi: echo '<a href="labot.php?action=labot&id='.$result['id'].'">LABOT</a>'; Link to comment Share on other sites More sharing options...
monZy Posted May 10, 2005 Author Report Share Posted May 10, 2005 viņš neizdod, pie id=[tukšums] Link to comment Share on other sites More sharing options...
maxi Posted May 10, 2005 Report Share Posted May 10, 2005 Nesen viens luudza paliidziibu par administraacijas sisteemas veidoshanu un toreiz uzrakstiiju nelielu idejas sampli. Nesaku, ka shis piemeers ir \m/ un arii darbojas, bet idejas var aiznjemties. http://paste.php.lv/1900 Link to comment Share on other sites More sharing options...
рпр Posted May 12, 2005 Report Share Posted May 12, 2005 manupraat taa sql funkcija pareizi rakstaas mysql_num_rows Link to comment Share on other sites More sharing options...
Recommended Posts