Jump to content
php.lv forumi

keissfootball

Reģistrētie lietotāji
  • Posts

    269
  • Joined

  • Last visited

Everything posted by keissfootball

  1. A nu ja pēdiņas taču qoute bija. Bet tāpat, ja es ierakstu to rindiņu, man nestrādā, un atverot guestbook.php browserī, viņš man izmet šito: neesmu $_GET[action] mainigo padevis un $action mainigais nav definets!
  2. Nesapratu kas ar to "quot`os", man viņu kodā jāieliek? kā man tam kodam jāizskatās? Šitā: die ( 'neesmu $_GET[action] mainīgo padevis un $action mainīgais nav definēts');
  3. Tev tā pēdējā rindiņa pareizi uzrakstīta???
  4. Un ko es varētu izlabot skriptā lietas labā?
  5. Vienkāršākā valodā varat izskaidrot?
  6. Tagad man šāda kļūda rādās, kad izlaboju to visu: Notice: Undefined index: action in /user/maja/abc/guestbook.php on line 30 Vai jūs nevarētu pateikt kas tā pa kļūdu? Kaut kas ar GET 'action'
  7. Varat apskatīties viņu, uzspiežot uz hyperlinka Tas kods
  8. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <? // Part One - Initiate a mySQL Database Connection // Database Connectivity Variables and other Variables $DBhost = "mans_hosts"; // Database Server $DBuser = "mans_lietotajvards"; // Database User $DBpass = "mana_parole"; // Database Pass $DBName = "mans_datubazes_vards"; // Database Name $table = "guestbook"; // Database Table $numComments = 10; // Number of Comments per page // Connect to mySQL Server $DBConn = mysql_connect("mans_hosts","mans_lietotajvards","mana_parole") or die("Error in GuestBook Application: " . mysql_error()); // Select mySQL Database mysql_select_db("mans_datubazes_vards") or die("Error in GuestBook Application: " . mysql_error()); // Part Two - Choose what action to perform $action = $_GET['action']; switch($action) { case 'read' : // Fetch all comments from database table $sql = 'SELECT * FROM comments' . $table . 'guestbook'; $allComments = mysql_query($sql, $DBConn) or die("Error in GuestBook Application: " . mysql_error()); $numallComments = mysql_num_rows($allComments); // Fetch page-wise comments from database table $sql .= ' ORDER BY `time` DESC LIMIT ' . $_GET['NumLow'] . ', ' . $numComments; $fewComments = mysql_query($sql, $DBConn) or die("Error in GuestBook Application: " . mysql_error()); $numfewComments = mysql_num_rows($fewComments); // Generate Output for Flash to Read print '&Kopējais ierakstu skaits=' . $numallComments . '&'; print "<br>&Ieraksti="; if($numallComments == 0) { print "Viesu grāmatā nav ziņu"; } else { while ($array = mysql_fetch_array($fewComments)) { $name = mysql_result($fewComments, $i, 'Vārds'); $email = mysql_result($fewComments, $i, 'E-pasts'); $comments = mysql_result($fewComments, $i, 'Komentāri'); $time = mysql_result($fewComments, $i, 'Laiks'); print '<b>Vārds: </b>' . $name . '<br><b>E-pasts: </b>' . $email . '<br><b>Komentāri: </b>' . $comments . '<br><i>Datums: ' . $time . '</i><br><br>'; $i++; } } // Print this only when there aren't any more entries.. if($_GET['NumLow'] > $numallComments) { print 'Nav vietas jaunām ziņām!&'; } break; case 'write' : // Recieve Variables From Flash $name = ereg_replace("&", "%26", $_POST['yourname']); $email = ereg_replace("&", "%26", $_POST['youremail']); $comments = ereg_replace("&", "%26", $_POST['yourcomments']); $submit = $_POST['submit']; // Current system date in yyyy-mm-dd format $submitted_on = date ("Y-m-d H:i:s",time()); // Check if its submitted from Flash if($submit == 'Yes'){ // Insert the data into the mysql table $sql = "INSERT INTO guestbook ". "(`ID`, `name`, `email`, `comments`, `time`) VALUES ". "('','$name', '$email', '$comments', '$submitted_on')"; $insert = mysql_query("guestbook") or die("Error in GuestBook Application: " . mysql_error()); print "&gb_status=Paldies par ierakstīto ziņu.&done=yes&"; return; } print "&_root.write.gb_status=Kļūda!&"; break; } ?> ŠIS IR KODS PILNĪBĀ, PRTOTAMS, BEZ PAROLĒM U.T.T., BET PĀRĒJAIS VISS TAS PATS, KAS ORIĢINĀLĀ. VAI KĀDS NEVARĒTU PATEIKT, KUR MAN KĻŪDA, BŪŠU ĻOTI PATEICĪGS
  9. // Part One - Initiate a mySQL Database Connection // Database Connectivity Variables and other Variables $DBhost = "localhost"; // Database Server $DBuser = "user"; // Database User $DBpass = "password"; // Database Pass $DBName = "db_1"; // Database Name $table = "viesu_gramata"; // Database Table $numComments = 10; // Number of Comments per page // Connect to mySQL Server $DBConn = mysql_connect($DBhost,$DBuser,$DBpass) or die("Error in GuestBook Application: " . mysql_error()); // Select mySQL Database mysql_select_db($DBName, $DBConn) or die("Error in GuestBook Application: " . mysql_error()); // Part Two - Choose what action to perform $action = $_GET['action']; switch($action) { case 'read' : // Fetch all comments from database table $sql = 'comments' . $table . 'guestbook'; $allComments = mysql_query($sql, $DBConn) or die("Error in GuestBook Application: " . mysql_error()); $numallComments = mysql_num_rows($allComments); // Fetch page-wise comments from database table $sql .= 'comments' . $_GET['NumLow'] . ', ' . $numComments; $fewComments = mysql_query($sql, $DBConn) or die("Error in GuestBook Application: " . mysql_error()); $numfewComments = mysql_num_rows($fewComments); // Generate Output for Flash to Read print '&totalEntries=' . $numallComments . '&'; print "<br>&entries="; if($numallComments == 0) { print "No entries in the guestbook, as yet.."; } else { while ($array = mysql_fetch_array($fewComments)) { $name = mysql_result($fewComments, $i, 'name'); $email = mysql_result($fewComments, $i, 'email'); $comments = mysql_result($fewComments, $i, 'comments'); $time = mysql_result($fewComments, $i, 'time'); print '<b>Name: </b>' . $name . '<br><b>Email: </b>' . $email . '<br><b>Comments: </b>' . $comments . '<br><i>Date: ' . $time . '</i><br><br>'; $i++; } } // Print this only when there aren't any more entries.. if($_GET['NumLow'] > $numallComments) { print 'No More Entries!&'; } break; case 'write' : // Recieve Variables From Flash $name = ereg_replace("&", "%26", $_POST['yourname']); $email = ereg_replace("&", "%26", $_POST['youremail']); $comments = ereg_replace("&", "%26", $_POST['yourcomments']); $submit = $_POST['submit']; // Current system date in yyyy-mm-dd format $submitted_on = date ("Y-m-d H:i:s",time()); // Check if its submitted from Flash if($submit == 'Yes'){ // Insert the data into the mysql table $sql = 'INSERT INTO ' . $table . 'guestbook'; ' (`ID`, `name`, `email`, `comments`, `time` ) VALUES (\'\',' . '\'' . $name . '\',' . '\'' . $email . '\',' . '\'' . $comments . '\',' . '\'' . $submitted_on . '\' )'; $insert = mysql_query($sql, $DBConn) or die("Error in GuestBook Application: " . mysql_error()); } ?> Varbūt būs kaut kas saprotams, ja es visu skriptu ielikšu? Tā rindiņa - pie beigām ir tā pati, ko rakstīju agrāk!!!
  10. PHP kods 83 VALUES 84 (\'\',' 85 . '\'' . $name . '\',' 86 . '\'' . $email . '\',' 87 . '\'' . $comments . '\',' 88 . '\'' . $submitted_on . '\' 89 )'; Apmēram tāds kods tas ir
  11. Kāds nevar paskaidrot kāpēc man šī kļūda rādās? Parse error: parse error in /user/maja/abc/viesugramata.php on line 84
  12. Vai tu 13 gados zināji php visus skriptus??? :angry: :angry: :angry:
  13. Jūs te mēģinat kaut ko man skaidrot, kur var to iemācīties, protams, liels paldies, bet viesu grāmatas taisīšana ir atsevišķs gadījums, tāpēc vai nevarētu paskaidrot, kas tur jāraksta, kaut ar piemēru un viss???????????? :(
  14. Eu nu es nesaprotu tik labi šito php, ne jau visu tu arī zini. Vai tas sql ir tā kā ''field''?
  15. Vēl viens jautājums, kas pie šī jāraksta? $sql = 'SELECT * FROM `' . $table . 'guestbook';
  16. Nē nu šo es saprotu, bet tas pirmais mans jautājums, ko tur jāievada? Un ja var, tad paskaidrojiet ar piemēriem, piemēram user - Jānis u.t.t
  17. Vai kāds nevarētu man paskaidrot ko jāraksta šajās vietās skriptā, jo es taisu viesu grāmatu ar MySQL datu bāzi: 1)// Connect to mySQL Server $DBConn = mysql_connect($DBhost,$DBuser,$DBpass) or die("Error in GuestBook Application: " . mysql_error()); 2)// Select mySQL Database mysql_select_db($DBName, $DBConn) or die("Error in GuestBook Application: " . mysql_error()); :wacko: Lūūūūūūūūūūūūūūūdzu palīīīīīīīīdziet kāds!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Ja var atsūtiet atbildi uz e-pastu [email protected]
×
×
  • Create New...