laucinieks Posted March 23, 2011 Report Share Posted March 23, 2011 <?php include("config.php"); $datums = date('d-m-Y'); $next_date = date("d-m-Y", strtotime("+7 days")); $r = mysql_query("SELECT * FROM gramata WHERE lietotajvards = $_POST[lietotajvards]"); $row = mysql_fetch_row($r); $c = mysql_num_rows($r); if ($c > 0) { if ($datums == $row[5]) { $sql = "INSERT INTO gramata (lietotajvards, ieprieksejais_teikums, tavs_teikums, radit_vardu, datums, next_date) VALUES ('$_POST[lietotajvards]','$_POST[ieprieksejais_teikums]','$_POST[tavs_teikums]','$_POST[radit_vardu]','$datums','$next_date')"; $q = mysql_query($sql); header("location: paldies.php"); } else { header("location: error2.php"); } } else { $sql = "INSERT INTO gramata (lietotajvards, ieprieksejais_teikums, tavs_teikums, radit_vardu, datums, next_date) VALUES ('$_POST[lietotajvards]','$_POST[ieprieksejais_teikums]','$_POST[tavs_teikums]','$_POST[radit_vardu]','$datums','$next_date')"; $q = mysql_query($sql); header("location: paldies.php"); } ?> Tātad, ir forma, kuru aizpildot izpildās šis viss. Pašlaik viņš visu laiku pievieno, bet vajag tā - Pirmo reizi uzraksti, nākošo reizi tu vari rakstīt pēc 7 dienām, kad tā ir uzrakstīta, tad atkal pēc 7 dienām u.t.t. It kā visi dati pareizi ievadās, tikai man kaut kādīgi nesanāk to visu izvilkt ārā. Quote Link to comment Share on other sites More sharing options...
m8t Posted March 23, 2011 Report Share Posted March 23, 2011 Kas tas tāds? $_POST[lietotajvards] Kur pēdiņas? Quote Link to comment Share on other sites More sharing options...
laucinieks Posted March 23, 2011 Author Report Share Posted March 23, 2011 Ar pēdiņām liku no sākuma visu, tad parādījās - Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' Tāpēc arī noņēmu. Bet vai tad, tas kaut ko būtisku maina? Quote Link to comment Share on other sites More sharing options...
wintermute Posted March 23, 2011 Report Share Posted March 23, 2011 config.php augšā ieliec: ini_set('display_errors', 1 ); error_reporting( E_ALL | E_STRICT ); Quote Link to comment Share on other sites More sharing options...
laucinieks Posted March 23, 2011 Author Report Share Posted March 23, 2011 (edited) Kā to ieliku, tā tagad visu laiku metās - Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' on line 6 Tā rinda būtu šī - $r = mysql_query("SELECT * FROM gramata WHERE lietotajvards = $_POST[lietotajvards]"); Edited March 23, 2011 by laucinieks Quote Link to comment Share on other sites More sharing options...
m8t Posted March 23, 2011 Report Share Posted March 23, 2011 (edited) $r = mysql_query("SELECT * FROM gramata WHERE lietotajvards = '".$_POST["lietotajvards"]."'"); Edited March 23, 2011 by m8t Quote Link to comment Share on other sites More sharing options...
laucinieks Posted March 23, 2011 Author Report Share Posted March 23, 2011 Pilnīgi nekādas izmaiņas, kods tagad izskatās - <?php include("config.php"); $datums = date('d-m-Y'); $next_date = date("d-m-Y", strtotime("+7 days")); $r = mysql_query("SELECT * FROM gramata WHERE lietotajvards = '".$_POST["lietotajvards"]."'"); $row = mysql_fetch_row($r); $c = mysql_num_rows($r); if ($c > 0) { if ($datums == $row[5]) { $sql = "INSERT INTO gramata (lietotajvards, ieprieksejais_teikums, tavs_teikums, radit_vardu, datums, next_date) VALUES ('$_POST[lietotajvards]','$_POST[ieprieksejais_teikums]','$_POST[tavs_teikums]','$_POST[radit_vardu]','$datums','$next_date')"; $q = mysql_query($sql); header("location: paldies.php"); } else { header("location: error2.php"); } } else { $sql = "INSERT INTO gramata (lietotajvards, ieprieksejais_teikums, tavs_teikums, radit_vardu, datums, next_date) VALUES ('$_POST[lietotajvards]','$_POST[ieprieksejais_teikums]','$_POST[tavs_teikums]','$_POST[radit_vardu]','$datums','$next_date')"; $q = mysql_query($sql); header("location: paldies.php"); } ?> Un met, tieši tādu pašu kļūdas paziņojumu Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' on line 6 Quote Link to comment Share on other sites More sharing options...
daGrevis Posted March 23, 2011 Report Share Posted March 23, 2011 Pamēģini... foo( "Te ir {$array['index']}... jap." ); Quote Link to comment Share on other sites More sharing options...
laucinieks Posted March 23, 2011 Author Report Share Posted March 23, 2011 (edited) Viss iet, liels paldies! Edited March 23, 2011 by laucinieks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.