Jump to content

yami

New Members
  • Posts

    8
  • Joined

  • Last visited

yami's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello ..I tried to bring some items from database and display them one by one on the screen..I put an input for each item I got from db ..my question is how can I get the value of each input of each item displayed on the screen?If anyone wants the code here it is: <?php $bringitem = $connection->query("SELECT * from item where idItem='$iditemm'"); if(!$bringitem){ echo mysqli_error($connection); } while($rowww = $bringitem->fetch_assoc()) { ?> <td> <?php echo $rowww['itemName'];?> </td> <td> <form action=""> <input type="number" id="quantity" name="quantity" min="1" max="50" style="width:3em;"> </form> </td> <?php } ?> Note : I am trying to get them all by one submit button
  2. okay but how can I catch each chosen value since all values are in one variable?sorry I am still a beginner
  3. I am trying to put a column from a database table into a select input .How can I catch the value that I chose using php? Here is my code.Thanks in advance <?php $stmt = $con->query("SELECT size FROM size INNER JOIN inventory ON size.idSize = inventory.idsize WHERE id_item =$idd"); while($row = $stmt->fetch_assoc()) { ?> <form action='' method="post"> <select name='size' id="size" class='size'> <option value="<?php $row ?>"><?php echo $row['size'] ?></option> </form> <?php } ?>
  4. So I have an if-else statement full of queries and it is the else part where there is an error and here it is: else{ $nameuser = $_SESSION['username']; $iduser = $connection->query("SELECT idCustomer FROM customer WHERE username='$nameuser'"); if(!$iduser){ die('Query failed!' . mysqli_error($connection)); } if (isset($_POST['idd']) && $_POST['idd']!=""){ $idd = $_POST['idd']; // echo $idd; // $query ="INSERT INTO cart(idItem,idUser) VALUES('$idd','$iduser')"; $resulti = mysqli_query($connection , "INSERT INTO cart(idItem,idUser) VALUES('$idd','$iduser')"); if(!$resulti){ die('Query failed!' . mysqli_error($connection)); } } } <input type='hidden' name='idd' id='idd' > the exact error message: Catchable fatal error: Object of class mysqli_result could not be converted to string in C:\wamp64\www\index.php on line 134 it is the last query's line is it enough?
  5. I tried that too..I tried to separate them but it shows the same error! I have the same query in another php file but it does not show any error so I cannot tell what is wrong..
  6. $resulti = mysqli_query($connection , "INSERT INTO cart(idItem,idUser) VALUES('$idd','$iduser')"); if(!$resulti){ die('Query failed!' . mysqli_error($connection)); } I am just trying to insert some data into a db table but this error keeps showing..any ideas how to fix it?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.