I have a huge music publishers address list and do not want to create (and re-type) a page per publisher.
Instead I imported the whole list into a database (pianoquartet) in one table (publisher).
I managed to display a list of those publishers showing only the name field.
Now I want the namefield tolink to the rest of the details of that publisher.
When viewing the code through PHP editor i getfolloing errors:
So "undefined index", which should come from this statement:<br />
<b>Notice</b>: Undefined index: idpd in <b>C:\Documents and Settings\Frank\My Documents\My Sites\php\franklos\listpub_Temp.php</b> on line <b>3</b><br />
<br />
<b>Notice</b>: Undefined index: idpmod in <b>C:\Documents and Settings\Frank\My Documents\My Sites\php\franklos\listpub_Temp.php</b> on line <b>4</b><br />
Code: Select all
$idpubdetails = $_GET['table'];
$idpubmod = $_GET['field'];Whats the format, rather syntax. I ve been googling 4 hours no result.
Hope it is a simplething and someone can tell me what the problem is,
Frank.
Whole code:
Code: Select all
<?php
$idpubdetails = $_GET['table'];
$idpubmod = $_GET['field'];
$sqlConn = mysql_connect('localhost','typo3','');
if (!$sqlConn)
{
die ('unable to connect' . mysql_error());
}
$db = mysql_select_db('typo3', $sqlConn);
// 001: Database query
$query = "select * from publishers order by name ASC";
// 002: Execute query
$res = mysql_query($query, $sqlConn);
if (!$res)
{
die ('Could not run query: ' . mysql_error());
}
// everything went ok, so we can display the data
echo "<h4>List of Publishers</h4>";
echo " <table border=\"0\" cols=\"2\" cellpadding=\"0\" cellspacing=\"0\" width=\"400\">";
while ($row = mysql_fetch_array($res, MYSQL_BOTH))
{
$reccnt++;
$idpub = $row[0];
$publisher = $row[3];
$pubmodlink = "<a href=\"/typo3/index.php?id=".$idpubmod."&idpub=".$idpub."\">";
$pubmodlink = $pubmodlink . $idpub . "</a>";
$publink = "<a href=\"/typo3/index.php?id=".$idpubdetails."&idpub=".$idpub."\">";
$publink = $publink . $publisher . "</a>";
echo " <tr>";
echo " <td valign=\"top\">" . $pubmodlink . "</td>";
echo " <td valign=\"top\">" . $publink . "</td>";
echo " </tr>";
}
echo " </table>";
mysql_free_result($res);
mysql_close($sql_Conn);
?>