ziedinjsh Posted November 9, 2010 Report Share Posted November 9, 2010 Sveiki! šādi pieslēdzot datubāzei: <?php mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("sell") or die(mysql_error()); ?> un šādie ievadu datus{ <?php if (isset($_GET['add_d7'])) { $d7_name = $_POST['d7_name']; $d7_size = $_POST['d7_size']; $d7_demo = $_POST['d7_demo']; $d7_link = $_POST['d7_link']; $d7_buy = $_POST['d7_buy']; $add = mysql_query("INSERT INTO `d7` (d7_name, d7_size, d7_demo, d7_link, d7_buy) VALUES ('$d7_name', '$d7_size', '$d7_demo', '$d7_link', '$d7_buy') "); $result = mysql_query($sql); if($result){ echo "All done!"; }else { echo "ERROR"; } } echo "<form method='post' action='index.php?id=add_d7'>"; echo "<div id='add-d7'>"; echo "<div class='title'>File name</div><div class='input'><input type='text' name='d7_name' size='35'></div>"; echo "<div class='title'>File size</div><div class='input'><input type='text' name='d7_size' size='2'></div>"; echo "<div class='title'>Demo link</div><div class='input'><input type='text' name='d7_demo' size='60' ></div>"; echo "<div class='title'>Download link</div><div class='input'><input type='text' name='d7_link' size='60' ></div>"; echo "<div class='title'>Buy id</div><div class='input'><input type='text' name='d7_buy' size='2'></div>"; echo "<div class='fix'></div>"; echo "<center><input type='submit' name='add_d7' value='ADD' class='button'></center>"; echo "</div>"; echo "</form>"; ?> piespiežot pogu lapa vienkāršī refrešojas un viss.. informāciju iekš datubāzes neievada.. Kas par vainu?? Quote Link to comment Share on other sites More sharing options...
Rincewind Posted November 9, 2010 Report Share Posted November 9, 2010 Šitā pamēģini: "INSERT INTO d7 (`d7_name`, `d7_size`, `d7_demo`, `d7_link`, `d7_buy`) VALUES ('$d7_name', '$d7_size', '$d7_demo', '$d7_link', '$d7_buy') " Quote Link to comment Share on other sites More sharing options...
labaiss Posted November 9, 2010 Report Share Posted November 9, 2010 (edited) $sql = "?"; Edited November 9, 2010 by labaiss Quote Link to comment Share on other sites More sharing options...
Rincewind Posted November 9, 2010 Report Share Posted November 9, 2010 (edited) $sql = "?"; Tas $sql jau neko nedara. Es kļūdu ķertu šitā, lai kods pats stāsta kas un kapēc nenotiek: $connection=mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("sell",$connection) or die(mysql_error()); if (isset($_GET['add_d7'])) { echo "<br>GET nostrādāja<br><br>"; $d7_name = $_POST['d7_name']; $d7_size = $_POST['d7_size']; $d7_demo = $_POST['d7_demo']; $d7_link = $_POST['d7_link']; $d7_buy = $_POST['d7_buy']; $q="INSERT INTO `d7` (d7_name, d7_size, d7_demo, d7_link, d7_buy) VALUES ('$d7_name', '$d7_size', '$d7_demo', '$d7_link', '$d7_buy')"; $add = mysql_query($q,$connection); echo "<br>Query: ",$q,"<br><br>"; echo "<br>Error: ",mysql_error($connection),"<br><br>"; } Edited November 9, 2010 by Rincewind Quote Link to comment Share on other sites More sharing options...
labaiss Posted November 9, 2010 Report Share Posted November 9, 2010 (edited) <?php if (isset($_GET['add_d7'])) { $d7_name = $_POST['d7_name']; $d7_size = $_POST['d7_size']; $d7_demo = $_POST['d7_demo']; $d7_link = $_POST['d7_link']; $d7_buy = $_POST['d7_buy']; $add = mysql_query("INSERT INTO `d7` (d7_name, d7_size, d7_demo, d7_link, d7_buy) VALUES ('$d7_name', '$d7_size', '$d7_demo', '$d7_link', '$d7_buy') "); $result = mysql_query($sql); if($result){ echo "All done!"; }else { echo "ERROR"; } } echo "<form method='post' action='index.php?id=add_d7'>"; echo "<div id='add-d7'>"; echo "<div class='title'>File name</div><div class='input'><input type='text' name='d7_name' size='35'></div>"; echo "<div class='title'>File size</div><div class='input'><input type='text' name='d7_size' size='2'></div>"; echo "<div class='title'>Demo link</div><div class='input'><input type='text' name='d7_demo' size='60' ></div>"; echo "<div class='title'>Download link</div><div class='input'><input type='text' name='d7_link' size='60' ></div>"; echo "<div class='title'>Buy id</div><div class='input'><input type='text' name='d7_buy' size='2'></div>"; echo "<div class='fix'></div>"; echo "<center><input type='submit' name='add_d7' value='ADD' class='button'></center>"; echo "</div>"; echo "</form>"; ?> $result = mysql_query($sql); if($result){ echo "All done!"; }else { echo "ERROR"; } Un ko tad dara šitas? Un ko tu gribi ieraudzīt, kad informāciju ievieto? Un viņu tev ievieto, vispār? Edited November 9, 2010 by labaiss Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted November 9, 2010 Author Report Share Posted November 9, 2010 (edited) nu lab, tagad ievade ir šāda <?php if (isset($_GET['add_d7'])) { echo "<br>GET nostrādāja<br><br>"; $d7_name = $_POST['d7_name']; $d7_size = $_POST['d7_size']; $d7_demo = $_POST['d7_demo']; $d7_link = $_POST['d7_link']; $d7_buy = $_POST['d7_buy']; $q="INSERT INTO `d7` (d7_name, d7_size, d7_demo, d7_link, d7_buy) VALUES ('$d7_name', '$d7_size', '$d7_demo', '$d7_link', '$d7_buy')"; $add = mysql_query($q,$connection); echo "<br>Query: ",$q,"<br><br>"; echo "<br>Error: ",mysql_error($connection),"<br><br>"; } echo "<form method='post' action='index.php?id=add_d7'>"; echo "<div id='add-d7'>"; echo "<div class='title'>File name</div><div class='input'><input type='text' name='d7_name' size='35'></div>"; echo "<div class='title'>File size</div><div class='input'><input type='text' name='d7_size' size='2'></div>"; echo "<div class='title'>Demo link</div><div class='input'><input type='text' name='d7_demo' size='60' ></div>"; echo "<div class='title'>Download link</div><div class='input'><input type='text' name='d7_link' size='60' ></div>"; echo "<div class='title'>Buy id</div><div class='input'><input type='text' name='d7_buy' size='2'></div>"; echo "<div class='fix'></div>"; echo "<center><input type='submit' name='add_d7' value='ADD' class='button'></center>"; echo "</div>"; echo "</form>"; ?> bet informāciju datubāzē neievadās :? Edited November 9, 2010 by ziedinjsh Quote Link to comment Share on other sites More sharing options...
Val Posted November 9, 2010 Report Share Posted November 9, 2010 Atrodi 10 atšķirības starp (isset($_GET['id']) AND $_GET['id']=='add_d7') un (isset($_GET['add_d7'])) Tak liec kaut vai pēc katras koda rindiņas kādu teksa izvadīšanu, lai pats saprastu, kas nostrādā un kas nē... Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted November 9, 2010 Author Report Share Posted November 9, 2010 ko tur likt pēc kārtas.. viņam būtu jastrādā! Quote Link to comment Share on other sites More sharing options...
Vecteevs Posted November 9, 2010 Report Share Posted November 9, 2010 šo pārveido $add = mysql_query("INSERT INTO `d7` (d7_name, d7_size, d7_demo, d7_link, d7_buy) VALUES ('$d7_name', '$d7_size', '$d7_demo', '$d7_link', '$d7_buy') "); $result = mysql_query($sql); šādi: $sql="INSERT INTO `d7` (d7_name, d7_size, d7_demo, d7_link, d7_buy) VALUES ('$d7_name', '$d7_size', '$d7_demo', '$d7_link', '$d7_buy')"; $result=mysql_query($sql); Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted November 9, 2010 Author Report Share Posted November 9, 2010 pārveidoju, bet datubāzē dati vienalga netiek ielikti! :( Quote Link to comment Share on other sites More sharing options...
Vecteevs Posted November 9, 2010 Report Share Posted November 9, 2010 varbūt palīdzēs http://www.phpeasystep.com/mysql/5.html bet varbūt tev nav db pareizi norādīta vai kas tāds nu nezinu. Quote Link to comment Share on other sites More sharing options...
sheps Posted November 9, 2010 Report Share Posted November 9, 2010 VAL 10 artšķirību mīklas risinājums ka mainiigais $_GET['add_d7'] nemaz netiek nosuutiits :D nav briinums ka nekas nenotiek.. tu jau nosuuti mainiigo $id ar vērtību add_d7.. Quote Link to comment Share on other sites More sharing options...
Val Posted November 10, 2010 Report Share Posted November 10, 2010 Visu pateikt priekšā būtu pārāk vienkārši, topika autors no tā neko neiegūst - pašam jāpadomā. ... un ir klāt jau ar to pašu problēmu vēlreiz tikai citā izskatā. http://php.lv/f/topic/17596-dzest-datus/page__pid__137627 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.