I've altered the code a little - here is a little of the output :-
this is issue:19
this is topic: An Interview with a Flood Study
this is topic: Regular Section - ALS will visit...
this is topic: Regular Section - In Brief
this is topic: Surveyors Surveyed: Results of Readers Questionnaire
this is topic: When is a Helicopter or Fixed Wing the More Appropriate
this is topic: Forrestry LiDAR Discussion List
this is topic: The Truth, the whole truth and nothing but the ground truth.
this is topic: Q&A from Readers' Questionnaire
this is topic: ALS Research Finally Underway
this is topic: Happy New Year for the Year of the Goat
this is topic: Regular Section - Scan Art
this is issue:19
this is topic: An Interview with a Flood Study
which repeats with different newsletter issues - I now get this error:-
Warning: Unable to jump to row 54 on MySQL result index 2 in /home/httpd/testurl on line 87
this is issue:
You have an error in your SQL syntax near '' at line 1
I altered the code a little to get to this stage as there were other problems, here it is :-
[php]<?php
@ $db = mysql_pconnect("localhost", "aam","8ychmqp");
if (!$db)
{
echo "Error: Could not connect to database. Please try again later.";
exit;
}
// get results from horizon and topic tables
mysql_select_db("dtabase");
$query = "select * from topics, horizons ";
// query "a"
$resulta = mysql_query($query) or die(mysql_error());
// row count "a"
$num_resultsa = mysql_num_rows($resulta);
// loop "a"
for($a=0;$i<$num_resultsa;$a++)
{
$issue_id=mysql_result($resulta,$a,"issue");
echo "this is issue:" . $issue_id . "<br>\n";
// query "b"
$query2="select * from topics where issue =$issue_id";
$resultb=mysql_query($query2) or die(mysql_error());
// row count "b"
$num_resultsb=mysql_num_rows($resultb);
// loop "b"
for($b=0;$b<$num_resultsb;$b++)
{
$topic_id=mysql_result($resultb,$b,"topic");
echo "this is topic: " . $topic_id . "<br>\n";
}
}
and I thought was going to be easy!
|