Hello All
I need a little help with a phph script to display some specific data from a mysql table.
I have a mysql table with 4 columns and 10 rows. I want to display fx. data from row 4, 6, 8 and 10.
I can display either the first row or all the rows using the below code:
[PHP]$row = mysql_fetch_arr ay($result) or die(mysql_error ());
echo $row['id']. " - ". $row['Thickness']. " <img src=images/arlon.jpg /> ". $row['Type']. " - ". $row['Sum'];
echo "<br />";[/PHP]
[PHP]while($row = mysql_fetch_arr ay($result)){
echo $row['id']. " - ". $row['Thickness']. " <img src=images/arlon.jpg /> ". $row['Type']. " - ". $row['Sum'];
echo "<br />";[/PHP]
}
Can someone tell me how to fetch a specific row of data......????? ?
I have tried with $row[2] but without any luck.....
Below is my entire code:
[PHP]<?
$username="xxxx xx";
$password="xxxx xx";
$database="prin tline";
$localhost="mys ql.webglobe.dk" ;
mysql_connect($ localhost,$user name,$password) ;
@mysql_select_d b($database) or die( "Unable to select database");
//$query="SELECT * FROM test";
$query="SELECT * FROM test3";
$result = mysql_query($qu ery) or die(mysql_error ());
$row = mysql_fetch_arr ay($result) or die(mysql_error ());
echo $row['id']. " - ". $row['Thickness']. " <img src=images/arlon.jpg /> ". $row['Type']. " - ". $row['Sum'];
echo "<br />";
$row[2] = mysql_fetch_arr ay($result) or die(mysql_error ());
echo $row['id']. " - ". $row['Thickness']. " <img src=images/arlon.jpg /> ". $row['Type']. " - ". $row['Sum'];
echo "<br />";
?>[/PHP]
I need a little help with a phph script to display some specific data from a mysql table.
I have a mysql table with 4 columns and 10 rows. I want to display fx. data from row 4, 6, 8 and 10.
I can display either the first row or all the rows using the below code:
[PHP]$row = mysql_fetch_arr ay($result) or die(mysql_error ());
echo $row['id']. " - ". $row['Thickness']. " <img src=images/arlon.jpg /> ". $row['Type']. " - ". $row['Sum'];
echo "<br />";[/PHP]
[PHP]while($row = mysql_fetch_arr ay($result)){
echo $row['id']. " - ". $row['Thickness']. " <img src=images/arlon.jpg /> ". $row['Type']. " - ". $row['Sum'];
echo "<br />";[/PHP]
}
Can someone tell me how to fetch a specific row of data......????? ?
I have tried with $row[2] but without any luck.....
Below is my entire code:
[PHP]<?
$username="xxxx xx";
$password="xxxx xx";
$database="prin tline";
$localhost="mys ql.webglobe.dk" ;
mysql_connect($ localhost,$user name,$password) ;
@mysql_select_d b($database) or die( "Unable to select database");
//$query="SELECT * FROM test";
$query="SELECT * FROM test3";
$result = mysql_query($qu ery) or die(mysql_error ());
$row = mysql_fetch_arr ay($result) or die(mysql_error ());
echo $row['id']. " - ". $row['Thickness']. " <img src=images/arlon.jpg /> ". $row['Type']. " - ". $row['Sum'];
echo "<br />";
$row[2] = mysql_fetch_arr ay($result) or die(mysql_error ());
echo $row['id']. " - ". $row['Thickness']. " <img src=images/arlon.jpg /> ". $row['Type']. " - ". $row['Sum'];
echo "<br />";
?>[/PHP]
Comment