Buenas, si funciona , pero no soy capaz de ponerla para que funcione correctamente,
si la pongo as´:
Código PHP:
if(mysql_num_rows($registro)>0){
while($registro2 = mysql_fetch_array($registro)){
echo '<tr>
<td>'.$registro2['Cod_Art'].'</td>
<td>'.$registro2['Referencia'].'</td>
<td>'.$registro2['Nom_Art'].'</td>
<td align="center">'.$registro2['Und_Vend'].'</td>
<td align="center">'.$registro2['Stock_Total'].'</td>
<td align="center">'.$registro2['Und_Comp'].'</td>
<td align="center">'.$registro2['PMV'].'€</td>
<td align="center">'.$registro2['Pvta_Art'].'€</td>
<td align="center">'.$registro2['VtCom'].' %</td>
<td align="center">'.$registro2['Vtas_Imp'].'€</td>'
if (file_exists($registro2['Fotos'])) {
echo '<td><img src=imagenes'.'/'.$registro2['Fotos'].' border="0" width="150" height="100"></td>';
} else {
echo 'El fichero $nombre_fichero no existe';
}'</tr>';
me devuelve error: unexpected 'if' (T_IF), expecting ',' or ';' en línea 42 , que es donde comienza el IF.
Si lo pongo de esta otra:
Código PHP:
if(mysql_num_rows($registro)>0){
while($registro2 = mysql_fetch_array($registro)){
echo '<tr>
<td>'.$registro2['Cod_Art'].'</td>
<td>'.$registro2['Referencia'].'</td>
<td>'.$registro2['Nom_Art'].'</td>
<td align="center">'.$registro2['Und_Vend'].'</td>
<td align="center">'.$registro2['Stock_Total'].'</td>
<td align="center">'.$registro2['Und_Comp'].'</td>
<td align="center">'.$registro2['PMV'].'€</td>
<td align="center">'.$registro2['Pvta_Art'].'€</td>
<td align="center">'.$registro2['VtCom'].' %</td>
<td align="center">'.$registro2['Vtas_Imp'].'€</td>';
if (file_exists($registro2['Fotos'])) {
echo '<td><img src=imagenes'.'/'.$registro2['Fotos'].' border="0" width="150" height="100"></td>';
} else {
echo 'El fichero $nombre_fichero no existe';
}'</tr>';
me pone para todas las imágenes que no existen , pero fuera del <tr> y luego dentro del <tr> justo lo que está antes del IF.