Jump to content

Archived

This topic is now archived and is closed to further replies.

vbracknell

Basic newbie help

Recommended Posts

It ought to be easy, but I am not getting it.

My ISP is running MySql and PHPMyAdmin, and I have a table set up which holds information about Mississippi newspapers.

The main page, http://www.mspress.org/newspapers/index.php just returns a basic list of all newspapers. Ok, easy enough. Right now, clicking on the name of the newspaper will take you to that newspaper's website if they have one.

I'd like to set up a mini-page for those newspapers that don't have websites. When the name of the newspaper (for example, the Amory Advertiser) is clicked, it should take them to a mini-page that looks like this.

http://www.mspress.org/newspapers/item.php

I know the code should be something along the lines of http://www.mspress.org/newspapers/item.php?id=1, but I just don't seem to be able to get these set up right.

Any assistance would be greatly appreciated.

Victoria

Share this post


Link to post
Share on other sites
I'm sorry! this is the code I am using for index.php which returns the list of all newspapers. It works fine, but I need to set something up so that when the user clicks on the name of a newspaper that does not have a website, it takes them to another "mini-page."  Thanks so much for looking at it!

I was thinking I would have to change the field newspapername to something like:
a href="http://www.mspress.org/newspapers/item.php?id=1">newspaper</a
but I am not positive I think thinking along the right lines here.

index.php:
<?php
$db = mysql_connect("localhost", "database", "password" );
mysql_select_db("tablename",$db);
$result = mysql_query("SELECT * FROM newspapers WHERE 1 ORDER BY City ASC",$db);
echo "<table border=0 cellspacing=5 cellpadding=0><font size='2'>\n";
echo "<tr><td><b>Type</b></td><td><b>Newspaper</b></td><td><b>Circ.</b></td><td><b>City</b></td><td><b>Phone</b></td><td><b>Fax</b></td><td><b>E-Mail<b></td><td><b>County<b></td><td><b>Membership</td><td><b>MCAN</td></tr></tr>\n";
while ($myrow = mysql_fetch_row($result)) {
printf("<tr><td nowrap>%s</td><td nowrap>%s</td><td nowrap>%s</td><td nowrap>%s</td><td nowrap>%s</td><td nowrap>%s</td><td nowrap>%s</td><td nowrap>%s</td><td nowrap>%s</td><td nowrap>%s</td>\n",
$myrow[1], $myrow[2], $myrow[3], $myrow[5], $myrow[8], $myrow[9], $myrow[11], $myrow[12], $myrow[13], $myrow[14]);
}
echo "</font></table>\n";
?>

item.php:
<?php

$db = mysql_connect("localhost", "mydatabase", "mypassword" );
mysql_select_db("tablename",$db);
**/I know this isn't right
$result = mysql_query("SELECT *  FROM `newspapers` WHERE `Newspaper` LIKE 'Amory Advertiser'",$db);

echo "<table border=0 cellspacing=5 cellpadding=0>\n";
while ($myrow = mysql_fetch_row($result)) {

printf("<tr>
<td>Type:</td>
<td>%s</td>
</tr>
<tr>
<td>Newspaper:</td>
<td>%s</td>
</tr>
<tr>
<td>Circulation:</td>
<td>%s</td>
</tr>
<tr>
<td>Address:</td>
<td>%s</td>
</tr>
<tr>
<td>City:</td>
<td>%s</td>
</tr>
<tr>
<td>State:</td>
<td>%s</td>
</tr>
<tr>
<td>Zip:</td>
<td>%s</td>
</tr>
<tr>
<td>Phone:</td>
<td>%s</td>
</tr>
<tr>
<td>Fax:</td>
<td>%s</td>
</tr>
<tr>
<td>Website:</td>
<td>%s</td>
</tr>
<tr>
<td>E-mail:</td>
<td>%s</td>
</tr>
<tr>
<td>County:</td>
<td>%s</td>
</tr>
<tr>
<td>Membership:</td>
<td>%s</td>
</tr>
<tr>
<td>MCAN/MDAN:</td>
<td>%s</td>
</tr>\n",
$myrow[1], $myrow[2], $myrow[3], $myrow[4],$myrow[5], $myrow[6],$myrow[7],$myrow[8], $myrow[9], $myrow[10],$myrow[11], $myrow[12], $myrow[13], $myrow[14]);
}
echo "</font></table>\n";
?>

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.