Page 1 of 1
Help about selected row.. php HTML mysql
Posted: Sun Jul 25, 2010 9:59 am
by nemesisphp
Hello guys.. what i have here is the code of fetching the arrays of data in mySQL database..
i have this <a> tag here and i want to send the value of the specific selected row.. can you help me please?
here is my work
Code: Select all
<?php
@require('connection.php');
$query = "SELECT * FROM SUBJECTS WHERE CODE = '$code'";
$result = mssql_query($query);
$count = mssql_num_rows($result);
while($row = mssql_fetch_array($result))
{?>
<li class="menu">
<a class="noeffect" href="http://localhost/whereitgoes.php">
<img src="../thumbs/mail.png"; /><span class="name">
<?php
echo $row['CODE'];
?>
</span><span class="arrow"></span></a></li>
<?php }?>
after i have loop the values..
how can i get the selected value?

Re: Help about selected row.. php HTML mysql
Posted: Sun Jul 25, 2010 11:16 am
by liljester
you can either do what you need to do with the values as they loop, or you can save them to an array for later use.
Re: Help about selected row.. php HTML mysql
Posted: Sun Jul 25, 2010 12:24 pm
by Thizzle
Try this:
Code: Select all
$row = mysql_fetch_array($result);
Where $row is the variable you want to store the row in...
to call on individual columns type : $row['columnname']
Re: Help about selected row.. php HTML mysql
Posted: Sun Jul 25, 2010 2:56 pm
by liljester
thizzle, hes doing that in the code that he posted.
Re: Help about selected row.. php HTML mysql
Posted: Sun Jul 25, 2010 3:52 pm
by Thizzle
Oops sorry... Here.
Code: Select all
<?php
include 'connection.php';
$query = ("SELECT code FROM SUBJECTS");
$result = mysql_query($query);
$row = mssql_fetch_array($result);
$code = $row['code'];
?>
<li class="menu">
<a class="noeffect" href="http://localhost/whereitgoes.php">
<img src="../thumbs/mail.png"; /><span class="name">
<?php
echo $code;
?>
</span><span class="arrow"></span></a></li>
Re: Help about selected row.. php HTML mysql
Posted: Sun Jul 25, 2010 5:39 pm
by nemesisphp
There is a problem in your post thizzle..
The main problem is the loop.. on your code i can no longer see all the values(Loop) in my <li><a> tags
How can i manage them? thanks

Re: Help about selected row.. php HTML mysql
Posted: Sun Jul 25, 2010 7:00 pm
by liljester
can you be more specific with what you want to do to the values? the loop that you posted looks correct, it should print out the code for each row. i guess i dont understande exactly what it is youre wanting to do with those values?
Re: Help about selected row.. php HTML mysql
Posted: Mon Jul 26, 2010 12:44 am
by nemesisphp
Code: Select all
<?php
@require('connection.php');
$query = "SELECT * FROM SUBJECTS WHERE CODE = '$code'";
$result = mssql_query($query);
$count = mssql_num_rows($result);
while($row = mssql_fetch_array($result))
{?>
<li class="menu">
<a class="noeffect" href="http://localhost/whereitgoes.php">
<img src="../thumbs/mail.png"; /><span class="name">
<?php
echo $row['CODE'];
?>
</span><span class="arrow"></span></a></li>
<?php }?>
Sorry for the clarity of my problem..
i want to maintain the
while { } in my code to display list according to what i have in my database..
The problem is .. how can i get the value of the selected list that is coming from the loop..
For more clarification
if i have 3 rows
row1
row2
row3
in thizzle's code.. i can only get row1..
so i need to use while in order to catch up with the overall results..
Now what i want is how to get the selected row.. if i select row3.. how can i manage to send the data having row3?

Re: Help about selected row.. php HTML mysql
Posted: Mon Jul 26, 2010 7:46 am
by nemesisphp
Up
Re: Help about selected row.. php HTML mysql
Posted: Tue Jul 27, 2010 9:29 am
by nemesisphp
up
Re: Help about selected row.. php HTML mysql
Posted: Tue Jul 27, 2010 4:10 pm
by internet-solution
nemesisphp wrote:
The problem is .. how can i get the value of the selected list that is coming from the loop..
......
Now what i want is how to get the selected row.. if i select row3.. how can i manage to send the data having row3?

What do you mean by "selected list" or "selected row"? How are you selecting?