Displaying Certain Row On Page
Moderator: General Moderators
- nickman013
- Forum Regular
- Posts: 764
- Joined: Sun Aug 14, 2005 12:02 am
- Location: Long Island, New York
Displaying Certain Row On Page
Hello,
I have a form that inserts data into a database in blob format. The data is put into a HTML code before it is inserted though.
I would like to have a page that displays all of the submitted data, I can do that. But I would like to make a button that displays the selected data on a different page.
Basically I have a page that users contribute to, like videos for example. I would like them to upload videos, and I would like to have all the videos displayed on a page with buttons that I can select a certain one that will be viewed on another page.
I dont know If this clears up what I need help with, if not someone tell me what other info they need.
I do not want people to code it for me, I just want someone to give me a way to create somthing like this, like what would I need to do.
Thanks!
I have a form that inserts data into a database in blob format. The data is put into a HTML code before it is inserted though.
I would like to have a page that displays all of the submitted data, I can do that. But I would like to make a button that displays the selected data on a different page.
Basically I have a page that users contribute to, like videos for example. I would like them to upload videos, and I would like to have all the videos displayed on a page with buttons that I can select a certain one that will be viewed on another page.
I dont know If this clears up what I need help with, if not someone tell me what other info they need.
I do not want people to code it for me, I just want someone to give me a way to create somthing like this, like what would I need to do.
Thanks!
Re: Displaying Certain Row On Page
Write code?nickman013 wrote:like what would I need to do.
your answers will be a lot more helpful if you ask specific questions.
- nickman013
- Forum Regular
- Posts: 764
- Joined: Sun Aug 14, 2005 12:02 am
- Location: Long Island, New York
Ok, Ive got my form working and inserting the data into the DB.
I have 3 fields in the DB
Number (int,Auto increment) | Code (text) | Live (int)
I would like all the rows that have 1 for live, to be viewed on a page. The ones with 0 for live, dont show up. Anybody got any idea on how I can go about on doing this.
Thank You
I have 3 fields in the DB
Number (int,Auto increment) | Code (text) | Live (int)
I would like all the rows that have 1 for live, to be viewed on a page. The ones with 0 for live, dont show up. Anybody got any idea on how I can go about on doing this.
Thank You
- nickman013
- Forum Regular
- Posts: 764
- Joined: Sun Aug 14, 2005 12:02 am
- Location: Long Island, New York
Ok, I have got that part working. Now I am on the next part, displaying all of the rows in the database on a page.
Probably not written right. But It is supposed to display each row, and column in its own cell, with a button, and a field with a hidden value with the number of the row.
It just displays the first row. Nothing else.
Anybody see anything wrong?
Thank you
Code: Select all
<?php
error_reporting('e_all');
$page = "view submitted.";
$username2= "muot_report";
$password2= "passs";
$database2= "muot_report";
$connection2 = mysql_connect('localhost',$username2,$password2);
mysql_select_db($database2);
?>
<table border=1>
<tr>
<td align=center><font color=red><b>ID #</b></font></td>
<td align=center><font color=red><b>Description</b></font></td>
<td align=center><font color=red><b>Live</b></font></td>
</tr>
<?php
$sql = "SELECT *
FROM `report` DESC";
$query = mysql_query($sql);
while($row = mysql_fetch_array($query)) {
echo '<tr><td>';
echo '<form action=/updateMuot.php method=post>';
echo $row["Code"];
echo '<br>';
echo '<input type=submit value="Make Default Muot">';
echo '<input type=hidden name=who value=$row["Number"]>';
echo '</form>';
echo '</td></tr>';
};
mysql_close($connection2);
?>
</table>It just displays the first row. Nothing else.
Anybody see anything wrong?
Thank you
- nickman013
- Forum Regular
- Posts: 764
- Joined: Sun Aug 14, 2005 12:02 am
- Location: Long Island, New York
- nickman013
- Forum Regular
- Posts: 764
- Joined: Sun Aug 14, 2005 12:02 am
- Location: Long Island, New York
It takes 2 queries
Code: Select all
UPDATE table set `live` = 0
UPDATE table set `live` = 1 WHERE `id` = 2- nickman013
- Forum Regular
- Posts: 764
- Joined: Sun Aug 14, 2005 12:02 am
- Location: Long Island, New York
Code: Select all
mysql_query('UPDATE table set `live` = 0');
mysql_query('UPDATE table set `live` = 1 WHERE `id` = 2');- nickman013
- Forum Regular
- Posts: 764
- Joined: Sun Aug 14, 2005 12:02 am
- Location: Long Island, New York