Php code in html not working as expected -
i want use code results database , show in html not happening. getting weird results , not able fix it.
it display } ? > on webpage @ end wonder why.and cannot results database displayed either.
database proper believe error in html , php code(php variables in html tags).
<?php while($row = mysqli_fetch_array($result)) { $price = ($row['isbn']%1000); echo $price; <li> <div class="book-display-bg"> <div class="book-display-placeholder"> <div class="book-display-container"> <div class="book-display-centered"> <a href='product/taqatu-niran-min-yaumiyat-al-intifada-as-suriya-9789953892368-(105523).html' > <img src=''$row['image_url_m']'' style='border: 0;' alt=''$row['book_title']''/> </a> </div> </div> </div> </div> <div class="book-display-details"> <div class="book-display-title"><p><a href='product/taqatu-niran-min-yaumiyat-al-intifada-as-suriya-9789953892368-(105523).html' title=''$row['book_title']'' >$row['book_title']</a></p></div> <div class="book-display-author"><p>$row['book_author']</p></div> <div id="ctl00_ctl00_cmscontentmasterplaceholder_cphcontent1_ctl01_productsummary1_datalist1_ctl02_divstock" class="book-display-stock"></div> <div class="book-display-price">$price</div> <input type="submit" name="ctl00$ctl00$cmscontentmasterplaceholder$cphcontent1$ctl01$productsummary1$datalist1$ctl02$btnbuynow" value="add basket" id="ctl00_ctl00_cmscontentmasterplaceholder_cphcontent1_ctl01_productsummary1_datalist1_ctl02_btnbuynow" title="add basket" class="ecom-add-basket" /> </div> <div class="clear"></div> </li> } ?>
thanks in advance
you forget add echo li element. can try following:
<?php while($row = mysqli_fetch_array($result)) { $price = ($row['isbn']%1000); echo $price; ?> <li> <div class="book-display-bg"> <div class="book-display-placeholder"> <div class="book-display-container"> <div class="book-display-centered"> <a href='product/taqatu-niran-min-yaumiyat-al-intifada-as-suriya-9789953892368-(105523).html' > <img src='<?php echo $row['image_url_m']; ?>' style='border: 0;' alt='<?php echo $row['book_title']; ?>'/> </a> </div> </div> </div> </div> <div class="book-display-details"> <div class="book-display-title"><p><a href='product/taqatu-niran-min-yaumiyat-al-intifada-as-suriya-9789953892368-(105523).html' title='<?php echo $row['book_title']; ?>' ><?php echo $row['book_title']; ?></a></p></div> <div class="book-display-author"><p><?php echo $row['book_author']; ?></p></div> <div id="ctl00_ctl00_cmscontentmasterplaceholder_cphcontent1_ctl01_productsummary1_datalist1_ctl02_divstock" class="book-display-stock"></div> <div class="book-display-price"><?php echo $price; ?></div> <input type="submit" name="ctl00$ctl00$cmscontentmasterplaceholder$cphcontent1$ctl01$productsummary1$datalist1$ctl02$btnbuynow" value="add basket" id="ctl00_ctl00_cmscontentmasterplaceholder_cphcontent1_ctl01_productsummary1_datalist1_ctl02_btnbuynow" title="add basket" class="ecom-add-basket" /> </div> <div class="clear"></div> </li><?php } ?>
or can way:
<?php while($row = mysqli_fetch_array($result)) { $price = ($row['isbn']%1000); echo $price; echo '<li> <div class="book-display-bg"> <div class="book-display-placeholder"> <div class="book-display-container"> <div class="book-display-centered"> <a href="product/taqatu-niran-min-yaumiyat-al-intifada-as-suriya-9789953892368-(105523).html" > <img src="' . $row['image_url_m'] . '" style="border: 0;" alt="$row[\'book_title\']"/> </a> </div> </div> </div> </div> <div class="book-display-details"> <div class="book-display-title"><p><a href="product/taqatu-niran-min-yaumiyat-al-intifada-as-suriya-9789953892368-(105523).html" title="' . $row['book_title'] . '" >' . $row['book_title'] . '</a></p></div> <div class="book-display-author"><p> ' .$row['book_author'] . '</p></div> <div id="ctl00_ctl00_cmscontentmasterplaceholder_cphcontent1_ctl01_productsummary1_datalist1_ctl02_divstock" class="book-display-stock"></div> <div class="book-display-price">' . $price . '</div> <input type="submit" name="ctl00$ctl00$cmscontentmasterplaceholder$cphcontent1$ctl01$productsummary1$datalist1$ctl02$btnbuynow" value="add basket" id="ctl00_ctl00_cmscontentmasterplaceholder_cphcontent1_ctl01_productsummary1_datalist1_ctl02_btnbuynow" title="add basket" class="ecom-add-basket" /> </div> <div class="clear"></div> </li>'; } ?>
hope helped
Comments
Post a Comment