PHP / MySQL - Query not fetching any data -
i have been trying set page lists prices of items table in database. here code:
<?php $querylist = mysql_query("select item_name,image,price,added_by values"); while($row = mysql_fetch_array($querylist)) { echo '<div class="post rareitem" style="margin-right: 15px;float: left;"> <div class="rarename"> <strong>'; // shows item name echo $row['item_name']; echo '</strong> </div>'; // shows item image echo '<div class="rareimage" style="background-image: url(/app/tpl/skins/mango/images/values/rares/'; echo $row['image']; echo ');"></div>'; // shows item price echo '<div class="rarecontrols"> <div class="coinsbox"></div> <span> <b> <b>credits: </b> </b> '; echo $row['price']; echo '</span>'; // shows added item echo '<div class="addedbox"></div><b><b><span><font color="#c93734"><font color="#c93734">added by: </font> </font>'; echo $row['added_by']; echo '</span></b></b> </div> <div class="clear"></div> </div>'; } ?>
there chunk of code (shown below) have based off of, , works fine. can't seem work though. believe has sql, syntax, or something. no matter do, produces absolutely no results, yet code below results planned. know fact not connection issue because below code can placed on same exact page above 1 , works fine, above not.
<?php $querylist = mysql_query("select id,username,motto,country,look,rank,account_created,role,account_created,online,last_online users rank='9' order id limit 20"); while($row = mysql_fetch_array($querylist)) { echo ' <div class="team">'; // showing avatar echo '<div style="float: left; margin-top:-1px;height: 60px; width: 64px; background: url(http://www.habbo.nl/habbo-imaging/avatarimage?figure='; echo $row['look'];echo "&action=wav&direction=3&head_direction=3&gesture=sml&size=m) no-repeat 0px -10px"; echo "\"/>"; echo "<img alt=\"badge\" src=\"/app/tpl/skins/habbo/images/icons/"; echo $row['online'];echo ".gif\"></div>"; // flags echo "<br/><img src=\"/app/tpl/skins/habbo/images/icons/flags/"; echo $row['country'];echo ".png"; echo '" style="float:right;" /> <b><uf>'; echo $row['username'];echo "</u></b>"; // bans & ticket count $bans = mysql_query("select * `bans` `added_by` = '" . $row['username'] . "'"); $bancount = mysql_num_rows($bans); $tickets = mysql_query("select * `moderation_tickets` `moderator_id` = '" . $row['id'] . "'"); $ticketcount = mysql_num_rows($tickets); //role echo "<br/><gb>role: </b><fi> "; echo $row['role'];echo ""; echo "</i>"; // echoing bans & tickets echo "<br/><gb>bans: </b><fi> "; ; echo $bancount; echo "</i>"; echo " <gb>tickets: </b><if>"; ; echo $ticketcount; echo "</i>"; echo "</div>"; } ?>
thanks in advanced, assistance appreciated!
values reserved words in mysql should on backtick
select item_name,image,price,added_by `values`
and stop using mysql deprecated. instead use mysqli or pdo
Comments
Post a Comment