PHP - Ranking Ranks Greatest Action As Last Rank
Hello everyone...
My following code is supposed to order rank by from Greatest covertaction but for some reason it is ranking the greatest last eg. 900,000 Rank 1 900,001 Rank 2 900,002 Rank 3 Here is the code: Code: [Select] <?php $q = "SELECT * FROM `accountinfo_db` ORDER BY `covertaction`, `anticovertaction` ASC"; $res = mysql_query($q) or die(mysql_error()); $i = 1; while($player=mysql_fetch_array($res)){ $id = securevar($player['id']); $time = time(); $user = securevar($player['username']); $q = "UPDATE `accountinfo_db` SET `covertrank` = '$i', `lastTurnTime` = '$time' WHERE `id` = '$id'"; if(mysql_query($q)){ echo "Covert & Anti Covert Rank set to $user as ".number_format($i)."!<br />"; } else { // query failed with an error // put your error reporting/logging code here... } $i++; } ?> Any help will be appreciated! Brian Similar Tutorialshi i have a table like this rank xp 1 0 2 50 3 100 4 200 say my username has 75xp how would a select which rank i am not sure how i can do this? :S cheers matt Ok so say I have php do some calculations for me Code: [Select] $Value1 = 300; $Value2 = 100000; $FirstRatio = $Value1 / $Value2; $Value3 = 8000; $Value4 = 6000000; $SecondRatio = $Value3 / $Value4; $FirstRatio = 0.003 $SecondRatio = 0.0013 How would I go about doing these calculations and then sorting $FirstRatio and $SecondRatio and then it would take the highest ratio ($FirstRatio) and it would echo the value? Ever since I switched over to pagination, the ranks for the sites have been off. I use to have an $i++ increment that kept the ranks, but now with pagination, it just ranks those on the current page. Is there a way to bypass this? public function grabSites() { //amount of sites $amount = mysql_num_rows(mysql_query("SELECT * FROM sites")); if($amount > 0) { //amount per page $p_page = 13; //track page $start = $_GET['page']; //max_pages $max_pages = $amount / $p_page; //set default if(!$start) $start = 0; //new query $query = mysql_query("SELECT id,title,description,votes,date,outl,site_url FROM sites ORDER BY votes DESC LIMIT $start, $p_page"); while($fetch = mysql_fetch_assoc($query)) { ++$i; $i = $i + $p_page; echo " <div id='post-1' class='post'> <h2 class='title'><font color='white'>#". $i." ".$fetch['title'] ."</font></h2> <div class='entry'> <b>". $fetch['title'] ." currently has ". $fetch['votes'] ." votes. <a href='vote.php?id=". $fetch['id'] ."'>Vote now</a>.</b> <br/><br/> <p>". nl2br(stripslashes($fetch['description'])) ."</p> </div> <p class='meta'><a href='". $fetch['site_url'] ."'>Visit</a></p> </div> "; } //set back and forth variables $previous = $start - $p_page; $next = $start + $p_page; ?> <hr> <center> <?php if(!($start<=0)) echo "<a href='index.php?page=". $previous ."'><<</a>"; $i = 1; for($x = 0; $x < $amount; $x = $x + $p_page) { echo "<a href='index.php?page=". $x ."'> ". $i ." </a>"; $i++; } if(!($start>=$amount-$p_page)) echo "<a href='index.php?page=". $next ."'>>></a></center>"; ?> </center> <?php } else { echo " <div id='post-1' class='post'> <h2 class='title'><a href='#'>Oh NOEZ!</a></h2> <h3 class='date'>". date("M-d-Y") ."</h3> <div class='entry'> <p>There are currently no sites to display!</p> </div> <p class='meta'>View</p> </div> "; } } Hi all, the other I coded a simular script to this which didnt work, so I re coded it but im having a problem with this one aswell, what its meant to do is just change the users rank to what is posted, but every time I hit submit on the form it locates me to a different place. <?php session_start(); include ("../includes/db_connect.php"); include ("../includes/functions.php"); logincheck(); $username = $_SESSION['username']; $rankget = mysql_query ("SELECT * FROM users WHERE username='$username'"); $newrank = mysql_fetch_object($rankget); if ($_POST['change']){ if ($newrank->userlevel >= "2"){ $time = now(); $updateuser = $_POST['usernameone']; // User Posted $updaterank = $_POST['rankone']; // Rank posted if ($updateuser == NULL && $updaterank == NULL){ $message = "You must enter a user and rank"; }elseif ($updateuser == NULL){ $message = "You must enter a username"; }elseif ($updaterank == NULL){ $message = "You must enter a rank"; } mysql_query ("UPDATE users SET rank = '$updaterank' WHERE username='$updateuser'") or die (mysql_error()); mysql_query ("INSERT INTO logs (`id` , `who`, `action`, `time`) VALUES ('', '$username' , '$username Updated rank; $updateuser to $updaterank' , '$time')") or die (mysql_error()); mysql_query ("INSERT INTO inbox (`id` , `to` , `from` , `message` , `date` , `read` , `saved` , `event_id`) VALUES ('', '$updateuser', 'System', 'Your rank has been updated to $updaterank!', '$date', '0', '0', '')") or die (mysql_error()); echo ("Rank Changed!"); }} ?> <html> <head> <title>Change Rank</title> <link rel="stylesheet" href="../include/in.css" type="text/css"> <style type="text/css"> .infobg { font-family: Arial; font-weight:normal; font-size:12px; border-top: 1px solid #000000; border-right: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; background: URL(textbg1.png); font-weight:300; } .button { font-size: 12px; background:url(button.png); vertical-align: middle; border-top: 1px solid #000000; border-right: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; color: #FFFFCC; height:23px; font-weight:300; border-radius: 10px; padding-bottom:2px; } </style> </head> <body> <form action='' name='form1' id='form1' method='POST'> <table width='50%' cellpadding='0' align='center' cellspacing='0' border='1' bordercolor='#000000' bgcolor='#808080' style='border-collapse: collapse'> <tr> <td><?php echo ("$message"); ?></td> </tr> <tr> <td background='../header.jpg' colspan='2' align='center'>Change Rank</td> <tr> <td>Username:</td><td><input type='text' name='usernameone'></td> </tr> <tr> <td>Rank:</td><td><input type='text' name='rankone'></td> </tr> <tr> <td> </td><td><input type='submit' name='change' value='Change Rank!'></td> </tr> </table> </form> </body> </html> Anyone see why it locates me else? Thanks Consider the following code; Code: [Select] <div class="blockrow"> <table cellpadding="10" align="center" border="0"> <tr> <td> <center> <font size=6>Donation Hall of Fame</font><br><br> <font size=2><b>Anonymous Donations are not Counted</b></font><br><br> <font size=3><a href="/donate">Get on This List</a></font> <br> <br> <?php //database connection $connectdb = mysql_connect ("localhost", "user", "pass") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("thatsact_donations"); //query setup $sql = "SELECT * FROM totals ORDER BY donation_total DESC LIMIT 100"; $result = mysql_query($sql) or die(mysql_error()); //initialize container $container = array(); //get entries from db while ($get = mysql_fetch_assoc($result)){ if(!$get[userid]=="0") { $username = "<b><a style=\"color:#00CC00\" href=/member.php/$get[userid]>$get[username]</a></b> donated <b>$$get[donation_total]</b> total so far!"; } $container[] = "<font size=3>$username</font>"; } //combine collected entries $output = implode("<br /><hr>",$container); echo $output; mysql_close($connectdb); ?> </center> </td> </tr> </table> </div> I would like to add a rank number to the container starting with one and going 23456 as each piece is echoed. How might I do this because I am very new to php. Example: 1. Username donated $5...... 2. Username donated $4........ 3. Username donated $3....... Thanks in advance. I am having trouble on user post = rank This is the rank table: ----------------- post | rank ----------------- 0 | Noob 10 | Member 50 | Metal 100 | Silver 200 | Gold $user_post="120"; $query_rank=mysql_query("SELECT * FROM rank WHERE post<='$user_post' OR post>='$user_post'") or die ("Error"); while ($row=mysql_fetch_assoc($query_rank)){ $rank=$row['rank']; } echo "User Rank: $rank"; The above code output: User Rank: Gold The right output should be: User Rank: Silver Please help It will be better if someone willing to share a better ranking code. Hello everyone,
I'm create an application where I have member, admin, and superadmin
What I'm try to do is superadmin update member to admin, so they can have more privilege. The name of the table is member where I have member, admin account, and i have row call 'rank'. Rank 1 is for member they have access basic stuff and rank 2 they have more privilege. Want the superadmin to type the name of the member and change to rank 2.
This is what happening, if I dont put nothing on the text boxes, it said "Please check if you have put the right information." , if i put member and the rank i want to change is says ""User has upgrade to admin", but than when i check my database the member is still a member when i wanted to change to admin.
Can anyone see where I'm going home, or what should I change.
<form> </form> <form action='<?php htmlentities($_SERVER['PHP_SELF']); ?>' method='POST' enctype='multipart/form-data '> Username: <input class="fontsize" name='user' type='text'/> Rank: <input class="fontsize" name='rank' type='text' /> <br><br> <input class="button" type='submit' name='get' value='Upgrade' /> </form> </h2> <?php if(isset($_POST['get'])) { $username1 = $_POST['user']; $sql_user = mysqli_real_escape_string ($connection, $username1); $rank = $_POST['rank']; $rank = mysqli_real_escape_string ($connection, $rank); $query1 = mysqli_query($connection, "SELECT rank FROM member WHERE username='$sql_user'"); if ($row = mysqli_fetch_array($query1)) { if ($rank == '1') { $data1 = mysqli_query($connection, "UPDATE member SET rank= '1' WHERE username='sql_user'") or die (mysql_error($connection)); echo "User has downgrade to member"; } elseif ($rank == '2') { $data2 = mysqli_query($connection, "UPDATE member SET rank= '2' WHERE username ='sql_user'") or die (mysql_error($connection)); echo "User has upgrade to admin"; } else { echo "Please check if you have put the right information."; } } } ?> This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=312470.0 I would like to create something like foursquare badges. When ppl upload files, the most downloaded files will have a new badge, how do i create that? I am trying to figure out how to assign a number rank to a set of results, but I need to reset the ranking when a certain column changes. For example: Brand Rank a 1 a 2 a 3 b 1 b 2 b 3 I set $rank=0; and then for each item in my loop I add $rank++; How do I get the rank to reset in the loop when the brand changes? Thanks for any help. Hey guys and girls, Okay so am trying to provide a rank for each user within my database but I cant seem to get it working here is my code Code: [Select] SELECT `Table`.`Id`, `Table`.`Photo`, `Table`.`Fname`, `Table`.`Lname`, `Table`.`Gender`, `Table`.`Gd`, `Table`.`Bd`, `Table`.`Point`, (SELECT COUNT(*) + 1 FROM (SELECT U.Id, T.`User Id` FROM `u_account` U LEFT JOIN `score_system` T ON `T`.`User Id` = `U`.`Id`) x WHERE Table.Point > (SELECT SUM(Good)-SUM(Bad) FROM `score_system` GROUP BY `User Id`) ) AS RANK FROM (SELECT `C`.`Id`, `C`.`Photo`, `C`.`Fname`, `C`.`Lname`, `C`.`Gender`, CASE WHEN COALESCE( SUM(`S`.`Good`), '') = '' THEN '0' ELSE SUM(`S`.`Good`) END AS Gd, CASE WHEN COALESCE( SUM(`S`.`Bad`), '') = '' THEN '0' ELSE SUM(`S`.`Bad`) END AS Bd, CASE WHEN COALESCE( SUM(`S`.`Good` - `S`.`Bad`), '') = '' THEN '0' ELSE SUM(`S`.`Good` - `S`.`Bad`) END AS Point FROM `u_account` AS `C` LEFT JOIN `score_system` AS `S` ON `C`.`Id` = `S`.`Child Id` AND (SELECT Start FROM event_schedule WHERE CURDATE() >= Start AND End >= CURDATE()) < `S`.`Date` AND (SELECT End FROM event_schedule WHERE CURDATE() >= Start AND End >= CURDATE()) > `S`.`Date` GROUP BY `C`.`Id` ) AS `Table` ORDER BY Point DESC, Fname ASC I cant seem to pull the users rank from this and its donig my head in I've tried different things and they all dont work this is perhaps as close as I've got to figuring it out. This is the part that creates the users rank now its saying the Subquery returns more than 1 row but I just cant seem to think of away to implement this into my query above so that it displays the rank for each user. Code: [Select] (SELECT COUNT(*) + 1 FROM (SELECT U.Id, T.`User Id` FROM `u_account` U LEFT JOIN `score_system` T ON `T`.`User Id` = `U`.`Id`) x WHERE Table.Point >= (SELECT SUM(Good - Bad) FROM `score_system` GROUP BY `User Id`) ) AS RANK I'm also looking for this to display the same rank for both users with the same points so If bill and ben have 200points then they would both have the same rank but if bill was to have 201points then he would be higher up than ben. So can anyone lend me a hand. Thanks in advance Hello, I'm in need of assistance trying to get this PHP Script working and I'm hoping you'll be able to find a solution. SQL Table Format: http://pastebin.com/LUuu2pLp Code: [Select] -- -- Table structure for table `hungergames_records` -- CREATE TABLE IF NOT EXISTS `hungergames_records` ( `user_id` int(10) unsigned NOT NULL, `victories` int(32) unsigned NOT NULL DEFAULT '0', `biggest_kill_streak` int(32) unsigned NOT NULL DEFAULT '0', `most_chests_opened` int(32) unsigned NOT NULL DEFAULT '0', `total_chests_opened` int(32) unsigned NOT NULL DEFAULT '0', `lastlogin` int(32) unsigned NOT NULL DEFAULT '0', `longest_lifespan` int(32) unsigned NOT NULL DEFAULT '0', `total_lifespan` int(32) unsigned NOT NULL DEFAULT '0', `total_points` int(32) unsigned NOT NULL DEFAULT '100', `most_points` int(32) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`user_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `hungergames_users` -- CREATE TABLE IF NOT EXISTS `hungergames_users` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `donor` int(32) unsigned NOT NULL DEFAULT '0', `user` varchar(40) NOT NULL, `donor_cooldown` int(100) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `user` (`user`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=12641 ; PHP Code: http://pastebin.com/aQANz0BL Code: [Select] <?php include("config.php"); $getRankQuery = "SELECT hungergames_users.id, hungergames_records.user_id, hungergames_records.victories, hungergames_records.biggest_kill_streak, hungergames_records.most_chests_opened, hungergames_records.total_chests_opened, hungergames_records.lastlogin, hungergames_records.longest_lifespan, hungergames_records.total_lifespan, hungergames_records.total_points, hungergames_records.most_points, hungergames_users.donor, hungergames_users.user FROM hungergames_records, hungergames_users WHERE hungergames_records.user_id = hungergames_users.id ORDER BY hungergames_records.total_points DESC"; $getRankResult = mysql_query($getRankQuery); //Source From: http://stackoverflow.com/questions/7704311/calculate-rank-with-points function getUserRank($searchedUserID) { $userArray = getAllUsersOrderedByPoints(); $rank = 0; $lastPoints = -1; // Never happens foreach ( $userArray as $user) { if ($user['total_points'] != $lastPoints) $rank++; if ($user['user_id'] == $searchedUserID) break; } return $rank; } while ($data = mysql_fetch_array($result)) { echo getUserRank($data["user_id"]); } ?> What am I trying to accomplish? Simple Ranking System... Basically, The total points is stored into total_points field for each user and whoever has the highest score will be Ranked #1 and count down to a the full database (Currently at 12,641 users) Now the above function getUserRank is the code I pulled from the above source listed, I think my issue relies in the function of getAllUsersOrderedByPoints(); - I've tried doing something like. Code: [Select] $row = mysql_fetch_array($getRankResult); Then adding: $userArray = $row["user_id"]; Didn't work - So if you can help me correct this than I'll be greatly appertiated. Lastly, I've tried doing: Code: [Select] $index = 1; while ($data = mysql_fetch_array($getRankQuery)) { echo $index++ . " " . $data["id"] . " ".$data["user"]." <br>\n"; } This solution works, but this solution would not work for when a "User is Search" it would count them as the highest rank 1,2,3 and wouldn't work, so either the function up there needs to be corrected or please help get a working solution, I've been googleing this issue and seems too be a common code issue with a lot people are having and not many solutions. The application that records data (Not PHP) doesn't store any data with a "Rank" table otherwise this would be a simple echo'ed out data. For a better understanding of what I'm trying to do - You may take a look at: http://justonemoreblock.com/lb/leaderboards.php Regards, Cory I have a txt file of numbers e.g. 1,4,3,5,19,3,11 all in a column. Is it possible to echo only the highest 3 numbers? Hi I've set-up a multidimensional PHP array from a SQL query which pulls back parcels despatched per item on a daily basis. e.g. Item|Day1|Day2 |Day3|Day4|Day5 1 |100 | 120 | 90 |150 |60 2 |150 | 200 | 80 |90 |100 3 | 1 | 2 | 3 | 4 | 5 I want to be able to assign a ranked value to each day based upon the amount of items sent out each day and put that either into the existing array, or create a new array to which it can reference Hey, I've been working on a script to match playing card hands in a poker game against the river to return what the hand the user has and who won against other players. The problem is how do i approach an algorithm to do this in the first place. Cards are stored and structured by 2 characters seperated by a full stop. Example - 2 of diamonds and 3 of clubs is: D.2,C.3 now imagine a line of 5 cards (the river) and im trying to work out what they have and return the answer such as: 2 pairs or royal flush etc I so far decided my easiest way is to explode on the comma to get each card - then explode a second time on the full stop to get the suit and value into different variables. How ever - after that point im lost how i can do this up against the river to check what hand the user has. Any one got any tips on the best approach ? Hello everyone... I made point system that ranks users in my app. There are two parts to the system, a primary score and a dynamic score. The primary score is based on how you well you perform and the dynamic score is based on how well your friends perform. Both of these get added together to equal your total score. The problem is that I have a lot of looping occurring which results in about 400 queries being run when I access the page that executes this class. Can this be optimized? What's the best way to do this? I don't want to store the data as I want this presented in real-time. Code: [Select] <?php class edge { public function get_all_users_edge() { $sql = "SELECT id FROM users WHERE status = 3"; $result = mysql_query($sql) or die(mysql_error()); $ids = array(); while (($row = mysql_fetch_assoc($result)) !== false) { $ids[] = $row; } $all_edges = array(); foreach ($ids as $k => $id) { $edge = $this->get_users_edge($id['id']); $all_edges[$k] = $edge; } return $all_edges; } public function get_users_edge($uid) { $users_primary_edge = $this->get_users_primary_edge($uid); $users_dynamic_edge = $this->get_users_dynamic_edge($uid); return $users_primary_edge + $users_dynamic_edge; } public function get_users_primary_edge($uid) { if (active_id($uid) === false) { return false; } $uid = (int)$uid; $sql = "SELECT CHAR_LENGTH(`users`.`credentials`) AS `cred_chars`, CHAR_LENGTH(`users`.`specialties`) AS `spec_chars`, `companies`.`companyvideo` AS `video`, `investor_info`.`accredited` AS `accredited`, ( SELECT COUNT(`user_id`) FROM `blog_posts` WHERE `user_id` = '${uid}' ) AS `post_count`, ( SELECT COUNT(`uid`) FROM `votes` WHERE `uid` = '${uid}' ) AS `vote_sent_count`, `votes_received`.`inv_vote_received_count`, `votes_received`.`pub_vote_received_count`, ( SELECT COUNT(`userid`) FROM `employees` WHERE `userid` = '${uid}' ) AS `joined_count`, `votes2`.`ent_count`, `votes2`.`inv_count`, ( SELECT COUNT(`company_id`) FROM `company_fans` LEFT JOIN `companies` ON `company_fans`.`company_id` = `companies`.`companyid` LEFT JOIN `employees` ON `employees`.`companyid` = `companies`.`companyid` WHERE `userid` = '${uid}' ) AS `company_fans_count`, ( SELECT COUNT(`user_id`) FROM `recommendations` WHERE `user_id` = '${uid}' ) AS `recommendation_count`, ( SELECT COUNT(`partner_id`) FROM `partners` WHERE (`user_id` = '${uid}' OR `friend_id` = '${uid}') AND `approved` = '1' ) AS `associate_count` FROM `users` LEFT JOIN `investor_info` ON `investor_info`.`uid` = `users`.`id` LEFT JOIN `employees` ON `employees`.`userid` = `users`.`id` LEFT JOIN `companies` ON `employees`.`companyid` = `companies`.`companyid` LEFT JOIN ( SELECT `employees`.`userid`, SUM( IF( `votes`.`vote_type` = 1, 1, 0 ) ) AS `inv_vote_received_count`, SUM( IF( `votes`.`vote_type` = 0, 1, 0 ) ) AS `pub_vote_received_count` FROM `votes` INNER JOIN `employees` ON `employees`.`companyid` = `votes`.`company_id` WHERE `employees`.`userid` = '${uid}' GROUP BY `employees`.`userid` ) AS `votes_received` ON `votes_received`.`userid` = `users`.`id` LEFT JOIN ( SELECT `beta_keys`.`ref_id`, SUM( IF( `users`.`accounttype` = 1, 1, 0 ) ) AS `ent_count`, SUM( IF( `users`.`accounttype` = 0, 1, 0 ) ) AS `inv_count` FROM `beta_keys` INNER JOIN `users` ON `users`.`id` = `beta_keys`.`userid` WHERE `beta_keys`.`ref_id` = '${uid}' AND `users`.`status` = 3 GROUP BY `users`.`id` ) AS `votes2` ON `votes2`.`ref_id` = `users`.`id` WHERE `users`.`id` = '${uid}'"; $result = mysql_query($sql) or die(mysql_error()); $row = mysql_fetch_assoc($result); $score = 0; if((!empty($row['cred_chars'])) && (!empty($row['spec_chars']))) { $score += 200; } if(!empty($row['video'])) { $score += 50; } if($row['accredited'] == 1) { $score += 100; } $score += (50 * $row['post_count']); $score += (5 * $row['vote_sent_count']); $score += (3 * $row['inv_vote_received_count']); $score += (1 * $row['pub_vote_received_count']); $score += (200 * $row['joined_count']); $score += (40 * $row['ent_count']); $score += (200 * $row['inv_count']); $score += (10 * $row['company_fans_count']); $score += (30 * $row['recommendation_count']); $score += (20 * $row['associate_count']); return $score; } public function get_users_dynamic_edge($uid) { $uid = (int)$uid; $sql = "( SELECT `users`.`id` FROM partners INNER JOIN `users` ON `partners`.`user_id` = `users`.`id` WHERE partners.friend_id = '${uid}' AND `approved` = 1 ) UNION ALL ( SELECT `users`.`id` FROM `partners` INNER JOIN `users` ON `partners`.`friend_id` = `users`.`id` WHERE `partners`.`user_id` = '${uid}' AND `approved` = 1 )"; $result = mysql_query($sql) or die(mysql_error()); $i = 0; $score = 0; while (($row = mysql_fetch_assoc($result)) !== false) { $dynamic_scores[$i] = array( 'uid' => $row['id'], 'score' => $this->get_users_primary_edge($row['id']), ); $i++; } if(!empty($dynamic_scores)) { foreach($dynamic_scores as $k => $dynamic_score) { $score += $dynamic_score['score']; } } return ($score * 0.1); } } ?> Hello
I have a mysql table like this:
id | user | car 1 | 1 | fiat 500 2 | 2 | vw polo 3 | 2 | vw golf 4 | 3 | renault clio 5 | 2 | fiat panda 6 | 3 | seat ibiza From this table how can i get a query that the result be like: user 2 - 3 cars user 3 - 2 cars user 1 - 1 cars Thanks This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=333654.0 Hi I am building a class to manage site users (Via a CMS). In order to complete this I am building a delete/remove user function/method. Things are going ok (I think), but I am confused about what to put in the action tag of the form being used to process the data. Before coding my method, I referred to a script that someone showed me which does something similar in functionality: it deletes photos previously uploaded to a folder, and also removes the associated information from the database. I used this script as the framework for the code that I am working with. Eveything seems to be working fine - EXCEPT - when I click on the 'delete users' button, nothing happens. The first thing that I examined for error was the action attribute within my form. The value of the action attribute is: action = "<? php htmlentities($_SERVER["PHP_SELF"]) ?>" This format has worked for previous forms. I compared this to the action attribute within the script that I was using as a guide. It's value is set as follows: action = "remove_photo.php?<?php echo "action='godel' ";?> In this instance, remove_photo.php is the file that is being used to both process and display the form. The reference script works perfectly but it uses a procedural approach . For my application, I am using a more object oriented approach, so both my opening and closing form tag elements are stored in a seperate file to the class file that processes it. I am new to OO but relatively comfortable with the paradigm so far (my other methods etc are working fine). I therefore suspect that the reason for my script's inability to process is due to the action attribute setting (I cannot be 100% sure of course!). I am going to therefore apply the action attribute settings used successfully in the reference script, to the application that I am building. However, the trouble is, I don't understand it I don't like it when something works, but I can't see the logic behind why it does. I am not concerned about the form id or method attrbutes. I understand what is going on there - and why they are set as they are. However, the action attribute is very difficult to understand for the following reasons: 1/ There is no variable/method/entity/object/ANYTHING called 'godel' elsewhere in the reference script. For this reason I thought that it might not be needed, so removed the bit of code within PHP tags concerning it: <?php echo "action='godel' ";?> - When I did this - the script didn't work. In fact - nothing at all would process. This was a similar result to what was happening with the script I am building. 2/ I then put the PHP line back in, but replaced 'godel' with 'something'. I saved and processed the form. - it worked. 3/ I then tried it again replacing 'godel' with an empty string i.e: ' '. - it worked. Has anyone come across forms being processed in a similar way before? If so, please could you explain what is happening here. I can't find anything relating to this type of occurence online.... I am going to place the php tags in the file I am building, to see if it has the desired effect. If it does, I will obviously keep it. But not understanding what is happening, or why it is happening is very annoying!! Thanks Hi everyone I am trying to pass a php variable ($R1 = 1) in to action script flash 8. After this variable is in flash 8 I want the action script to do a if statement that says if the php variable is = 1 then display layer or object. However i am not sure how to do this any help would be great thanks Freid001 PS if this is not possible to do with php and action script please say thanks |