PHP- insert innerhtml with javascript dynamically in each row of table -
innerhtml not working in case, want this:
<table width="100%" border="0" id="table2"> <?php include("connection.php"); $sql=mysql_query("select* b1"); while($res=mysql_fetch_array($sql)) { $img=$res["img"]; $url=$res["url"]; ?> <tr> <td><script>document.body.innerhtml="<a href='"+<?php echo '$url' ; ?>.value+"'><img src='"+<?php echo '$img' ; ?>+"' / ></a>" ;</script></td> </tr> <?php } ?> </table>
why don't this?
<table width="100%" border="0" id="table2"> <?php include("connection.php"); $sql=mysql_query("select* b1"); while($res=mysql_fetch_array($sql)) { $img=$res["img"]; $url=$res["url"]; ?> <tr> <td><a href="<?php echo $url ; ?>"><img src="<?php echo $img; ?>" / ></a></td> </tr> <?php } ?> </table>
Comments
Post a Comment