Jump to content

affluent980

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

affluent980's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have a database table in which i have leads with their LeadID as a primary key, and columns like name, phone, etc, and most importantly, the Revenue column. I am trying to set up my page so that i can edit the value in the revenue column for one lead at a time. This is the form on the page: <?php /** * If user is not logged in, then do not display anything. * If user is logged in, then display the form to edit * lead detail information. */ if($session->logged_in){ ?> <h1>Lead Detail Edit : <? echo $_GET['leadid']; ?></h1> <? if($form->num_errors > 0){ echo "<td><font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font></td>"; } ?> <form action="process.php" method="POST"> <table align="left" border="1" cellspacing="0" cellpadding="3"> <tr> <td>Revenue:</td> <td><input type="text" name="Revenue" maxlength="50" value=" "> </td> <td><? echo $form->error("email"); ?></td> </tr> <tr><td colspan="2" align="right"> <input type="hidden" name="subdet" value="1"> <input type="submit" value="Edit Lead"></td></tr> <tr><td colspan="2" align="left"></td></tr> </table> </form> <? /* Link back to main */ echo "<br>Back To [<a href=\"main.php\">Main</a>]<br>"; } } ?> This seems to be working fine. and it posts the value i put in the Revenue input and subdet to process.php which is here: /* User submitted edit lead detail form */ else if(isset($_POST['subdet'])){ $this->procEditDetails(); } Which tells it to go to procEditDetails on process.php which is here: /** * procEditDetails - Attempts to edit the lead details */ function procEditDetails(){ global $session, $form; /* Account edit attempt */ $retval = $session->editDetails($_POST['Revenue']); /* Account edit successful */ if($retval){ $_SESSION['leadedit'] = true; header("Location: ".$session->referrer); } /* Error found with form */ else{ $_SESSION['value_array'] = $_POST; $_SESSION['error_array'] = $form->getErrorArray(); header("Location: ".$session->referrer); } } which passes Revenue to the function editDetails on session.php which is here: /** * editDetails - Attempts to edit the lead details * */ function editDetails($subRevenue){ global $database, $form; //The database and form object /* Change Revenue */ if($subRevenue){ $database->updateLeadDetails($this->Revenue,"Revenue",$subRevenue); } /* Success! */ return true; } Which passes i don't know what on to the function updateLeadDetails on database.php which is here: /** * updateLeadDetails - Updates a field, specified by the field * parameter, in the leadid's row of the database. */ function updateLeadDetails($Revenue, $field, $value){ $q = "UPDATE ".TBL_Leads." SET ".$field." = '$value' WHERE LeadID = '$LeadID'"; return mysql_query($q, $this->connection); } And it passes everything back fine, with no errors, and in fact, confirms that update was successful, but it doesn't change the revenue value for that LeadID. Am i not passing on the right variables? Please help! If you need any more information, i will provide. This one has me stumped after 4 hours of trying to figure it out. EDIT: you have been CODE tagged, remember in the future
  2. $result = mysql_query("SELECT * FROM Leads WHERE CID='" . $session->username . "' AND LeadID='echo $_GET['leadid']';" ); It is giving me an error saying Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING Please help!!!
  3. I have a block of code that displays the contents of my table for leads that i collect. I want to be able to hyperlink the "LeadID" so that when clicked, I can a page that displays that lead's info so i can then edit it if necessary. How do i make each returned "LeadID" hyperlinked so it will go to the next page? Here is my code so far that shows the table and i want to make LeadID hyperlinked to go to my next page details.php . Please help!!! while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['LeadID'] . "</td>"; echo "<td>" . $row['CID'] . "</td>"; echo "<td>" . $row['Category'] . "</td>"; echo "<td>" . $row['Name'] . "</td>"; echo "<td>" . $row['Email'] . "</td>"; echo "<td>" . $row['Phone'] . "</td>"; echo "<td>" . $row['Date'] . "</td>"; echo "<td>" . $row['Time'] . "</td>"; echo "<td>" . $row['Keyword'] . "</td>"; echo "<td>" . $row['More'] . "</td>"; echo "<td>" . $row['Less'] . "</td>"; echo "<td>" . $row['Closed'] . "</td>"; echo "<td>" . $row['Revenue'] . "</td>"; echo "</tr>"; }
  4. I have a table that tracks collects lead information like name email and phone number. it starts with the LeadID, which is primary. When the results are displayed, they are in a wierd order that i don't understand. I would like it to sort the displayed results by the LeadID, so they are in order. Please help! Here is the code as is: <?php echo "<table border='1'> <tr> <th>LeadID</th> <th>CID</th> <th>Category</th> <th>Name</th> <th>Email</th> <th>Phone</th> <th>Date</th> <th>Time</th> <th>Keyword</th> <th>Good Lead</th> <th>Bad Lead</th> <th>Closed</th> <th>Revenue</th> </tr>"; $result = mysql_query("SELECT * FROM Leads WHERE CID='$session->username'"); while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['LeadID'] . "</td>"; echo "<td>" . $row['CID'] . "</td>"; echo "<td>" . $row['Category'] . "</td>"; echo "<td>" . $row['Name'] . "</td>"; echo "<td>" . $row['Email'] . "</td>"; echo "<td>" . $row['Phone'] . "</td>"; echo "<td>" . $row['Date'] . "</td>"; echo "<td>" . $row['Time'] . "</td>"; echo "<td>" . $row['Keyword'] . "</td>"; echo "<td>" . $row['More'] . "</td>"; echo "<td>" . $row['Less'] . "</td>"; echo "<td>" . $row['Closed'] . "</td>"; echo "<td>" . $row['Revenue'] . "</td>"; echo "</tr>"; } echo "</table>"; } /* Link back to main */ echo "<br>Back To [<a href=\"main.php\">Main</a>]<br>"; ?>
×
×
  • Create New...

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.