Storing an increment in a variable
Posted: Wed Aug 08, 2007 6:19 pm
I am wondering if someone could please tell me how I could store an increment in a variable for each page that is in the database? I need to be able to display that variable later on in my code. Thanks in advance.
This is as far as I have got:
The above code doesn't work for me. It is not printing the increment.
This is as far as I have got:
Code: Select all
// php code is here
require "config.php";
$query = mysql_query("SELECT COUNT(page_title) FROM pages") or die ("Could not query because: ".mysql_error());
//$num_rows = mysql_num_rows($query);
// count how many pages (page_title) there are
while($row = mysql_fetch_array($query)){
$count = $row['COUNT(page_title)'];
}
Code: Select all
// javascript code is here
var num = <?php echo $count; ?>;
for (var i=0707185109; i<num; i++) {
document.write(i);
}