My issue it that I try to repeat a mysql region with such a code:
Code: Select all
do {
}while ($row_get_recordset = mysql_fetch_assoc($get_recordset));of<td>' . $row_get_info['spesifikk'] . ' </td>
Code: Select all
if ($currentcategory == 7)
{
//getinfo
mysql_select_db($database_hardware, $hardware);
$query_get_info = 'SELECT c.name, d.name as "developername", d.webpage as "developerweb", s.name as "spesifikk", c.photo, c.description
FROM chasis_has_spesifikkstandard cas
JOIN chasis c ON cas.chasis_id = c.id
JOIN developer d ON c.developer_iddeveloper = d.iddeveloper
JOIN spesifikkstandard s ON cas.spesifikkstandard_idstandard = s.idstandard
WHERE c.id = ' . $currentid . '';
$get_info = mysql_query($query_get_info, $hardware) or die(mysql_error());
$row_get_info = mysql_fetch_assoc($get_info);
$hardwareinfo.='
<table>
<tr>
<td>Name</td>
<td>' . $row_get_info['name'] . ' </td>
<td colspan="5" rowspan="8" valign="right" align="right" ><img height="170px" width = "200px" src="images/hardware/' . $row_get_info['photo'] . '" /></td>
</tr>
<tr>
<td>Developer</td>
<td><a href="' . $row_get_info['developerweb'] . '">' . $row_get_info['developername'] . ' </a></td>
</tr>
<tr>
<td>Supported cards</td>
<td>' . $row_get_info['spesifikk'] . ' </td>
</tr>
<td colspan="2" width="430px" height="200px" valign="top">
<p><br /></p>
<div style="text-wrap:normal">
' . $row_get_info['description'] . '
</div>
</td>
<tr>
</table>';
}Later I use
Code: Select all
echo $hardwareinfo;I tried to edit the code like this:
Code: Select all
if ($currentcategory == 7)
{
//getinfo
mysql_select_db($database_hardware, $hardware);
$query_get_info = 'SELECT c.name, d.name as "developername", d.webpage as "developerweb", s.name as "spesifikk", c.photo, c.description
FROM chasis_has_spesifikkstandard cas
JOIN chasis c ON cas.chasis_id = c.id
JOIN developer d ON c.developer_iddeveloper = d.iddeveloper
JOIN spesifikkstandard s ON cas.spesifikkstandard_idstandard = s.idstandard
WHERE c.id = ' . $currentid . '';
$get_info = mysql_query($query_get_info, $hardware) or die(mysql_error());
$row_get_info = mysql_fetch_assoc($get_info);
$supported = '';
do {
$supported .= '<td>' . $row_get_info['spesifikk'] . ' </td>';
}while ($row_get_info = mysql_fetch_assoc($get_info));
$hardwareinfo.='
<table>
<tr>
<td>Navn</td>
<td>' . $row_get_info['name'] . ' </td>
<td colspan="5" rowspan="8" valign="right" align="right" ><img height="170px" width = "200px" src="images/hardware/' . $row_get_info['photo'] . '" /></td>
</tr>
<tr>
<td>Utvikler</td>
<td><a href="' . $row_get_info['developerweb'] . '">' . $row_get_info['developername'] . ' </a></td>
</tr>
<tr>
<td>Støttet hovedkorttyper</td>
' . $supported . '
</tr>
<td colspan="2" width="430px" height="200px" valign="top">
<p><br /></p>
<div style="text-wrap:normal">
' . $row_get_info['description'] . '
</div>
</td>
<tr>
</table>';
}
Code: Select all
do {
}while ($row_get_info = mysql_fetch_assoc($get_info));Any suggestions on how I can solve this? First time php, and I appoligies for any obvious mistakes.