HI, I am new to this forum but I have been on other web development forums.
Ok I have already made a php script of creating the links ect.
Well I can't seem to get the page 1 page 2 links to work to show the different pages.
well here is the code:
CODE
<?php
include("/home/aaron/websites/sharedscripts/mysqldata.php");
session_start();
//if($_SESSION["username"]==""){
//$_SESSION["logged"]=0;
//exit("Sorry your not logged in, please log in.");}
//if ($_SESSION["logged"] == 1) {
if ($_GET["act"]=="view") {
$user = "root";
$pass = "cooldude1";
$db = "Market";
$host="localhost";
$id=$_GET["id"];
$state=$_SESSION['state'];
mysql_connect($host,$user,$pass) or die("ERROR:".mysql_error());
mysql_select_db($db) or die("ERROR DB:".mysql_error());
$sql = mysql_query("SELECT * FROM postings WHERE id = '$id' AND state = '$state'");
$result=mysql_fetch_array($sql);
$image=$result["Item_Image"];
$title=$result["Item_type"];
$message=$result["Message"];
echo"<html>
<head>
<link rel=\"stylesheet\" type=\"text/css\" href=\"/market.css\" />
<title>Market Area For$state</title>
</head>
<body>
<img id=\"mlogo\" src=\"/Artwork/marketlogo.png\">
<img id=\"menu\" src=\"/Artwork/menubackground.png\">
<table><tr><td><img src=\"$image\"></td><td>$title</td></tr>
<tr><td>$message</td></tr></table></html>
";}
if ($_GET["act"]!="view"){
if (!isset($_GET["state"])) {
echo"<html>
<head>
<link rel=\"stylesheet\" type=\"text/css\" href=\"/market.css\" />
<title>Market Area</title>
</head>
<body>
<img id=\"mlogo\" src=\"/Artwork/marketlogo.png\">
<img id=\"menu\" src=\"/Artwork/menubackground.png\">
<form name=\"marketstate\" action=\"Market.php\" method=\"GET\">
<IMG id=\"map\" SRC=\"/Artwork/USAMAPWHITE.gif\" USEMAP=\"#USAMAPWHITE\" WIDTH=598 HEIGHT=365 BORDER=0>
<MAP NAME=\"USAMAPWHITE\">
<AREA SHAPE=POLY COORDS=\"230,35,294,38,299,57,299,79,228,79\" HREF =\"http://www.chillenvillen.com/Market.php?state=North dakota\" ALT= \"N. Dakota\">
<AREA SHAPE=POLY COORDS=\"227,80,299,80,302,120,282,116,226,116\" HREF =\"http://www.chillenvillen.com/Market.php?state=South dakota\" ALT= \"S. Dakota\"><AREA SHAPE=POLY COORDS=\"229,35,226,87,154,81,145,86,131,69,123,21\" HREF =\"http://www.chillenvillen.com/Market.php?state=Montana\" ALT= \"Montana\">
<AREA SHAPE=POLY COORDS=\"224,89,223,143,148,136,156,83\" HREF =\"http://www.chillenvillen.com/Market.php?state=Wyoming\" ALT = \"Wyoming\">
<AREA SHAPE=POLY COORDS=\"169,141,241,147,241,197,162,191\" HREF =\"http://www.chillenvillen.com/Market.php?state=Colorado\"ALT = \"Colorado\">
<AREA SHAPE=POLY COORDS=\"112,20,121,20,132,87,152,87,149,119,94,111\" HREF =\"http://www.chillenvillen.com/Market.php?state=Idaho\" ALT = \"Idaho\">
<AREA SHAPE=POLY COORDS=\"42,10,66,7,111,18,104,57,48,51,40,36\" HREF =\"http://www.chillenvillen.com/Market.php?state=Washington\" ALT = \"Washington\">
<AREA SHAPE=POLY COORDS=\"40,42,47,54,104,60,92,111,18,94\" HREF =\"http://www.chillenvillen.com/Market.php?state=Oregon\" ALT = \"Oregon\">
<AREA SHAPE=POLY COORDS=\"57,106,120,118,101,206,49,147\" HREF =\"http://www.chillenvillen.com/Market.php?state=Navada\" ALT = \"Nevada\">
<AREA SHAPE=POLY COORDS=\"122,118,149,122,146,138,167,141,159,191,110,183\" HREF =\"http://www.chillenvillen.com/Market.php?state=Utah\" ALT =\"Utah\">
<AREA SHAPE=POLY COORDS=\"16,96,55,104,46,145,98,209,96,239,71,239,24,185\" HREF =\"http://www.chillenvillen.com/Market.php?state=California\" ALT = \"California\">
<AREA SHAPE=POLY COORDS=\"109,185,159,193,151,271,138,269,101,247,103,208\" HREF =\"http://www.chillenvillen.com/Market.php?state=Arizona\" ALT = \"Arizona\">
<AREA SHAPE=POLY COORDS=\"226,117,301,122,315,159,244,160,243,145,225,142\" HREF =\"http://www.chillenvillen.com/Market.php?state=Nebraska\" ALT = \"Nebraska\">
<AREA SHAPE=POLY COORDS=\"243,162,318,162,325,172,325,196,244,196\" HREF =\"http://www.chillenvillen.com/Market.php?state=Kansas\"ALT = \"Kansas\">
<AREA SHAPE=POLY COORDS=\"231,198,324,199,328,249,265,233,264,204,233,203\" HREF =\"http://www.chillenvillen.com/Market.php?state=Oklahoma\" ALT = \"Oklahoma\">
<AREA SHAPE=POLY COORDS=\"162,193,229,199,226,269,164,267,160,271,152,270\" HREF =\"http://www.chillenvillen.com/Market.php?state=New Mexico\" ALT = \"New Mexico\">
<AREA SHAPE=POLY COORDS=\"230,204,262,205,264,236,332,253,338,300,275,355,224,308\" HREF =\"http://www.chillenvillen.com/Market.php?state=Texas\" ALT = \"Texas\">
<AREA SHAPE=POLY COORDS=\"293,38,317,35,359,49,341,70,337,94,352,107,302,111\" HREF =\"http://www.chillenvillen.com/Market.php?state=Minnesota\" ALT = \"Minnesota\">
<AREA SHAPE=POLY COORDS=\"342,68,358,66,395,87,390,118,364,122,352,102,339,93\" HREF =\"http://www.chillenvillen.com/Market.php?state=Wisconsin\" ALT = \"Wisconsin\">
<AREA SHAPE=POLY COORDS=\"303,114,352,109,365,129,353,151,316,156\" HREF =\"http://www.chillenvillen.com/Market.php?state=Iowa\" ALT = \"Iowa\">
<AREA SHAPE=POLY COORDS=\"316,158,353,154,382,196,378,207,373,202,329,206,327,171\" HREF =\"http://www.chillenvillen.com/Market.php?state=Missouri\" ALT = \"Missouri\">
<AREA SHAPE=POLY COORDS=\"327,209,370,205,376,211,374,223,363,255,336,256,331,248\" HREF =\"http://www.chillenvillen.com/Market.php?state=Arkansas\" ALT = \"Arkansas\">
<AREA SHAPE=POLY COORDS=\"335,259,363,258,362,282,383,282,392,306,337,300,342,283\" HREF =\"http://www.chillenvillen.com/Market.php?state=Louisiana\" ALT = \"Louisiana\">
<AREA SHAPE=POLY COORDS=\"365,124,389,120,393,133,398,172,393,185,382,193,355,155\" HREF =\"http://www.chillenvillen.com/Market.php?state=Illinois\" ALT = \"Illinois\">
<AREA SHAPE=POLY COORDS=\"359,68,379,58,423,64,454,116,398,131,394,85\" HREF =\"http://www.chillenvillen.com/Market.php?state=Michigan\" ALT = \"Michigan\">
<AREA SHAPE=POLY COORDS=\"396,133,427,127,431,166,405,185,391,191,402,172\" HREF =\"http://www.chillenvillen.com/Market.php?state=Indiana\" ALT = \"Indiana\">
<AREA SHAPE=POLY COORDS=\"386,193,409,186,435,163,456,167,463,178,450,190,386,201\" HREF =\"http://www.chillenvillen.com/Market.php?state=Kentucky\" ALT = \"Kentucky\">
<AREA SHAPE=POLY COORDS=\"383,203,468,190,466,196,445,211,376,224\" HREF =\"http://www.chillenvillen.com/Market.php?state=Tennessee\" ALT = \"Tennessee\">
<AREA SHAPE=POLY COORDS=\"374,227,401,222,403,284,387,288,384,280,362,282,369,263\" HREF =\"http://www.chillenvillen.com/Market.php?state=Mississippi\" ALT = \"Mississippi\">
<AREA SHAPE=POLY COORDS=\"402,221,432,217,444,254,442,273,412,275,414,283,406,283\" HREF =\"http://www.chillenvillen.com/Market.php?state=Alabama\" ALT = \"Alabama\">
<AREA SHAPE=POLY COORDS=\"427,127,468,117,472,147,457,165,433,160\" HREF =\"http://www.chillenvillen.com/Market.php?state=Ohio\" ALT = \"Ohio\">
<AREA SHAPE=POLY COORDS=\"473,148,485,147,487,154,506,145,483,173,469,179,458,168\" HREF =\"http://www.chillenvillen.com/Market.php?state=West Virginia\" ALT = \"W. Virginia\">
<AREA SHAPE=POLY COORDS=\"484,174,502,147,528,160,533,174,453,191,464,180,483,176\" HREF =\"http://www.chillenvillen.com/Market.php?state=Virginia\" ALT = \"Virginia\">
<AREA SHAPE=POLY COORDS=\"470,189,534,176,542,188,513,218,496,206,480,206,449,212\" HREF =\"http://www.chillenvillen.com/Market.php?state=North Carolina\" ALT = \"N. Carolina\">
<AREA SHAPE=POLY COORDS=\"460,211,494,208,510,218,488,250,460,218\" HREF =\"http://www.chillenvillen.com/Market.php?state=South Carolina\"ALT = \"S. Carolina\">
<AREA SHAPE=POLY COORDS=\"433,217,457,214,487,252,483,269,477,273,445,274,445,254\" HREF =\"http://www.chillenvillen.com/Market.php?state=Georgia\" ALT = \"Georgia\">
<AREA SHAPE=POLY COORDS=\"412,277,483,272,513,322,505,342,476,307,460,283,420,285\" HREF =\"http://www.chillenvillen.com/Market.php?state=Florida\" ALT = \"Florida\">
<AREA SHAPE=POLY COORDS=\"555,19,573,12,588,46,563,69,556,47\" HREF =\"http://www.chillenvillen.com/Market.php?state=Maine\" ALT = \"Maine\">
<AREA SHAPE=POLY COORDS=\"549,50,556,48,563,69,565,83,552,85\" HREF =\"http://www.chillenvillen.com/Market.php?state=New Hampshire\" ALT = \"New Hampshire\">
<AREA SHAPE=POLY COORDS=\"537,59,549,55,549,84,545,85,541,75\" HREF =\"http://www.chillenvillen.com/Market.php?state=Vermont\" ALT = \"Vermont\">
<AREA SHAPE=POLY COORDS=\"474,106,534,57,546,107,544,112,531,109,528,102,478,112\" HREF =\"http://www.chillenvillen.com/Market.php?state=New York\" ALT = \"New York\">
<AREA SHAPE=POLY COORDS=\"469,116,474,109,478,115,527,105,533,125,526,134,477,146\" HREF =\"http://www.chillenvillen.com/Market.php?state=Pennsylvania\" ALT = \"Pennsylvania\">
<AREA SHAPE=POLY COORDS=\"544,87,565,85,576,85,576,94,566,91,547,96\" HREF =\"http://www.chillenvillen.com/Market.php?state=Massachusetts\" ALT = \"Massachusetts\">
<AREA SHAPE=POLY COORDS=\"560,94,565,92,569,96,563,100\" HREF =\"http://www.chillenvillen.com/Market.php?state=Rhode Island\" ALT = \"Rhode Island\">
<AREA SHAPE=POLY COORDS=\"546,97,560,94,562,101,548,105\" HREF =\"http://www.chillenvillen.com/Market.php?state=Connecticut\" ALT = \"Connecticut\">
<AREA SHAPE=POLY COORDS=\"532,111,545,113,544,120,542,142,529,135,535,124,530,117\" HREF =\"http://www.chillenvillen.com/Market.php?state=New Jersey\" ALT = \"New Jersey\">
<AREA SHAPE=POLY COORDS=\"531,139,540,153,534,153\" HREF =\"http://www.chillenvillen.com/Market.php?state=Delaware\" ALT = \"Delaware\">
<AREA SHAPE=POLY COORDS=\"486,146,529,136,536,155,536,161,515,156,511,144\" HREF =\"http://www.chillenvillen.com/Market.php?state=Maryland\" ALT = \"Maryland\">
</MAP>
</form>
</body>
</html>";}
if (isset($_GET["state"])) {
$state=$_GET["state"];
$_SESSION["state"]=$state;
$user = "root";
$pass = "cooldude1";
$db = "Market";
$host="localhost";
mysql_connect($host,$user,$pass) or die("ERROR:".mysql_error());
mysql_select_db($db) or die("ERROR DB:".mysql_error());
$sql = mysql_query("SELECT * FROM postings WHERE state = '$state'");
$result=mysql_fetch_array($sql);
echo"<html>
<head>
<link rel=\"stylesheet\" type=\"text/css\" href=\"/market.css\" />
<title>Market Area For$state</title>
</head>
<body>
<img id=\"mlogo\" src=\"/Artwork/marketlogo.png\">
<img id=\"menu\" src=\"/Artwork/menubackground.png\">
";
$max = 1; //amount of articles per page. change to what to want
$p = $_GET['page'];
if(empty($p))
{
$p = 1;
}
$limits = ($p - 1) * $max;
//view the news article!
if(isset($_GET['act']) && $_GET['act'] == "view")
{
$id = $_GET['id'];
$sql = mysql_query("SELECT * FROM postings WHERE state = '$state'");
while($r = mysql_fetch_array($sql))
{
$itemimage = $r['item_image'];
$message = $r['message'];
$state_name = $r['state'];
echo "<p>$itemimage</p><p>$message</p><p>$state_name</p>";
}
}else{
//view all the news articles in rows
$sql = mysql_query("SELECT * FROM postings WHERE state ='$state'LIMIT ".$limits.",$max ") or die(mysql_error());
//the total rows in the table
$totalres = mysql_result(mysql_query("SELECT COUNT(id) AS tot FROM postings"),0);
//the total number of pages (calculated result), math stuff...
$totalpages = ceil($totalres / $max);
//the table
echo "<table><tr><td>$state</td></tr><tr>";
while($r = mysql_fetch_array($sql))
{
$id = $r['id'];
$item_image = $r['item_image'];
$item_title = $r['Item_type'];
echo "<td><a href='Market.php?act=view&id=$id'><img src=\"$item_image\">$item_title</a>";
}
//close up the table
echo "</tr></table>";
for($i = 1; $i <= $totalpages; $i++){
//this is the pagination link
echo "<a href='Market.php?page=$i'>$i</a>|";
}
}
echo"</body></html>";}}
//}
?>
you can take a look at what is shows on here:
Click here to see the web page of script given.on that page you will see a U.S MAP click michigan and you should see links below a a image and the word car that would show 1 and 2 these are the pages.Once the page links are clicked it would load back the image map which is not what I wanted I want to show whats on that page so page one would have whatever that was generated first from the database and the second would be the second generated page from database. I don't want it to load back the image map of the U.S .
What should I do I know the code is messy and hard to read. I tried to make classes to help out but made things worse.
if someone can tell me how to clean up my code to make things simple without repeating alot of code please do tell.
I want to really start using classes to speed up my project. So is there a better way of doing a pagenation .
Now I also would like to know if I were to get employed to a company what do they expect from php programmers.
I was thinking to get php certified to get a job but I am still kinda afraid that I may not know enough to do the job.
Like would they expect you to know high level math to create new algorithms??
and which is the best certification and how can I study for it.
I was thinking to use expertrating.com I already did got tested with there html 4.1 and computer technician certification I tried getting employed at geek squad but no calls so I was thinking the certificate has no value.
any help I would love to get employed at some point into programming area. I am currently in college going for accounting. I wanted to go for computer science but my dad talked to me and told me he knew alot of people that were programmers and he said every 3 years they would get a new programmer so he just told me that your skills is not that value in that field you can get easily replaced by new comers from college.
thanks for your time.
Mod Edit: Font size changed, there's no need to post in that large of a font
This post has been edited by PsychoCoder: 26 Sep, 2008 - 11:37 AM