impauls Posted August 12, 2011 Posted August 12, 2011 i got an error about mysql_num_rows()... i dont know if its because of my connection or my codes... this is my code connecting to database... connect.php i am connecting to my database on my heliohost localhost <?php $host = "localhost"; $user = "impauls_admin"; // created user with all privileges $userpassword = "123654789"; $database = "impauls_ordersystem_db"; $connect = mysql_connect($host, $user ,$userpassword); if(!$connect) { die('Could not connect: ' . mysql_error()); } mysql_select_db ($database, $connect); ?> here is the link on my webpage... http://igt-order.impauls.heliohost.org/ thanks in advance...
Krydos Posted August 12, 2011 Posted August 12, 2011 Would you mind posting the code of homecontent.php, especially lines 53, 91, and 139?
impauls Posted August 12, 2011 Author Posted August 12, 2011 here sir... error upon mysql_num_rows() <script src="js/jquery-1.5.1.min.js"></script> <script src="js/jquery-ui.js"></script> <script src="js/truncate.js"></script> <script> $(function() { $(".news_content").truncate({max_length: 200}); $("#dialog:ui-dialog").dialog("destroy"); $("#product_details").dialog({ autoOpen: false, height: 370, width: 300, modal: true, buttons: { Close: function() { $( this ).dialog( "close" ); } } }); }); function show_details(product_id) { var myData = "id=" + product_id + "&purpose=" + "product_details"; $.ajax({ type: "POST", url: "modules/sessionset.php", data: myData, cache: true, success: function(){ $('#product_details').load("modules/methodholder.php"); }, error: function(){ alert('Failed to load.'); } }); $("#product_details").dialog("open"); } </script> <table> <tr valign="top"> <td colspan="5"> <table> <tr> <th class="home_header">News Feed</th> </tr> <?php include ("connect.php"); $sqlQuery = "SELECT * FROM NEWS WHERE status = 'Active' ORDER BY 1 DESC"; $newsdetails = mysql_query($sqlQuery); $new_ctr = mysql_num_rows($newsdetails); if ($new_ctr >= 1) { while(($row = mysql_fetch_array($newsdetails)) || ($ctr == 5)) { echo "<tr>"; echo "<td colspan='5'>" . $row['title'] . "</td>"; echo "</tr>"; echo "<tr>"; echo "<td class='news_content' colspan='5'>" . $row['content'] . "</td>"; echo "</tr>"; } echo "<tr>"; echo "<td><a href='news.php'>View All</a></td>"; echo "</tr>"; } else { echo "<tr>"; echo "<td>No news update.</td>"; echo "</tr>"; } ?> </table> </td> </tr> <tr><td colspan="5" width="800"><hr /></td></tr> <tr valign="top"> <td> <table> <tr> <th class="home_header">New Products</th> </tr> <tr> <?php include ("connect.php"); $sqlQuery = "SELECT * FROM PRODUCT WHERE date_added >= subdate(curdate(), INTERVAL 7 DAY) AND status = 'Available' ORDER BY date_added DESC LIMIT 10"; $newproduct = mysql_query($sqlQuery); $new_ctr = mysql_num_rows($newproduct); if ($new_ctr >= 1) { $ctr = 1; while($row = mysql_fetch_array($newproduct)) { echo "<td align='center' class='cell'>"; echo "<a onclick='show_details(\"" . $row['product_id'] . "\")'><img height='70px' src='images/products/" . $row['product_code'] . ".jpg' alt='no image' /></a><br/>"; echo "<a onclick='show_details(\"" . $row['product_id'] . "\")'>" . $row['product_code'] . "<br />"; echo $row['model'] . "<br />"; echo $row['price'] . ".00 Php<br />"; echo "</td>"; if($ctr == 5) { echo "</tr><tr>"; $ctr = 1; } else { $ctr++; } } echo "</tr>"; echo "<tr>"; echo "<td><a href='products.php'>View All Products</a></td>"; echo "</tr>"; } else { echo "<tr>"; echo "<td>No new product. <a href='products.php'>View All</a></td>"; echo "</tr>"; } ?> </table> </td> </tr> <tr><td colspan="5" width="800"><hr /></td></tr> <tr valign="top"> <td> <table> <tr> <th class="home_header">Updated Products</th> </tr> <tr> <?php $sqlQuery = "SELECT * FROM PRODUCT WHERE date_updated >= (subdate(curdate(), INTERVAL 7 DAY)) AND (date_updated != date_added) AND status = 'Available' ORDER BY date_updated DESC LIMIT 10"; $updated = mysql_query($sqlQuery); $updated_ctr = mysql_num_rows($updated); if ($updated_ctr >= 1) { $ctr = 1; while($row = mysql_fetch_array($updated)) { echo "<td align='center' class='cell'>"; echo "<a onclick='show_details(\"" . $row['product_id'] . "\")'><img height='70px' src='images/products/" . $row['product_code'] . ".jpg' alt='no image' /></a><br/>"; echo "<a onclick='show_details(\"" . $row['product_id'] . "\")'>" . $row['product_code'] . "<br />"; echo $row['model'] . "<br />"; echo $row['price'] . ".00 Php<br />"; echo "</td>"; if($ctr == 5) { echo "</tr><tr>"; $ctr = 1; } else { $ctr++; } } echo "</tr>"; echo "<tr>"; echo "<td><a href='products.php'>View All</a></td>"; echo "</tr>"; } else { echo "<tr>"; echo "<td>No updated product. <a href='products.php'>View All</a></td>"; echo "</tr>"; } ?> </table> </td> </tr> </table> <div id="product_details" title="Product Details"> </div> by the way sir... everything is working, i tested it in my WAMP Server...
PenTester Posted August 12, 2011 Posted August 12, 2011 by the way sir... everything is working, i tested it in my WAMP Server... So your problem solved, right?
impauls Posted August 12, 2011 Author Posted August 12, 2011 by the way sir... everything is working, i tested it in my WAMP Server... So your problem solved, right? not yet sir... i need to host the site online... i need to fixed the errors on the webhost site... paypal api is not working with localhost / WAMP Server problem solved... i know whats the problem now...
jje Posted August 12, 2011 Posted August 12, 2011 Next time wrap your code with [code][/CODE] - makes it easier for us. Glad your problem got solved! Please spare a few minutes to take our brief survey: http://feedback.heliohost.org/ Your participation in this survey is greatly appreciated.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now