Please see my php-codes below,first one works as it should be. It will echo all data (based on values from text fields) from database. If there is multiple values it will print all data separated at rows. This will be printed straightly to web-page without table.
Another code should print all data at multiple cases (based on values from text fields) at the table, but in some reason it will only print one result.Even that there´s more data at the database. Any suggestions to fix this?
Codes below, first one(which works):
<?php
mysql_connect("","","");
mysql_select_db("");
$search_value = $_GET['value'];
$search_value2 = $_GET['value2'];
$query = "select * from data where data1 like '$search_value' and data2 like '$search_value2'";
$run = mysql_query($query);
while($row=mysql_fetch_array($run)){
$data1 = $row['data1'];
$data2 = $row['data2'];
echo "<h1>$data1</h1>";
echo "<h1>$data2</h1>";
}
?>
Another one(which print only one row to the table)
<?php
mysql_connect("","","");
mysql_select_db("");
$search_value = $_GET['value'];
$search_value2 = $_GET['value2'];
$query = "select * from data where data1 like '$search_value' and data2 like '$search_value2'";
$run = mysql_query($query);
while($row=mysql_fetch_array($run)){
{
print('<tr>');
print(' <td>');
print $row["data1"];
print('</td>');
print(' <td>');
print $row["data2"];
print('</td>');
print('</tr>');
print ("\n");
}
mysql_free_result($run);
}
?>
Any help is appreciated.
$data1
";` Replace that with `echo "$tyonumero
";` etc. – Funk Forty Niner Mar 23 '14 at 14:05