Jump to content


Photo

Basic newbie help


  • Please log in to reply
2 replies to this topic

#1 vbracknell

vbracknell
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 10 August 2006 - 06:56 PM

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.o...apers/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.o...papers/item.php

I know the code should be something along the lines of http://www.mspress.o...s/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

#2 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 10 August 2006 - 07:04 PM

give us the code you have.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#3 vbracknell

vbracknell
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 10 August 2006 - 07:37 PM

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.o...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";
?>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users