Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why this code doesn't work?

Status
Not open for further replies.

technisup

Programmer
Sep 28, 2007
41
US
I come from programming in ASP and i think exists similar things in a programming level, but i'm trying to do this code:
[/b]
<?php
$rsp=mysql_query("select hv.*, herencia.* from hv left join herencia on hv.identificacion=herencia.hijo order by hv.nombre ", $link);
$i=1
while ($rscon=mysql_fetch_array($rsp)){
?>
<tr>
<td><?php echo $i; ?></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><img src="images/accessories-text-editor.png" width="16" height="16"></td>
<td><img src="images/user-trash-full.png" width="16" height="16"></td>
</tr>
<?php
$i++;}
?> [/b]

I know that i can use the echo and print the whole line, and in this case is easy but when i have to convert more lines is really exhausting.
 
add a semicolon after $i=1. all lines must be terminated by semicolons in php, unless they are process control functions that use curly braces (e.g. while () { is not terminated)
 
Putting aside the missing ";" after the $i=1

You do realize you aren't using the results from your query anywhere inside your While loop?







----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top