Jump to content

holly9

Members
  • Posts

    31
  • Joined

Everything posted by holly9

  1. Cool thanks allot it works!!.To test I use: $result = $con->query("SELECT * FROM purchases ORDER BY ID LIMIT 5"); while ($row = $result->fetch_assoc()){ foreach ($row as $value) { echo $value . "<br>"; } unset($value); } I also test the code below to only select certain coloumn for all rows and it also works: $result = $con->query("SELECT * FROM purchases ORDER BY ID LIMIT 5"); while ($row = $result->fetch_assoc()) { echo $purchaserow['item'] . "<br>"; } You both help me allot thanks!!
  2. I don't get double of everything any more when i use this $result->fetch_assoc(); instead of $result->fetch_array(); so the only problem i have is that i can't get many rows at a time with the looping.
  3. it seems that the tos below has extra stuff than the tos given during signup so it took awhile to find the code tags info.i hope this is correct. $result = $con->query("SELECT * FROM purchases ORDER BY ID LIMIT 5" ); $row = $result->fetch_array(); foreach ($row as $value) { echo $value . "<br>"; } unset($value);
  4. Thanks. I did try looping through result before but it only gave me one row and each coloumn in one row is shown two times for example :name name,email email,and etc.This is the reason why i used the for statement before.i got warning about tags which confuse me because there wasn't much explanation.i'm assuming that mod is refering to these tags: <?php ?>
  5. Hi, how is it bad please and what are the better ways to do this?.I recently learn php and only few weeks ago i got paid hosting to test codes.I didn't write out everything in the code and this is only an example.Mysqli fetch array only retrieve one data at a time which is the reason why i wanted to use this method.I also want to use it to display ads in a directory.I have study from site like w3schools which didn't help me to do the harder stuff...
  6. Hi I want to do this for many things on my php sites. Example: for ($a=1; $a<=60; $i++) { $result = $con->query("SELECT * FROM Users WHERE UserID <='". $a ."'" ); $row = $result->fetch_array(); and etc } Thanks.
×
×
  • 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.