Jump to content

ale

Members
  • Content count

    13
  • Joined

  • Last visited

Community Reputation

0 Neutral

About ale

  • Rank
    Newbie
  1. Advice about XML

    Ok. But why XML is important??? When to use it? Some practic example...
  2. Advice about XML

    I know it @justsomeguy, but I cannot understand where I should put it, I mean where in HTML, PHP etc. I read about XML on W3Schools, but there is no clearly explanation for example where I can find an xml doc of some page..
  3. Advice about XML

    Hello guys, Can anybody tell me some practical example of xml??? I'm new with it. I know what is xml, syntax etc. but I am not so clear with using the same.... Thanks...
  4. I think u r right.. Can I do redirect in js??? Actually if I click cancle that return me on the some page???
  5. Problem with updateing table

    Oh I have a quotes... That is not a problem
  6. None of the examples above are working. I tried both of them...
  7. Now I do I will try the examples above... Thanks people for helping me or trying to help
  8. Grrrr... I am not good with the AJAX.. I am the beginner yes I have two buttons... One for submmit and one for the cancelation written directly in my js confirmation box... Here is the code: Java Script confirmation box code: <script> function myFunction() { var x; if (confirm("Da li želite da sačuvate promjene?") == true) { x = "You pressed OK!"; } else { x = "You pressed Cancel!"; } document.getElementById("demo").innerHTML = x; } </script> I know that this is a simple js function.. Do I need make some changes here (write an AJAX into this js code)???
  9. Problem with updateing table

    I already tried that but there is still some mistake... It is not working...
  10. Problem with updateing table

    I will try it..
  11. Problem with updateing table

    Hi When I am doing the table update I do not see that one article is updated called naziv_artikla. Well, the article is updated in the database when I open my phpmyAdmin, but when I am showing it on the screen, selecting all the articles from the database I do not see the update of naziv_artikla. Is there problem with the hidden field? I removed it from the code, but then is displayed some error (code is not working properly). Can anybody tells me what should I fix??? Thanks This is my code for selecting data from the database. <?php $con=mysqli_connect("localhost","root","aco123","sifrarnik"); // Provjeri konekciju if (mysqli_connect_errno()) { echo "Failed to connect to MySQLi: " . mysqli_connect_error(); } $result = mysqli_query($con,"SELECT * FROM artikli ORDER BY id_artikla ASC"); echo "<table border='1'> <tr> <th>Id artikla</th> <th>Naziv artikla</th> <th>Cijena artikla</th> <th>Na stanju</th> <th>Ukupno u KM</th> </tr>"; while($row = mysqli_fetch_array($result)) { echo "<form action = update1.php method = post>"; echo "<tr>"; echo "<td>" . $row['id_artikla'] . " </td>"; echo "<td>" ."<input type = text name = naziv_artikla value = ". $row['naziv_artikla'] . " </td>"; echo "<td>" ."<input type = text name = cijena_artikla value = ". $row['cijena_artikla'] . " </td>"; echo "<td>" ."<input type = text name = na_stanju value = ". $row['na_stanju'] . " </td>"; echo "<td>" . $row ['cijena_artikla'] * $row ['na_stanju'] . " </td>"; echo "<td>" ."<input type = hidden name = hidden value = ". $row['id_artikla'] . " </td>"; echo "<td>" ."<input type = submit name = update value = Update>"; echo "</tr>"; echo "</form>"; } $ukupno_u_km = $row ['cijena_artikla'] * $row ['na_stanju']; mysqli_close($con); ?> And this is my update code. <?php $servername = "localhost"; $username = "root"; $password = "aco123"; $dbname = "sifrarnik"; // Kreiranje konekcije $conn = mysqli_connect($servername, $username, $password, $dbname); // Provjera konekcije if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } // Sql upit za update podataka $sql = "UPDATE artikli SET naziv_artikla = '$_POST[naziv_artikla]', cijena_artikla = '$_POST[cijena_artikla]', na_stanju = '$_POST[na_stanju]' WHERE naziv_artikla = '$_POST[hidden]'"; mysqli_query ($conn, $sql); // Provjera upita if (mysqli_query($conn, $sql)) { echo header ("Location: tabela_sa_podacima1.php"); } else { echo "Error updating record: " . mysqli_error($conn); } mysqli_close($conn); ?>
  12. There is no selected database because I have removed it. I have a database called sifrarnik. And I do not understand your reply, because I am not looking for that answer. Well, do I need write an if condition or something in my Java Script code??? I told u, when I click on OK the data is submmited in a database and when I click CANCLE a data is submmited into a database too. I want when I click on CANCLE that nothing is submmited.. That is a point....
  13. Hello guys. I am new here. Well, I have some codes written in php. And I have several forms (insert, update etc.). And I have that confirmation box written in Java Script. The thing is next: when I click on submmit in my insert form the box shows up and when I click on OK the data is submmited in the database, but when I click on CANCLE the data is submmited too and I do not want that. Can anybody helps me please??? THIS IS MI INSERT CODE. <?php $con=mysqli_connect("localhost","root","",""); // Provjeri konekciju if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } // Varijable za sigurnost $naziv_artikla = mysqli_real_escape_string($con, $_POST['naziv_artikla']); $cijena_artikla = mysqli_real_escape_string($con, $_POST['cijena_artikla']); $na_stanju = mysqli_real_escape_string($con, $_POST['na_stanju']); // Sql upit za insert novih podataka u bazu $sql="INSERT INTO artikli (naziv_artikla, cijena_artikla, na_stanju) VALUES ('$naziv_artikla', '$cijena_artikla', '$na_stanju')"; // Provjera upita if (!mysqli_query($con,$sql)) { die('Error: ' . mysqli_error($con)); } echo header ("Location: index1.php"); mysqli_close($con); ?> THIS IS CONFIRMATION BOX (JAVA SCRIPT). <script> function myFunction() { var x; if (confirm("Da li želite da sačuvate promjene?") == true) { x = "You pressed OK!"; } else { x = "You pressed Cancel!"; } document.getElementById("demo").innerHTML = x; } </script>
×