Jump to content

[SOLVED] help me about this please... thanks


impauls

Recommended Posts

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...

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...