General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old February 22nd, 2003, 08:47 AM
itohideo itohideo is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 3 itohideo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Show Count number problem

Hi how are you doing?

What I am doing is that when a user clicks name, "His Hit" will count 1.

In other words I am donig count "Hit".

PHP Code:
if($_GET['lname']==$lname){ 
  
mysql_query("UPDATE kk SET hit = hit + 1 where lname='$lname'"
  or die(
__LINE__.mysql_error()); 


and

PHP Code:
print("<a href=\"JP.php?lname=$r[lname]\">$r[lname]</a>"); 


This works but when I change to another URL
PHP Code:
("<a href=\"JP.php?lname=$r[lname]\">$r[lname]</a>"); 


to
PHP Code:
("<a href=\"anoter.php?lname=$r[lname]\">$r[lname]</a>"); 


When I changed to JP.php to another.php, it does not work at all. Why?????

This scrip name is JP.php so it returns same.

I would like to change URL. How can I do it even though I change the URL, it will count?

Do you have any idea??

Please help me

Thanks

Reply With Quote
  #2  
Old February 22nd, 2003, 04:33 PM
ramz ramz is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: Juiz de Fora - MG- Brazil
Posts: 93 ramz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to ramz Send a message via MSN to ramz
Hi!
Please, post the file here so that I can take a look and see the problem in detail.
__________________
Regards,
Ramiro Varandas Jr.

Reply With Quote
  #3  
Old February 23rd, 2003, 12:16 AM
itohideo itohideo is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 3 itohideo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Here is whole script

PHP Code:
<?php

session_start
();
?>






<html>
<head>
<style type="text/css">
<!--

 A:link{text-decoration:none}
 A:visit{text-decoration:none}
 A:active{text-decration:none}
 A:hover{text-decration:none}


 //-->
 </style>




</style>
</head>
<body marginwidth=0 marginheight=0 leftmargin=0 topmargin=0>
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<tr align=center >
<td width=15%  align="center"><img src="image/cat.jpg"></td><td  style="font-Family:arial" valign=bottom width=100% align=left><span style="border-style:solid;background-color:Bisque;padding:3;width:100%;border-color:white;">
<a href="JP.php">Home</a>&nbsp;&nbsp;/&nbsp;&nbsp;<a href="change.php">Edit&nbsp;&nbsp; AND&nbsp;&nbsp; Change my profile</a>&nbsp;&nbsp;/&nbsp;&nbsp;
<a href="upload.php">Manage&nbsp;&nbsp; AND&nbsp;&nbsp;  Upload my photo</a>&nbsp;&nbsp;/&nbsp;&nbsp;<a href="logout.php">Sign Out</a></span></td>
</tr>
</table>

<?php

if (!@mysql_connect('localhost''****''****')) {
    die(
'Connection Failed. '.mysql_error()); // or whatever
}

if (!@
mysql_select_db('******')) {
    die(
'Database Selection Failed. '.mysql_error()); // or whatever
}

if(
$_GET['lname']==$lname){ 
  
mysql_query("UPDATE kk SET hit = hit + 1 where lname='$lname'"
  or die(
__LINE__.mysql_error()); 
 

$q 'SELECT pic,fname,lname,gender,country,job, birth, CURRENT_DATE,(YEAR(CURRENT_DATE)-YEAR(birth))-(RIGHT(CURRENT_DATE,5)<RIGHT(birth,5)) AS age,language,education,mail,hit FROM kk order by id';




$num mysql_query($q);
$numrows mysql_num_rows($num); // now we have the total number of results.

$_SESSION["username"]=$username;

if(isset(
$_SESSION["username"])){


echo
"<p style=\"border-style:solid;background-color:silver;border-color:white;color:white;width:100%;height:5%;font-Family:arial;text-align:center;\"><big><i><u>Now logn in</u></i></big> ------)&nbsp;You are   ".$_SESSION["username"]."  "."<font color=red>Current members are".$numrows."peple</font>"."</p>";


}

else{

print(
"<meta http-equiv=\"refresh\" content=\"1;url=login.html\">");

}











if (
$num == 0) {
    die(
'No Results.'); // do whatever you want here
}

$limit 5// num per page

// we need to know how many results pages to generate.

$pages ceil($numrows $limit); // as you said, ceil is a good idea :)

// now we figure out the current page

if (!isset($_GET['from']) || !is_numeric($_GET['from'])) {
    
$_GET['from'] = 0;
}
if (
$_GET['from'] == 0) {
    
$current 1;
} else {
    
$current = ($_GET['from'] / $limit) + 1;
}

// now we show the results

$q .= ' LIMIT '.$_GET['from'].', '.$limit;

$results mysql_query($q);
$num2 mysql_num_rows($results);

// include(some header file here);  //perhaps

// build up some stats thingies

$first = ($current $limit) - $limit 1;
if (
$num2 == $limit) {
    
$last $first $limit 1;
} else {
    
$diff $limit $num2;
    
$last $first $limit $diff;
}

echo 
'<table width="55%" align=center border=0 style="font-Family:arial;color:red;"><tr bgcolor=yellow><td align=center>Showing '.$numrows.' results on '.$pages.' pages</td><td align="center">Page '.$current.', Results '.$first.' to '.$last.'</td></tr></table>';

while (
$r mysql_fetch_array($results)) {

 print(
"<table border=1 cellpadding=2 cellspacing=2 width=75% align=center>");
 print(
"<tr>");
 print(
"<td width=12%>");
 print(
"<a href=\"upload.php\" ><img src=\"$r[pic]\" width=130 height=135 border=0></a>");
 print(
"</td>");
 print(
"<td valign=top>");
 print(
"<table border=1 cellpadding=3 cellspacing=2 width=100% height=120 style=\"font-Family:arial;\">");
 print(
"<tr >");
 print(
"<td width=15%>");
 print(
"Name:");
 print(
"</td>");
 print(
"<td width=35%>");
 print(
$r["fname"]);
 print(
"</td>");
 print(
"<td width=15%>");
 print(
"Gender:");
 print(
"</td>");
 print(
"<td  width=35%>");
 print(
$r["gender"]);
 print(
"</td>");
 print(
"</tr>");



 print(
"<tr >");
 print(
"<td width=15%>");
 print(
"Nationality:");
 print(
"</td>");
 print(
"<td>");
 print(
$r["country"]);
 print(
"</td>");
 print(
"<td width=15%>");
 print(
"Occupation:");
 print(
"</td>");
 print(
"<td >");
 print(
$r["job"]);
 print(
"</td>");
 print(
"</tr>");



 print(
"<tr >");
 print(
"<td width=15%>");
 print(
"Spoken Language:");
 print(
"</td>");
 print(
"<td>");
 print(
$r["language"]);
 print(
"</td>");
 print(
"<td width=15%>");
 print(
"Education Level:");
 print(
"</td>");
 print(
"<td >");
 print(
$r["education"]);
 print(
"</td>");
 print(
"</tr>");

 print(
"<tr>");
 print(
"<td colspan=3>");
 print(
"<font color=green>E-mail<font color=red>---></font>");
 print(
"<a href=\"mailto:$r[mail]\">$r[mail]</a>");
 print(
"</td>");
 print(
"<td>Age:");
 print(
$r["age"]);
 print(
"</td>");
 print(
"</tr>");
 

 
 print(
"<tr>");
 print(
"<td colspan=3><font color=red size=2>To click to see the Profile:</font>");
 print(
"<a href=\"JP.php?lname=$r[lname]\">$r[lname]</a>");
 print(
"</td>");
 print(
"<td>Hit:");
 print(
$r["hit"]);
 print(
"</td>");
 print(
"</tr>");
 
 
 
 

 print(
"</table>");
 print(
"</td>");
 print(
"</tr>");
 print(
"<table>");



}
}

// now we want to show the links
echo"<br>";
echo
"<span style=\"border-style:solid;background-color:silver;border-color:white;\"><font color=red>Page numbers</font>---------->";
for(
$i 1$i <= $pages$i++) {
    
$start = ($i $limit) - $limit;
    if (
$start == $_GET['from']) {
        echo 
$i.' ';
    } else {

        echo 
'<a href="'.$_SERVER['PHP_SELF'].'?from='.$start.'">'.$i.'</a> ';

    }
}
echo
"</span>";




?>

Reply With Quote
  #4  
Old February 25th, 2003, 02:57 AM
itohideo itohideo is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 3 itohideo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Does anybody help me for this?

Thanks

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Show Count number problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway