Jump to content


New Members
  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Andreycon

  • Rank
  1. I got a response from an api in json. How do i echo out the account_name in string. Thanks as usual. The response is below... { "status": true, "message": "Account number resolved", "data": { "account_number": "2067483918", "account_name": "BABALOLA MAYOWA ABEL", "bank_id": 18 } } "status": true, "message": "Account number resolved", "data": { "account_number": "2067483918", "account_name": "BABALOLA MAYOWA ABEL", "bank_id": 18 } }
  2. Tanx all. I got an approach which now works echo "<table>"; foreach ($rowB as $row) { echo "<tr>"; foreach ($row as $column) { echo "<td>$column</td>"; } echo "</tr>"; } echo "</table>";
  3. The $id is its name. So am indexing it with the name. It finds it but only output the first row but if I print $rowB I get all the rows for stone cold in arrays though
  4. Let's assume this is my table Name Amount Gender Stone Cold. 1245. Male Kingsley. 500 Male. Stone Cold 2367 Male Stone Cold. 5678. Male Now I want to print stone cold rows. Which is row 1,3 and 4 just exactly the same format with he above table. How do I get to do that. My code is <?php $id = $_SESSION['login']; $sqlB = "SELECT * FROM activities WHERE username=? ORDER BY No DESC LIMIT 10"; $stmtB = $connection->prepare($sqlB); $stmtB->bind_param('s', $id); $stmtB->execute(); $resultB = $stmtB->get_result(); while($rowB = $resultB->fetch_all(MYSQLI_ASSOC)){ foreach ($rowB as $out) { echo implode(' ', $out) . "<br>"; exit; } } //print_r($rowB); // exit; ?> I don't understand how to put each row for stone cold into HTML row. Please don't be annoyed by my question, I know its a simple stuff but I've tried several stuffs, I can't get what I need still. If I print $rowB I get all want from the database in arrays. Thanks!!!
  5. I want to fetch data from a table let's say table "activities". Uid | day | activity | time | remarks 1. Mon. Act1. 3pm. Good 2. Mon. Act1. 5pm. Bad 1. Tue. Act2. 12am. Bad 1. Tue. Act5. 1am. Bad 1. Thur. Act8. 9pm. Good 2. Wed. Act4. 7am. Good Now assuming I want to fetch all the data that is related to user Id 1 and display them in another table (Uid 1). Which is 4 rows according to the table, how do I go about it using select query? Thanks!!! I tried something like this but it displays just one row <?php $uid = $_SESSION['login']; $sql2 = "SELECT * FROM Activities WHERE uid=? ORDER BY Uid LIMIT 6"; $stmt2 = $connection->prepare($sql2); $stmt2->bind_param('i', $Uid); $stmt2->execute(); $result2 = $stmt2->get_result(); $row2 = $result2->fetch_assoc(); //now am stuck here ?> now trying to display the fetch those data for only Uid 1 in these simple format... <table style="width:100%"> <tr> <th>Day</th> <th>Activity</th> <th>Remarks</th> </tr> <tr> <td>Mon</td> <td>Act1</td> <td>Good</td> </tr> <tr> <td>Tue</td> <td>Act2</td> <td>Bad</td> </tr> <tr> <td>Tue</td> <td>Act5</td> <td>Bad</td> </tr> </table> Jus like that, to contain all the 4 data for Uid 1. Thanks in advance..
  6. Am a newbie in php. Since I can't insert values to the database with respect to a user Id or with any other token using WHERE clause. I.e "INSERT INTO receipts(date) VALUES(example) where id="**....." If I need to fetch several values of column for a particular user, how do I go about it? Thank you!!!
  • 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.