Dethman Posted July 25, 2008 Share Posted July 25, 2008 hey guys there is no error but it wont display anything :S , Can't figure out why. here is the function code: <?php function showCatigories(){ //Global Call For $rowsPerPage global $rowsPerPage; //Query Var: $q="SELECT * FROM `GLASS_CATIGORIES` ORDER BY `id` ASC LIMIT $rowsPerPage"; //Query"" $v=mysql_query($q) or die("Unable to Select All From C-MORE-GLASS_CATIGORIES And Ascend".mysql_error()); $row=mysql_fetch_array($v); $count=mysql_num_rows($v); if($count==0){ $catigories=("<div class='black-box'><td colspan=4 align=center><b><i>There are no Catigories Added to the System Yet. Try back at a later time</b></i></td></div>"); } else{ while($row=mysql_fetch_array($v)){ $catigories=(" <div class='black-box'> <h2><em>".$row['name']."</em> collection</h2> <p><img src='img/src/".$row['src']."' width='120' height='105' alt='Pic ".$row['id']."' /></p> <p>".$row['info']."</p> <p class='more'><a href='index.php?page=".$row['page']."'>More</a></p> </div> "); } } return $catigories; } ?> Here is the call: <?php $catagorie=showCatigories(); ?> Thanx for any help, but it would be nice to have some help soon Dethman AKA Brian Flores CEO of NimbusGames,llc PS: I put stuff in the Table so it should display something atleast. Thanx Again Quote Link to comment Share on other sites More sharing options...
Psycho Posted July 25, 2008 Share Posted July 25, 2008 OK, not to be mean, but there are no echo's or print calls, so why would anything be written tot he page. The function only create a variable and returns it. But, your call to the function only assignes the value to another variable and does not write it ot the page. Try changing your function call to <?php echo showCatigories(); ?> EDIT: By the way, it should be spelled "catagories". Quote Link to comment Share on other sites More sharing options...
Dethman Posted July 25, 2008 Author Share Posted July 25, 2008 I have further down on the page <?echo($catigories);?> Quote Link to comment Share on other sites More sharing options...
Dethman Posted July 25, 2008 Author Share Posted July 25, 2008 sorry it was <?echo($catagorie);?> Quote Link to comment Share on other sites More sharing options...
deth4uall Posted July 25, 2008 Share Posted July 25, 2008 hey punk make sure you put: global $rowsPerPage; $rowsPerPage = 8; Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted July 25, 2008 Share Posted July 25, 2008 1.) You should be using the .= operator, not =, to append to $catagories. You should also create the variable as an empty string prior to this to prevent an undefined variable notice. 2.) Nothing is displayed? What does that mean? Completely blank page? Did you check the source? Quote Link to comment Share on other sites More sharing options...
Dethman Posted July 25, 2008 Author Share Posted July 25, 2008 Ok thanx deth that worked once I put $rowsPerPage=8; inside the function so now its giving me an SQL error lol here is the SQL Error: Unable to Select All From C-MORE-GLASS_CATIGORIES And Ascend: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 Query Line: <?php $q="SELECT * FROM `GLASS_CATIGORIES` ORDER BY `id` ASC LIMIT $rowsPerPage"; ?> Quote Link to comment Share on other sites More sharing options...
deth4uall Posted July 25, 2008 Share Posted July 25, 2008 Try using this and put $offSet in input to the function. <?php $q="SELECT * FROM `GLASS_CATIGORIES` ORDER BY `id` ASC LIMIT $offSet, $rowsPerPage"; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.