I am getting an bug in my code. This is caused by
From the ide
DEBUG:cs50:SELECT id FROM stock_info where id = 108
length of rows {} 1
DEBUG:cs50:SELECT * FROM stock_info where id = 108
length of columns {} 1
stock_info
id Symbol Name Shares Price TOTAL
1 AAPL Apple 2 $185.22 $370.44
1 GOOG Google 3 235.00 $705
2 AAPL Apple 1 185.22 $185.22
I want to select columns
2 AAPL Apple 2 185.22 $185.22
IOW rows len(5) How do I do this
I tried googling first.
Now
1 AAPL Apple 2 $185.22 $370.44
1 GOOG Google 3 $235.00 $705
It is pretty easy to select 1 col but how do I select 2 columns where the id is = the same number?
Bought.html
{% extends "layout.html" %}
{% block title %}
bought
{% endblock title %}
{% block main %}
<table>
<tr>
<th> SYMBOL </th>
<th> NAME </th>
<th> SHARES </th>
<th> PRICE </th>
<th> TOTAL </th>
</tr>
{% for y in range(db_stock_info_num_columns_len) %}
{% for x in range(db_stock_info_num_rows_len) %}
<tr> {{[y]}}
<th> {{database_stock_info[x][y]}} </th>
</tr>
{% endfor %}
{% endfor %}
</tr>
<th> </th>
<th> </th>
<th> </th>
<th> </th>
<th> {{ cash_after_purchase }} </th>
<tr>
<th> </th>
<th> </th>
<th> </th>
<th> </th>
<th> {{ current_cash[0]["cash"] }} </th>
</tr>
</table>
{% endblock %}<!–– https://www.geeksforgeeks.org/python-using-for-loop-in-flask/ -->
{% extends "layout.html" %}
{% block title %}
bought
{% endblock title %}
{% block main %}
<table>
<tr>
<th> SYMBOL </th>
<th> NAME </th>
<th> SHARES </th>
<th> PRICE </th>
<th> TOTAL </th>
</tr>
{% for y in range(db_stock_info_num_columns_len) %}
{% for x in range(db_stock_info_num_rows_len) %}
<tr> {{[y]}}
<th> {{database_stock_info[x][y]}} </th>
</tr>
{% endfor %}
{% endfor %}
</tr>
<th> </th>
<th> </th>
<th> </th>
<th> </th>
<th> {{ cash_after_purchase }} </th>
<tr>
<th> </th>
<th> </th>
<th> </th>
<th> </th>
<th> {{ current_cash[0]["cash"] }} </th>
</tr>
</table>
{% endblock %}
Output from bought.html
SYMBOL NAME SHARES PRICE TOTAL
9444.34
9814.78
Thanks for the help.