RobertsB Posted September 4, 2007 Report Share Posted September 4, 2007 (edited) nu tātad uzliku ka keywordi saglabāti tiek DB un tos var jebkurā laikā editēt no lapas bet sis tas nesanaak. nu tad es uztaisiju sadu funkciju ar kodu kas nolasa no DB tos keywordus function keywords() { $res = mysql_query("SELECT * FROM keywords"); { while($array = mysql_fetch_array($res)) { print("".format_comment($array["words"]).""); } } } bet ka lai attelo to funkciju šajā kodā ? <meta name="KEYWORDS" content="bla , bla , bla "/> provēju content="keywords();"/ content="<? keywords(); ?>"/ bet kad uzspiežu view source tad pie keywordiem raadaas <br /> <b>Warning</b>: mysql_query() [<a href='function.mysql-query'>function.mysql-query</a>]: Access denied for user 'ODBC'@'localhost' (using password: NO) in <b>C:\Program Files\xampp\htdocs\inc\main.php</b> on line <b>48</b><br /> <br /> <b>Warning</b>: mysql_query() [<a href='function.mysql-query'>function.mysql-query</a>]: A link to the server could not be established in <b>C:\Program Files\xampp\htdocs\inc\main.php</b> on line <b>48</b><br /> <br /> <b>Warning</b>: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in <b>C:\Program Files\xampp\htdocs\inc\main.php</b> on line <b>51</b><br /> ka lai pareizi vinu nodefinee? nez kape vins brec ka nav atljauts pieslegties mysql serverim. Edited September 4, 2007 by RobertsB Link to comment Share on other sites More sharing options...
bubu Posted September 4, 2007 Report Share Posted September 4, 2007 Tur skaidri rakstīts, kāda vaina ir tam, ka nevari pieslēgties serverim: Access denied for user 'ODBC'@'localhost' (using password: NO) Tu lietotājam ODBC nenorādi paroli, taču viņam vai nu ir uzlikta parole, vai arī viņš ir nobloķēts MySQLā. Tiec ar šo vispirms galā pirms drukāt keywordus. Link to comment Share on other sites More sharing options...
RobertsB Posted September 4, 2007 Author Report Share Posted September 4, 2007 bet tas nav iespējams jo šadu pašu kodu es izmantoju citos failos lai nolasiitu tekstu no DB un viss ir bumbās. diivaini... nu lab kko paķimerēšos , varbut aizies. Link to comment Share on other sites More sharing options...
marcis Posted September 5, 2007 Report Share Posted September 5, 2007 <? $conn = mysql_connect("host","user","pass"); mysql_select_db("db",$conn); function keywords() { global $conn; $res = mysql_query("SELECT bla FROM bla",$conn); $row = mysql_fetch_assoc(); return implode(", ",$row); } ?> <?=keywords();?> Link to comment Share on other sites More sharing options...
RobertsB Posted September 5, 2007 Author Report Share Posted September 5, 2007 oh pats jau tiku galā ;) vienkārši man man ir ari tada lieta function dbconnect un iekš taa koda biju aizmirsis ielikt dbconnect(); nu liels paldies par to pašu :) Link to comment Share on other sites More sharing options...
Delfins Posted September 5, 2007 Report Share Posted September 5, 2007 Imho... Saglabā DB tā kā to dari tagad, bet... izvadi gan varēji paņemt no keša - saglabāt visu stringu kādā failā un vnk viņu inklūdot. Viens SQL pieprasījums mazāk, 1 lieks cikls mazāks. Link to comment Share on other sites More sharing options...
RobertsB Posted September 5, 2007 Author Report Share Posted September 5, 2007 nu tas jau nebus nekads megaportāls , bet gan parasta tualates lapele kur ir domats ka apmeklees nedēļā kadi 4 cilveki :) tur tas 1 sql pieprasijums turp atpakaļ neko nemainis ;) Link to comment Share on other sites More sharing options...
Recommended Posts