Jump to content

$username

Members
  • Posts

    159
  • Joined

  • Last visited

    Never

Everything posted by $username

  1. Ok it looks like you have to open the permissions on Apache. Maybe something like this. Listen *:80 and some of this. If you read through the httpd.conf you will find lots of stuff in there.
  2. If you are trying to open a *.php file by clicking on it you will get nothing. You have to have a web server with PHP installed to then open them through a web browser "URL/file.php" PHP requires a PHP engine to display or process PHP code. There are many great free package that work great. Google WAMP or LAMP. Brett
  3. So websites that send you the password are most likely using no encryption? Thanks, Brett
  4. Hello All, I have some basic questions with registration and a forget password function. When some one registers, should one use MD5 to store the password in the database? And if that is the way one should how would you then get the password from the database so it can be emailed to the user? It seems like MD5s cannot be reversed to easily. If there is a easy way to do so, or another method that someone could share that would be awesome. Thanks, Brett
  5. Here is the part here I am using the html to pass a var in the url <table border="2" width="1800" rules="all" cellpadding="2" cellspacing="0" bordercolor="#000000" bgcolor="silver"> <tr> <td><a href="./show.php?Ord=ID"><b><u>Case ID</u></b></td> <td><a href="./show.php?Ord=FirstName"><b><u>First Name</u></b></td> <td><a href="./show.php?Ord=LastName"><b><u>Last Name</u></b></td> <td><a href="./show.php?Ord=AddressStreet"><b><u>Street</u></b></td> <td><a href="./show.php?Ord=AddressCity"><b><u>City</u></b></td> <td><a href="./show.php?Ord=AddressState"><b><u>State</u></b></td> <td><a href="./show.php?Ord=AddressZip"><b><u>ZipCode</u></b></td> <td><a href="./show.php?Ord=Paid"><b><u>Paid</u></b></td> <td><b>Amount</b></td> <td width="200"><b>Attempt 1</b></td> <td><b>Attempt 2</b></td> <td><b>Attempt 3</b></td> <td><b>Attempt 4</b></td> <td><b><a href="./show.php?Ord=OtherInfo"><u>Other Info</u></b></td> <td><b><a href="./show.php?Ord=ServBy"><u>Served By</u></b></td> <td><a href="./show.php?Ord=ClientName"><b><u>Client Name</u></b></td> <td><a href="./show.php?Ord=County"><b><u>County Served</u></b></td> <td><b>Serv Date</b></td> </tr> Ok here is the part where I am trying to pull the order from a var <?php $Ord = $_GET['Ord']; if ($Ord == "") $Ord = 'ID'; else $Ord = $_GET['Ord']; $sql = "SELECT * FROM store ORDER BY `$Ord`"; //$query = mysql_query($sql); $query = " SELECT * FROM store ORDER BY '$Ord'" . " LIMIT $offset, $rowsPerPage "; $result = mysql_query($query) or die('Error, query failed'); ?> Here is the complete code <?php include 'dbopen.php'; include 'dbconnect.php'; $rowsPerPage = 100; // by default we show first page $pageNum = 1; // if $_GET['page'] defined, use it as page number if(isset($_GET['page'])) { $pageNum = $_GET['page']; } // counting the offset $offset = ($pageNum - 1) * $rowsPerPage; $Ord = $_GET['Ord']; if ($Ord == "") $Ord = 'ID'; else $Ord = $_GET['Ord']; $sql = "SELECT * FROM store ORDER BY `$Ord`"; //$query = mysql_query($sql); $query = " SELECT * FROM store ORDER BY '$Ord'" . " LIMIT $offset, $rowsPerPage "; $result = mysql_query($query) or die('Error, query failed'); // print the random numbers while($row = mysql_fetch_array($result)) { //echo $row['ID'] . '<br>'; echo "<tr>"; echo("<td><a href=\"updateinfo.php?ID=" . $row["ID"] . "\" title=\"".$row["ID"]."\">" . $row["ID"] . "</a></td>"); //echo "<td>".$row['ID']."</td>"; echo "<td>".$row['FirstName']."</td>"; echo "<td>".$row['LastName']."</td>"; echo "<td>".$row['AddressStreet']."</td>"; echo "<td>".$row['AddressCity']."</td>"; echo "<td>".$row['AddressState']."</td>"; echo "<td>".$row['AddressZip']."</td>"; echo "<td>".$row['Paid']."</td>"; echo "<td>".$row['Amount']."</td>"; echo "<td>".$row['CaseNotes1']."</td>"; echo "<td>".$row['CaseNotes2']."</td>"; echo "<td>".$row['CaseNotes3']."</td>"; echo "<td>".$row['CaseNotes4']."</td>"; echo "<td>".$row['OtherInfo']."</td>"; echo "<td>".$row['ServBy']."</td>"; echo "<td>".$row['ClientName']."</td>"; echo "<td>".$row['County']."</td>"; echo "<td>".$row['ServDate']."</td>"; echo "</tr>"; } // ... more code here // ... the previous code // how many rows we have in database $query = "SELECT COUNT(ID) AS numrows FROM store"; $result = mysql_query($query) or die('Error, query failed'); $row = mysql_fetch_array($result, MYSQL_ASSOC); $numrows = $row['numrows']; // how many pages we have when using paging? $maxPage = ceil($numrows/$rowsPerPage); // print the link to access each page $self = $_SERVER['PHP_SELF']; $nav = ''; for($page = 1; $page <= $maxPage; $page++) { if ($page == $pageNum) { $nav .= " $page "; // no need to create a link to current page } else { $nav .= " <a href=\"$self?page=$page\">$page</a> "; } } // ... still more code coming // creating previous and next link // plus the link to go straight to // the first and last page if ($pageNum > 1) { $page = $pageNum - 1; $prev = " <a href=\"$self?page=$page\">[Prev]</a> "; $first = " <a href=\"$self?page=1\">[First Page]</a> "; } else { $prev = ' '; // we're on page one, don't print previous link $first = ' '; // nor the first page link } if ($pageNum < $maxPage) { $page = $pageNum + 1; $next = " <a href=\"$self?page=$page\">[Next]</a> "; $last = " <a href=\"$self?page=$maxPage\">[Last Page]</a> "; } else { $next = ' '; // we're on the last page, don't print next link $last = ' '; // nor the last page link } // print the navigation link echo $first . $prev . $nav . $next . $last; // and close the database connection // ... and we're done! ?>
  6. MYSQL display with next page and Order by column I have made the code and it works but when I am on page 2 and then select a column it will go back to page 1. Is there a way I can make it so I can still be in page 2 and also order by column? Here is the code. <?php // by default we show first page $pageNum = 1; // if $_GET['page'] defined, use it as page number if(isset($_GET['page'])) { $pageNum = $_GET['page']; } // counting the offset $offset = ($pageNum - 1) * $rowsPerPage; $Ord = $_GET['Ord']; if ($Ord == "") $Ord = 'ID'; else $Ord = $_GET['Ord']; $sql = "SELECT * FROM store ORDER BY `$Ord`"; //$query = mysql_query($sql); $query = " SELECT * FROM store ORDER BY '$Ord'" . " LIMIT $offset, $rowsPerPage "; $result = mysql_query($query) or die('Error, query failed'); // print the random numbers while($row = mysql_fetch_array($result)) { //echo $row['ID'] . '<br>'; echo "<tr>"; echo("<td><a href=\"updateinfo.php?ID=" . $row["ID"] . "\" title=\"".$row["ID"]."\">" . $row["ID"] . "</a></td>"); //echo "<td>".$row['ID']."</td>"; echo "<td>".$row['FirstName']."</td>"; echo "<td>".$row['LastName']."</td>"; echo "<td>".$row['AddressStreet']."</td>"; echo "<td>".$row['AddressCity']."</td>"; echo "<td>".$row['AddressState']."</td>"; echo "<td>".$row['AddressZip']."</td>"; echo "<td>".$row['Paid']."</td>"; echo "<td>".$row['Amount']."</td>"; echo "<td>".$row['CaseNotes1']."</td>"; echo "<td>".$row['CaseNotes2']."</td>"; echo "<td>".$row['CaseNotes3']."</td>"; echo "<td>".$row['CaseNotes4']."</td>"; echo "<td>".$row['OtherInfo']."</td>"; echo "<td>".$row['ServBy']."</td>"; echo "<td>".$row['ClientName']."</td>"; echo "<td>".$row['County']."</td>"; echo "<td>".$row['ServDate']."</td>"; echo "</tr>"; } // ... more code here // ... the previous code // how many rows we have in database $query = "SELECT COUNT(ID) AS numrows FROM store"; $result = mysql_query($query) or die('Error, query failed'); $row = mysql_fetch_array($result, MYSQL_ASSOC); $numrows = $row['numrows']; // how many pages we have when using paging? $maxPage = ceil($numrows/$rowsPerPage); // print the link to access each page $self = $_SERVER['PHP_SELF']; $nav = ''; for($page = 1; $page <= $maxPage; $page++) { if ($page == $pageNum) { $nav .= " $page "; // no need to create a link to current page } else { $nav .= " <a href=\"$self?page=$page\">$page</a> "; } } // ... still more code coming // creating previous and next link // plus the link to go straight to // the first and last page if ($pageNum > 1) { $page = $pageNum - 1; $prev = " <a href=\"$self?page=$page\">[Prev]</a> "; $first = " <a href=\"$self?page=1\">[First Page]</a> "; } else { $prev = ' '; // we're on page one, don't print previous link $first = ' '; // nor the first page link } if ($pageNum < $maxPage) { $page = $pageNum + 1; $next = " <a href=\"$self?page=$page\">[Next]</a> "; $last = " <a href=\"$self?page=$maxPage\">[Last Page]</a> "; } else { $next = ' '; // we're on the last page, don't print next link $last = ' '; // nor the last page link } // print the navigation link echo $first . $prev . $nav . $next . $last; ?> Thanks, Brett
  7. Thanks for your guys help. After looking into this one for some time I finally got it to work. Here is the code for this. <?php if (isset($_COOKIE["user"])) setcookie("user", ($_COOKIE["user"]), time()+600); else header("Location:cookerr.htm"); $ebits = ini_get('error_reporting'); error_reporting($ebits ^ E_NOTICE); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <script type="text/javascript"> function confirmdelete() { return confirm("Are you sure you want to delete?"); } </script> <? if(!isset($cmd)) { ?> <?php if (!isset($_POST['submit'])) { ?> <link href="/midaps/admin/tools/css/admin_style.css" rel="stylesheet" type="text/css" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title> --- </title> <style type="text/css"> <!-- body { background-color: #ffffff; background-image: url(../images/bg.png); } table, tr, td, div{ font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; color:#000000; border-collapse: collapse; } A:link { color: #000000; text-decoration : none;} A:visited { color: #000000; text-decoration : none;} A:active { color: #000000; text-decoration: none;} A:hover { color: red; text-decoration: none;font-weight:bold;} .style3 { font-size: 14px; font-family: Verdana, Arial, Helvetica, sans-serif; } .style10 {font-size: 10; font-weight: bold; } --> <p> </style></head> <div> <table> <tr> <td> <form action="show.php"> <input name="submit3" type="submit" value="Show Cases" /></td> </form> <td> <form action="write.php"> <input name="submit32" type="submit" value="Add New Case" /> </td> </form> <td> <form action="lobby.php"> <input name="submit33" type="submit" value="Main Page" /></td> </form> <td> <form action="logoff.php"> <input name="submit2" type="submit" value="Log Off" /></td> </form> </td> </tr> </table> </div> </form> <col span="1" align="right"> <!-- <p> <form method="POST" action="updateinfo.php"> <table> <col span="1" align="right" row span="2"> <tr> <td><font color="black">Case ID to Update:</font></td> <td><input type="text" name="ID" ></td> <td><input type="submit" value="Submit"></td> </tr> <tr> >--> <!-- <img width="400" height="100" src="\testmidapslogo.jpg"> --> </tr> </table> </form> </p> <p> <form action="delete.php" onsubmit="return confirmdelete();"> Case ID to Delete: <input type="text" name="IDname"> <input type="submit" name="delete" value="Delete"> </form> </p> <? } else { $ID = $_POST['IDname']; $query=("DELETE FROM store WHERE ID = '$ID'"); mysql_query($query) or die(mysql_error()); echo ""; } } ?> </p> </tr> </table> </form> </p> <table border="2" width="1800" rules="all" cellpadding="2" cellspacing="0" bordercolor="#000000" bgcolor="silver"> <tr> <td><a href="./show.php?Ord=ID"><b><u>Case ID</u></b></td> <td><a href="./show.php?Ord=FirstName"><b><u>First Name</u></b></td> <td><a href="./show.php?Ord=LastName"><b><u>Last Name</u></b></td> <td><a href="./show.php?Ord=AddressStreet"><b><u>Street</u></b></td> <td><a href="./show.php?Ord=AddressCity"><b><u>City</u></b></td> <td><a href="./show.php?Ord=AddressState"><b><u>State</u></b></td> <td><a href="./show.php?Ord=AddressZip"><b><u>ZipCode</u></b></td> <td><a href="./show.php?Ord=Paid"><b><u>Paid</u></b></td> <td><b>Amount</b></td> <td width="200"><b>Attempt 1</b></td> <td><b>Attempt 2</b></td> <td><b>Attempt 3</b></td> <td><b>Attempt 4</b></td> <td><b><a href="./show.php?Ord=OtherInfo"><u>Other Info</u></b></td> <td><b><a href="./show.php?Ord=ServBy"><u>Served By</u></b></td> <td><a href="./show.php?Ord=ClientName"><b><u>Client Name</u></b></td> <td><a href="./show.php?Ord=County"><b><u>County Served</u></b></td> <td><b>Serv Date</b></td> </tr> <?php include 'dbopen.php'; include 'dbconnect.php'; $rowsPerPage = 3; // by default we show first page $pageNum = 1; // if $_GET['page'] defined, use it as page number if(isset($_GET['page'])) { $pageNum = $_GET['page']; } // counting the offset $offset = ($pageNum - 1) * $rowsPerPage; $Ord = $_GET['Ord']; if ($Ord == "") $Ord = 'ID'; else $Ord = $_GET['Ord']; $sql = "SELECT * FROM store ORDER BY `$Ord`"; //$query = mysql_query($sql); $query = " SELECT * FROM store " . " LIMIT $offset, $rowsPerPage"; $result = mysql_query($query) or die('Error, query failed'); // print the random numbers while($row = mysql_fetch_array($result)) { //echo $row['ID'] . '<br>'; echo "<tr>"; echo("<td><a href=\"updateinfo.php?ID=" . $row["ID"] . "\" title=\"".$row["ID"]."\">" . $row["ID"] . "</a></td>"); //echo "<td>".$row['ID']."</td>"; echo "<td>".$row['FirstName']."</td>"; echo "<td>".$row['LastName']."</td>"; echo "<td>".$row['AddressStreet']."</td>"; echo "<td>".$row['AddressCity']."</td>"; echo "<td>".$row['AddressState']."</td>"; echo "<td>".$row['AddressZip']."</td>"; echo "<td>".$row['Paid']."</td>"; echo "<td>".$row['Amount']."</td>"; echo "<td>".$row['CaseNotes1']."</td>"; echo "<td>".$row['CaseNotes2']."</td>"; echo "<td>".$row['CaseNotes3']."</td>"; echo "<td>".$row['CaseNotes4']."</td>"; echo "<td>".$row['OtherInfo']."</td>"; echo "<td>".$row['ServBy']."</td>"; echo "<td>".$row['ClientName']."</td>"; echo "<td>".$row['County']."</td>"; echo "<td>".$row['ServDate']."</td>"; echo "</tr>"; } // ... more code here // ... the previous code // how many rows we have in database $query = "SELECT COUNT(ID) AS numrows FROM store"; $result = mysql_query($query) or die('Error, query failed'); $row = mysql_fetch_array($result, MYSQL_ASSOC); $numrows = $row['numrows']; // how many pages we have when using paging? $maxPage = ceil($numrows/$rowsPerPage); // print the link to access each page $self = $_SERVER['PHP_SELF']; $nav = ''; for($page = 1; $page <= $maxPage; $page++) { if ($page == $pageNum) { $nav .= " $page "; // no need to create a link to current page } else { $nav .= " <a href=\"$self?page=$page\">$page</a> "; } } // ... still more code coming // creating previous and next link // plus the link to go straight to // the first and last page if ($pageNum > 1) { $page = $pageNum - 1; $prev = " <a href=\"$self?page=$page\">[Prev]</a> "; $first = " <a href=\"$self?page=1\">[First Page]</a> "; } else { $prev = ' '; // we're on page one, don't print previous link $first = ' '; // nor the first page link } if ($pageNum < $maxPage) { $page = $pageNum + 1; $next = " <a href=\"$self?page=$page\">[Next]</a> "; $last = " <a href=\"$self?page=$maxPage\">[Last Page]</a> "; } else { $next = ' '; // we're on the last page, don't print next link $last = ' '; // nor the last page link } // print the navigation link echo $first . $prev . $nav . $next . $last; // and close the database connection // ... and we're done! ?> </table> </body> </html>
  8. The issue I am having it is not working for the pages to show. here is a screen Shot. I don't know if I have the code Correctly. Or if I may have to setup something with the code that I have in place. <?php if (isset($_COOKIE["user"])) setcookie("user", ($_COOKIE["user"]), time()+600); else header("Location:cookerr.htm"); $ebits = ini_get('error_reporting'); error_reporting($ebits ^ E_NOTICE); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <script type="text/javascript"> function confirmdelete() { return confirm("Are you sure you want to delete?"); } </script> <?php include 'dbopen.php'; include 'dbconnect.php'; $limit = 2; $query_count = "SELECT count(ID) FROM store"; $result_count = mysql_query($query_count); $totalrows = $result_count[0]; if(empty($page)){ // Checks if the $page variable is empty (not set) $page = 1; // If it is empty, we're on page 1 } $limitvalue = $page * $limit - ($limit); // Ex: (2 * 25) - 25 = 25 <- data starts at 25 $query = "SELECT * FROM store LIMIT $limitvalue, $limit"; $result = mysql_query($query) or die("Error: " . mysql_error()); // Selects all the data from table. // mysql_error() will print an error if one occurs. /* Tip: The MySQL LIMIT value syntax is as follows: LIMIT $row_to_start_at, $how_many_rows_to_return */ if(mysql_num_rows($result) == 0){ echo("Nothing to Display!"); } if(!isset($cmd)) { ?> <?php if (!isset($_POST['submit'])) { ?> <link href="/midaps/admin/tools/css/admin_style.css" rel="stylesheet" type="text/css" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title> --- </title> <style type="text/css"> <!-- body { background-color: #ffffff; background-image: url(../images/bg.png); } table, tr, td, div{ font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; color:#000000; border-collapse: collapse; } A:link { color: #000000; text-decoration : none;} A:visited { color: #000000; text-decoration : none;} A:active { color: #000000; text-decoration: none;} A:hover { color: red; text-decoration: none;font-weight:bold;} .style3 { font-size: 14px; font-family: Verdana, Arial, Helvetica, sans-serif; } .style10 {font-size: 10; font-weight: bold; } --> </style></head> <div> <table> <tr> <td> <form action="show.php"> <input name="submit3" type="submit" value="Show Cases" /></td> </form> <td> <form action="write.php"> <input name="submit32" type="submit" value="Add New Case" /> </td> </form> <td> <form action="lobby.php"> <input name="submit33" type="submit" value="Main Page" /></td> </form> <td> <form action="logoff.php"> <input name="submit2" type="submit" value="Log Off" /></td> </form> </td> </tr> </table> </div> </form> <col span="1" align="right"> <!-- <p> <form method="POST" action="updateinfo.php"> <table> <col span="1" align="right" row span="2"> <tr> <td><font color="black">Case ID to Update:</font></td> <td><input type="text" name="ID" ></td> <td><input type="submit" value="Submit"></td> </tr> <tr> >--> <!-- <img width="400" height="100" src="\testmidapslogo.jpg"> --> </tr> </table> </form> </p> <p> <form action="delete.php" onsubmit="return confirmdelete();"> Case ID to Delete: <input type="text" name="IDname"> <input type="submit" name="delete" value="Delete"> </form> </p> <? } else { $ID = $_POST['IDname']; $query=("DELETE FROM store WHERE ID = '$ID'"); mysql_query($query) or die(mysql_error()); echo ""; } } ?> <p> </p> </tr> </table> </form> </p> <table border="2" width="1800" rules="all" cellpadding="2" cellspacing="0" bordercolor="#000000" bgcolor="silver"> <tr> <td><a href="./show.php?Ord=ID"><b><u>Case ID</u></b></td> <td><a href="./show.php?Ord=FirstName"><b><u>First Name</u></b></td> <td><a href="./show.php?Ord=LastName"><b><u>Last Name</u></b></td> <td><a href="./show.php?Ord=AddressStreet"><b><u>Street</u></b></td> <td><a href="./show.php?Ord=AddressCity"><b><u>City</u></b></td> <td><a href="./show.php?Ord=AddressState"><b><u>State</u></b></td> <td><a href="./show.php?Ord=AddressZip"><b><u>ZipCode</u></b></td> <td><a href="./show.php?Ord=Paid"><b><u>Paid</u></b></td> <td><b>Amount</b></td> <td width="200"><b>Attempt 1</b></td> <td><b>Attempt 2</b></td> <td><b>Attempt 3</b></td> <td><b>Attempt 4</b></td> <td><b><a href="./show.php?Ord=OtherInfo"><u>Other Info</u></b></td> <td><b><a href="./show.php?Ord=ServBy"><u>Served By</u></b></td> <td><a href="./show.php?Ord=ClientName"><b><u>Client Name</u></b></td> <td><a href="./show.php?Ord=County"><b><u>County Served</u></b></td> <td><b>Serv Date</b></td> </tr> <?php $Ord = $_GET['Ord']; if ($Ord == "") $Ord = 'ID'; else $Ord = $_GET['Ord']; $sql = "SELECT * FROM store ORDER BY `$Ord`"; $query = mysql_query($sql); while($row = mysql_fetch_array($query)) { echo "<tr>"; echo("<td><a href=\"updateinfo.php?ID=" . $row["ID"] . "\" title=\"".$row["ID"]."\">" . $row["ID"] . "</a></td>"); //echo "<td>".$row['ID']."</td>"; echo "<td>".$row['FirstName']."</td>"; echo "<td>".$row['LastName']."</td>"; echo "<td>".$row['AddressStreet']."</td>"; echo "<td>".$row['AddressCity']."</td>"; echo "<td>".$row['AddressState']."</td>"; echo "<td>".$row['AddressZip']."</td>"; echo "<td>".$row['Paid']."</td>"; echo "<td>".$row['Amount']."</td>"; echo "<td>".$row['CaseNotes1']."</td>"; echo "<td>".$row['CaseNotes2']."</td>"; echo "<td>".$row['CaseNotes3']."</td>"; echo "<td>".$row['CaseNotes4']."</td>"; echo "<td>".$row['OtherInfo']."</td>"; echo "<td>".$row['ServBy']."</td>"; echo "<td>".$row['ClientName']."</td>"; echo "<td>".$row['County']."</td>"; echo "<td>".$row['ServDate']."</td>"; echo "</tr>"; } ?> <? $bgcolor = "#E0E0E0"; // light gray /* Sets up one of the background colors. The color stated here will be displayed second */ echo("<table>"); // Just a simple table while($row = mysql_fetch_array($result)){ /* This starts the loop (a while loop). What this does is returns a row of data to the $row array. Each time the loop restarts, the next row of data is used. So, each pass of the loop returns a different row of data. */ // Start The Background Check if($bgcolor == "#E0E0E0"){ $bgcolor = "#FFFFFF"; }else{ $bgcolor = "#E0E0E0"; } /* Tip: The color you want to appear first on the list should be where the #FFFFFF is listed. What this script does is checks to see if #E0E0E0 was used last; if it was, then it'll use #FFFFFF. All you have to do is replace the colors of your choice. */ echo("<tr bgcolor=".$bgcolor.">n<td>"); // Here we start table row & table data // Make sure your bgcolor is the $bgcolor variable echo($row["users"]); /* Tip: This is how we add the users field from our row. You can use any field from your row: all you do is include the field's name inbetween the array brackets. Ex: $row["field_name_here"] */ echo("</td>n<td>"); // Here we end the one section of table data, and start another. echo($row["usersID"]); // Prints the usersID field echo("</td>n</tr>"); // Here we end the table data & table row } /* This closes the loop. Anything after this bracket will display after the data you've pulled from the database. */ echo("</table>"); /* While we're at it, let's close the table tag--we don't want other data inside this table */ if($page != 1){ $pageprev = $page--; // Fancy way of subtracting 1 from $page echo("<a href=\"$PHP_SELF&page=$pageprev\">PREV".$limit."</a> "); /* Tip: It is a good idea NOT to use $PHP_SELF in this link. It may work, but to be 99.9% sure that it will, be sure to use the actual name of the file this script will be running on. Also, the adds a space to the end of PREV, and gives some room between the numbers. */ }else echo("PREV".$limit." "); // If we're on page 1, PREV is not a link $numofpages = $totalrows / $limit; /* We divide our total amount of rows (for example 102) by the limit (25). This will yield 4.08, which we can round down to 4. In the next few lines, we'll create 4 pages, and then check to see if we have extra rows remaining for a 5th page. */ for($i = 1; $i <= $numofpages; $i++){ /* This for loop will add 1 to $i at the end of each pass until $i is greater than $numofpages (4.08). */ if($i == $page){ echo($i." "); }else{ echo("<a href=\"$PHP_SELF&page=$i\">$i</a> "); } /* This if statement will not make the current page number available in link form. It will, however, make all other pages available in link form. */ } // This ends the for loop if(($totalrows % $limit) != 0){ /* The above statement is the key to knowing if there are remainders, and it's all because of the %. In PHP, C++, and other languages, the % is known as a Modulus. It returns the remainder after dividing two numbers. If there is no remainder, it returns zero. In our example, it will return 0.8 */ if($i == $page){ echo($i." "); }else{ echo("<a href=\"$PHP_SELF&page=$i\">$i</a> "); } /* This is the exact statement that turns pages into link form that is used above */ } // Ends the if statement if(($totalrows - ($limit * $page)) > 0){ /* This statement checks to see if there are more rows remaining, meaning there are pages in front of the current one. */ $pagenext = $page++; // Fancy way of adding 1 to page echo("<a href=\"$PHP_SELF?page=$pagenext\">NEXT".$limit."</a>"); /* Since there are pages remaining, this outputs NEXT in link form. */ }else{ echo("NEXT".$limit); /* If we're on the last page possible, NEXT will NOT be displayed in link form. */ } mysql_free_result($result); /* This line is not required, since MySQL will free the result after all scripts have finished executing; however, it's a nice little backup. */ // The next line tells the server to stop parsing PHP ?> </table> </body> </html> Thanks, Brett
  9. Hello everyone, I have code that I already had in place but my end user would like to have next page for the MYSQL display. I have read the doc that is posted on this site. I am having issues getting it to work. Here is all my code with the next and prev page code applied. <?php if (isset($_COOKIE["user"])) setcookie("user", ($_COOKIE["user"]), time()+600); else header("Location:cookerr.htm"); $ebits = ini_get('error_reporting'); error_reporting($ebits ^ E_NOTICE); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <script type="text/javascript"> function confirmdelete() { return confirm("Are you sure you want to delete?"); } </script> <?php include 'dbopen.php'; include 'dbconnect.php'; // Here is the code that I am using for Next and Prev Page $limit = 2; $query_count = "SELECT count(ID) FROM store"; $result_count = mysql_query($query_count); $totalrows = mysql_num_rows($result_count); if(empty($page)){ // Checks if the $page variable is empty (not set) $page = 1; // If it is empty, we're on page 1 } $limitvalue = $page * $limit - ($limit); // Ex: (2 * 25) - 25 = 25 <- data starts at 25 $query = "SELECT * FROM store LIMIT $limitvalue, $limit"; $result = mysql_query($query) or die("Error: " . mysql_error()); // Selects all the data from table. // mysql_error() will print an error if one occurs. /* Tip: The MySQL LIMIT value syntax is as follows: LIMIT $row_to_start_at, $how_many_rows_to_return */ if(mysql_num_rows($result) == 0){ echo("Nothing to Display!"); } //End Of Code for the part of the Next and Prev Page if(!isset($cmd)) { ?> <?php if (!isset($_POST['submit'])) { ?> <link href="/admin/tools/css/admin_style.css" rel="stylesheet" type="text/css" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title> --- </title> <style type="text/css"> <!-- body { background-color: #ffffff; background-image: url(../images/bg.png); } table, tr, td, div{ font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; color:#000000; border-collapse: collapse; } A:link { color: #000000; text-decoration : none;} A:visited { color: #000000; text-decoration : none;} A:active { color: #000000; text-decoration: none;} A:hover { color: red; text-decoration: none;font-weight:bold;} .style3 { font-size: 14px; font-family: Verdana, Arial, Helvetica, sans-serif; } .style10 {font-size: 10; font-weight: bold; } --> </style></head> <div> <table> <tr> <td> <form action="show.php"> <input name="submit3" type="submit" value="Show Cases" /></td> </form> <td> <form action="write.php"> <input name="submit32" type="submit" value="Add New Case" /> </td> </form> <td> <form action="lobby.php"> <input name="submit33" type="submit" value="Main Page" /></td> </form> <td> <form action="logoff.php"> <input name="submit2" type="submit" value="Log Off" /></td> </form> </td> </tr> </table> </div> </form> <col span="1" align="right"> <!-- <p> <form method="POST" action="updateinfo.php"> <table> <col span="1" align="right" row span="2"> <tr> <td><font color="black">Case ID to Update:</font></td> <td><input type="text" name="ID" ></td> <td><input type="submit" value="Submit"></td> </tr> <tr> >--> <!-- <img width="400" height="100" src="\testmidapslogo.jpg"> --> </tr> </table> </form> </p> <p> <form action="delete.php" onsubmit="return confirmdelete();"> Case ID to Delete: <input type="text" name="IDname"> <input type="submit" name="delete" value="Delete"> </form> </p> <? } else { $ID = $_POST['IDname']; $query=("DELETE FROM store WHERE ID = '$ID'"); mysql_query($query) or die(mysql_error()); echo ""; } } ?> <p> </p> </tr> </table> </form> </p> <table border="2" width="1800" rules="all" cellpadding="2" cellspacing="0" bordercolor="#000000" bgcolor="silver"> <tr> <td><a href="./show.php?Ord=ID"><b><u>Case ID</u></b></td> <td><a href="./show.php?Ord=FirstName"><b><u>First Name</u></b></td> <td><a href="./show.php?Ord=LastName"><b><u>Last Name</u></b></td> <td><a href="./show.php?Ord=AddressStreet"><b><u>Street</u></b></td> <td><a href="./show.php?Ord=AddressCity"><b><u>City</u></b></td> <td><a href="./show.php?Ord=AddressState"><b><u>State</u></b></td> <td><a href="./show.php?Ord=AddressZip"><b><u>ZipCode</u></b></td> <td><a href="./show.php?Ord=Paid"><b><u>Paid</u></b></td> <td><b>Amount</b></td> <td width="200"><b>Attempt 1</b></td> <td><b>Attempt 2</b></td> <td><b>Attempt 3</b></td> <td><b>Attempt 4</b></td> <td><b><a href="./show.php?Ord=OtherInfo"><u>Other Info</u></b></td> <td><b><a href="./show.php?Ord=ServBy"><u>Served By</u></b></td> <td><a href="./show.php?Ord=ClientName"><b><u>Client Name</u></b></td> <td><a href="./show.php?Ord=County"><b><u>County Served</u></b></td> <td><b>Serv Date</b></td> </tr> <?php $Ord = $_GET['Ord']; if ($Ord == "") $Ord = 'ID'; else $Ord = $_GET['Ord']; $sql = "SELECT * FROM store ORDER BY `$Ord`"; $query = mysql_query($sql); while($row = mysql_fetch_array($query)) { echo "<tr>"; echo("<td><a href=\"updateinfo.php?ID=" . $row["ID"] . "\" title=\"".$row["ID"]."\">" . $row["ID"] . "</a></td>"); //echo "<td>".$row['ID']."</td>"; echo "<td>".$row['FirstName']."</td>"; echo "<td>".$row['LastName']."</td>"; echo "<td>".$row['AddressStreet']."</td>"; echo "<td>".$row['AddressCity']."</td>"; echo "<td>".$row['AddressState']."</td>"; echo "<td>".$row['AddressZip']."</td>"; echo "<td>".$row['Paid']."</td>"; echo "<td>".$row['Amount']."</td>"; echo "<td>".$row['CaseNotes1']."</td>"; echo "<td>".$row['CaseNotes2']."</td>"; echo "<td>".$row['CaseNotes3']."</td>"; echo "<td>".$row['CaseNotes4']."</td>"; echo "<td>".$row['OtherInfo']."</td>"; echo "<td>".$row['ServBy']."</td>"; echo "<td>".$row['ClientName']."</td>"; echo "<td>".$row['County']."</td>"; echo "<td>".$row['ServDate']."</td>"; echo "</tr>"; } ?> <? //More code for the Next and Prev page $bgcolor = "#E0E0E0"; // light gray /* Sets up one of the background colors. The color stated here will be displayed second */ echo("<table>"); // Just a simple table while($row = mysql_fetch_array($result)){ /* This starts the loop (a while loop). What this does is returns a row of data to the $row array. Each time the loop restarts, the next row of data is used. So, each pass of the loop returns a different row of data. */ // Start The Background Check if($bgcolor == "#E0E0E0"){ $bgcolor = "#FFFFFF"; }else{ $bgcolor = "#E0E0E0"; } /* Tip: The color you want to appear first on the list should be where the #FFFFFF is listed. What this script does is checks to see if #E0E0E0 was used last; if it was, then it'll use #FFFFFF. All you have to do is replace the colors of your choice. */ echo("<tr bgcolor=".$bgcolor.">n<td>"); // Here we start table row & table data // Make sure your bgcolor is the $bgcolor variable echo($row["users"]); /* Tip: This is how we add the users field from our row. You can use any field from your row: all you do is include the field's name inbetween the array brackets. Ex: $row["field_name_here"] */ echo("</td>n<td>"); // Here we end the one section of table data, and start another. echo($row["usersID"]); // Prints the usersID field echo("</td>n</tr>"); // Here we end the table data & table row } /* This closes the loop. Anything after this bracket will display after the data you've pulled from the database. */ echo("</table>"); /* While we're at it, let's close the table tag--we don't want other data inside this table */ if($page != 1){ $pageprev = $page--; // Fancy way of subtracting 1 from $page echo("<a href=\"$PHP_SELF&page=$pageprev\">PREV".$limit."</a> "); /* Tip: It is a good idea NOT to use $PHP_SELF in this link. It may work, but to be 99.9% sure that it will, be sure to use the actual name of the file this script will be running on. Also, the adds a space to the end of PREV, and gives some room between the numbers. */ }else echo("PREV".$limit." "); // If we're on page 1, PREV is not a link $numofpages = $totalrows / $limit; /* We divide our total amount of rows (for example 102) by the limit (25). This will yield 4.08, which we can round down to 4. In the next few lines, we'll create 4 pages, and then check to see if we have extra rows remaining for a 5th page. */ for($i = 1; $i <= $numofpages; $i++){ /* This for loop will add 1 to $i at the end of each pass until $i is greater than $numofpages (4.08). */ if($i == $page){ echo($i." "); }else{ echo("<a href=\"$PHP_SELF&page=$i\">$i</a> "); } /* This if statement will not make the current page number available in link form. It will, however, make all other pages available in link form. */ } // This ends the for loop if(($totalrows % $limit) != 0){ /* The above statement is the key to knowing if there are remainders, and it's all because of the %. In PHP, C++, and other languages, the % is known as a Modulus. It returns the remainder after dividing two numbers. If there is no remainder, it returns zero. In our example, it will return 0.8 */ if($i == $page){ echo($i." "); }else{ echo("<a href=\"$PHP_SELF&page=$i\">$i</a> "); } /* This is the exact statement that turns pages into link form that is used above */ } // Ends the if statement if(($totalrows - ($limit * $page)) > 0){ /* This statement checks to see if there are more rows remaining, meaning there are pages in front of the current one. */ $pagenext = $page++; // Fancy way of adding 1 to page echo("<a href=\"$PHP_SELF?page=$pagenext\">NEXT".$limit."</a>"); /* Since there are pages remaining, this outputs NEXT in link form. */ }else{ echo("NEXT".$limit); /* If we're on the last page possible, NEXT will NOT be displayed in link form. */ } mysql_free_result($result); /* This line is not required, since MySQL will free the result after all scripts have finished executing; however, it's a nice little backup. */ // The next line tells the server to stop parsing PHP //End of more code for Next and Prev ?> </table> </body> </html> If there is any light that you can shine on this for me that would be great. Thanks, Brett P.S. What is the tag to show HTMl and PHP code with all the nice colors.
  10. Thanks that helps. I did not even see that when I was searching on google. Brett
  11. Hello Guys, I have a feeling that this is a bigger project then I think it maybe. I have a MYSQL data being pulled in by PHP I have the code to do this but I do not have the code to make it work with next pages. I did find some code that looks like I could get the next pages to work. But i was going to see if you guys have a easy, better way to get it to work with the code I have. <?php if (isset($_COOKIE["user"])) setcookie("user", ($_COOKIE["user"]), time()+600); else header("Location:cookerr.htm"); $ebits = ini_get('error_reporting'); error_reporting($ebits ^ E_NOTICE); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <script type="text/javascript"> function confirmdelete() { return confirm("Are you sure you want to delete?"); } </script> <?php include 'dbopen.php'; include 'dbconnect.php'; if(!isset($cmd)) { ?> <?php if (!isset($_POST['submit'])) { ?> <link href="/midaps/admin/tools/css/admin_style.css" rel="stylesheet" type="text/css" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title> --- </title> <style type="text/css"> <!-- body { background-color: #ffffff; background-image: url(../images/bg.png); } table, tr, td, div{ font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; color:#000000; border-collapse: collapse; } A:link { color: #000000; text-decoration : none;} A:visited { color: #000000; text-decoration : none;} A:active { color: #000000; text-decoration: none;} A:hover { color: red; text-decoration: none;font-weight:bold;} .style3 { font-size: 14px; font-family: Verdana, Arial, Helvetica, sans-serif; } .style10 {font-size: 10; font-weight: bold; } --> </style></head> <div> <table> <tr> <td> <form action="show.php"> <input name="submit3" type="submit" value="Show Cases" /></td> </form> <td> <form action="write.php"> <input name="submit32" type="submit" value="Add New Case" /> </td> </form> <td> <form action="lobby.php"> <input name="submit33" type="submit" value="Main Page" /></td> </form> <td> <form action="logoff.php"> <input name="submit2" type="submit" value="Log Off" /></td> </form> </td> </tr> </table> </div> </form> <col span="1" align="right"> <!-- <p> <form method="POST" action="updateinfo.php"> <table> <col span="1" align="right" row span="2"> <tr> <td><font color="black">Case ID to Update:</font></td> <td><input type="text" name="ID" ></td> <td><input type="submit" value="Submit"></td> </tr> <tr> >--> <!-- <img width="400" height="100" src="\testmidapslogo.jpg"> --> </tr> </table> </form> </p> <p> <form action="delete.php" onsubmit="return confirmdelete();"> Case ID to Delete: <input type="text" name="IDname"> <input type="submit" name="delete" value="Delete"> </form> </p> <? } else { $ID = $_POST['IDname']; $query=("DELETE FROM store WHERE ID = '$ID'"); mysql_query($query) or die(mysql_error()); echo ""; } } ?> <p> </p> </tr> </table> </form> </p> <table border="2" width="1800" rules="all" cellpadding="2" cellspacing="0" bordercolor="#000000" bgcolor="silver"> <tr> <td><a href="./show.php?Ord=ID"><b><u>Case ID</u></b></td> <td><a href="./show.php?Ord=FirstName"><b><u>First Name</u></b></td> <td><a href="./show.php?Ord=LastName"><b><u>Last Name</u></b></td> <td><a href="./show.php?Ord=AddressStreet"><b><u>Street</u></b></td> <td><a href="./show.php?Ord=AddressCity"><b><u>City</u></b></td> <td><a href="./show.php?Ord=AddressState"><b><u>State</u></b></td> <td><a href="./show.php?Ord=AddressZip"><b><u>ZipCode</u></b></td> <td><a href="./show.php?Ord=Paid"><b><u>Paid</u></b></td> <td><b>Amount</b></td> <td width="200"><b>Attempt 1</b></td> <td><b>Attempt 2</b></td> <td><b>Attempt 3</b></td> <td><b>Attempt 4</b></td> <td><b><a href="./show.php?Ord=OtherInfo"><u>Other Info</u></b></td> <td><b><a href="./show.php?Ord=ServBy"><u>Served By</u></b></td> <td><a href="./show.php?Ord=ClientName"><b><u>Client Name</u></b></td> <td><a href="./show.php?Ord=County"><b><u>County Served</u></b></td> <td><b>Serv Date</b></td> </tr> <?php $Ord = $_GET['Ord']; if ($Ord == "") $Ord = 'ID'; else $Ord = $_GET['Ord']; $sql = "SELECT * FROM store ORDER BY `$Ord` DESC LIMIT 0,250"; $query = mysql_query($sql); while($row = mysql_fetch_array($query)) { echo "<tr>"; echo("<td><a href=\"updateinfo.php?ID=" . $row["ID"] . "\" title=\"".$row["ID"]."\">" . $row["ID"] . "</a></td>"); //echo "<td>".$row['ID']."</td>"; echo "<td>".$row['FirstName']."</td>"; echo "<td>".$row['LastName']."</td>"; echo "<td>".$row['AddressStreet']."</td>"; echo "<td>".$row['AddressCity']."</td>"; echo "<td>".$row['AddressState']."</td>"; echo "<td>".$row['AddressZip']."</td>"; echo "<td>".$row['Paid']."</td>"; echo "<td>".$row['Amount']."</td>"; echo "<td>".$row['CaseNotes1']."</td>"; echo "<td>".$row['CaseNotes2']."</td>"; echo "<td>".$row['CaseNotes3']."</td>"; echo "<td>".$row['CaseNotes4']."</td>"; echo "<td>".$row['OtherInfo']."</td>"; echo "<td>".$row['ServBy']."</td>"; echo "<td>".$row['ClientName']."</td>"; echo "<td>".$row['County']."</td>"; echo "<td>".$row['ServDate']."</td>"; echo "</tr>"; } ?> </table> </body> </html> If this is to much to ask just let me know, and I will work on it and post the code that I have issues. Thank you, Brett
  12. The INT 11 is a good way. I like this way as well. Brett
  13. Ok I did fix the SQL injection. Thanks guys. When I get closer to some more progress I will repost. Thanks, Brett
  14. I used this and it seems to work ok. <td><font color="blue">Paid:</font></td> <td><select name="Paid"> <?php $no_opt = '<option value="No" '; $yes_opt = '<option value="Yes" '; if ($formVars["Paid"] == "No") $no_opt .= 'selected=selected'; else $yes_opt .= 'selected=selected'; $no_opt .= '>'; $yes_opt .= '>'; ?> <?php echo $no_opt;?>No</option> <?php echo $yes_opt;?>Yes</option> </select><big></big></td> </tr> </p> Thanks guys. Brett
  15. I am using this code to update data that is in the database. What I would like is the code to pull what the database has, and then use it in the drop down box. But I do not want the drop down to have 2 yes or no in the drop down. But I still would like the drop down box to populate the yes or no that the database has listed. Thank you, Brett
  16. Here is the code that I am using and I want to know if yes and no must be stored in the database to get the selected one from the database to be populated. <p> <td><font color="blue">Paid:</font></td> <td><select name="Paid"> <option selected="<? echo $formVars["Paid"]; ?>"><? echo $formVars["Paid"]; ?></option> <option value="No">No</option> <option value="Yes">Yes</option> </select><big></big></td> </tr> </p> Here is what happens now
  17. Hello All, Here is the code that I am using and I want to know if yes and no must be stored in the database to get the selected one from the database to be populated. <p> <td><font color="blue">Paid:</font></td> <td><select name="Paid"> <option selected="<? echo $formVars["Paid"]; ?>"><? echo $formVars["Paid"]; ?></option> <option value="No">No</option> <option value="Yes">Yes</option> </select><big></big></td> </tr> </p> Here is what happens now
  18. Well you guys nailed that on the head. Thanks. Brett
  19. Hello Ladies and Gents, I have a new issue. I have a piece of code that throws my tables off. while($row = mysql_fetch_array($query)) { echo "<tr>"; echo("<td><a href=\"updateinfo.php?ID=" . $row["ID"] . "\" title=\"".$row["ID"]."\">" . $row["ID"] . "</a><td>"); echo "<td>".$row['FirstName']."</td>"; echo "<td>".$row['LastName']."</td>"; echo "<td>".$row['AddressStreet']."</td>"; echo "<td>".$row['AddressCity']."</td>"; echo "<td>".$row['AddressState']."</td>"; echo "<td>".$row['AddressZip']."</td>"; echo "<td>".$row['Paid']."</td>"; echo "<td>".$row['Amount']."</td>"; echo "<td>".$row['CaseNotes1']."</td>"; echo "<td>".$row['CaseNotes2']."</td>"; echo "<td>".$row['CaseNotes3']."</td>"; echo "<td>".$row['CaseNotes4']."</td>"; echo "<td>".$row['OtherInfo']."</td>"; echo "<td>".$row['ServBy']."</td>"; echo "<td>".$row['ClientName']."</td>"; echo "<td>".$row['County']."</td>"; echo "<td>".$row['ServDate']."</td>"; echo "</tr>"; } ?> When I take out the link generator on the second line, then my tables line up. When the 3 lines is in there is throws everything off. echo("<td><a href=\"updateinfo.php?ID=" . $row["ID"] . "\" title=\"".$row["ID"]."\">" . $row["ID"] . "</a><td>"); Here is a pic of what it looks like. When I don't have that code in there it looks like this. echo "<td>".$row['ID']."</td>"; Is there something I can do that would make the code work with in one table. Thanks, Brett
  20. That did the trick. Thanks guys!!!! I have more brain busters for you guys so stay tuned. Thank you, Brett
  21. Ok sorry guys I am still pretty New. Here is my code <p> <tr><td><font color="blue">Client Name: </font></td> <td> <?$sql = "SELECT DISTINCT(`username`) FROM `userlogin` ORDER BY `ID` DESC"; $result=mysql_query($sql); echo "<select name=\"ClientName\">"; while($row=mysql_fetch_array($result)) { echo "<option value=\"$row[username]\">$row[username]"; } echo "</select>"; ?> </td> </tr> </p> Now it is showing just the first one in the list and not the one that was entered in the database as the one to be shown. I found this code that may work <p> <tr><td><font color="blue">Client Name: </font></td> <td> <?$sql = "SELECT DISTINCT(`username`) FROM `userlogin` ORDER BY `ID` DESC"; $result=mysql_query($sql); echo "<select name=\"ClientName\">"; while($row=mysql_fetch_array($result)) { echo "<option value=\"$row[username]\">$row[username]"; } echo "</select>";?> </td> </tr> </p> But I cannot get the right one to be selected. It should have the one that the database has to be selected. Thanks guys for putting up with me. Brett
  22. Well I tried the DISTINCT but it is still showing all both options I think it may have something to do with my option select "<option selected="<? echo $formVars["ClientName"]; ?>"><? echo $formVars["ClientName"]; ?></option>" <p> <tr><td><font color="blue">Client Name: </font></td> <td><select name="ClientName"> <option selected="<? echo $formVars["ClientName"]; ?>"><? echo $formVars["ClientName"]; ?></option> <?$sql = "SELECT DISTINCT username FROM userlogin ORDER BY `ID` DESC"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { while ($row = mysql_fetch_assoc($result)) { echo "<option value=\"{$row['username']}\">{$row['username']}</option>"; } } } ?> </select><big>*</big></td> </tr> </p> Sorry about the Code/HTML I dont really know what you have to add to get the pretty colors. Thank you, Brett
  23. Ok I think i miss "spoke". What I am looking for is that the there are not to of the same options in the drop down box. How would I have the code to just show the selected and not display both test2. Its like it is showing the one that is from databse with all the clients and one that is from the database with the one that was selected when the case was made. See this is and update form so a person can go into the case to update. I hope that this makes sense. Thank you, Brett
  24. Hello All, I am working on some PHP code that automatically displays info from a MYSQL table in the drop down box. My code works fine but the only thing is it list 1 item that is the one it is pulling from the database and then the other default options that are in the code. <p> <tr><td><font color="blue">Client Name: </font></td> <td><select name="ClientName"> <option selected="<? echo $formVars["ClientName"]; ?>"><? echo $formVars["ClientName"]; ?></option> <?$sql = "SELECT * FROM userlogin ORDER BY `ID` DESC"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { while ($row = mysql_fetch_assoc($result)) { echo "<option value=\"{$row['username']}\">{$row['username']}</option>"; } } } ?> Is there away to make it so it select one of the options and not display the 2 of the same items? Here is more code that works the same with yes and no drop down box. <p> <td><font color="blue">Paid:</font></td> <td><select name="Paid"> <option selected="<? echo $formVars["Paid"]; ?>"><? echo $formVars["Paid"]; ?></option> <option value="No">No</option> <option value="Yes">Yes</option> </select><big></big></td> </tr> </p> thanks, Brett
  25. Ok guys I have been working on this login SQL injection. How would I add in the magic quotes gpc. Here is the code from my login page. <?php include 'dbopen.php'; include 'dbconnect.php'; //$ebits = ini_get('error_reporting'); //error_reporting($ebits ^ E_NOTICE); $username = $_POST['username']; $password = $_POST['password']; $username = trim($username); $password = trim($password); if(($username == null) || ($password == null)) { header("Location: login.htm"); } else { //$cUsername = crypt($username, false); //include 'dbopen.php' //include 'dbconnect.php' $sql = mysql_query("SELECT * FROM admin where password = '$password' and username = '$username'"); $num = mysql_num_rows($sql); $sql2 = mysql_query("SELECT * FROM admin where password = '$password' and username = '$username' and secvalue = 1"); $num2 = mysql_num_rows($sql2); if($num2 == 1) { setcookie("user", $username, time()+600); mysql_close($conn); header("Location: lobby.php"); } else if(($num == 1) && ($num2 == 0)) { $msg = ("You have not activated you account yet. Please do so before trying to log in."); mysql_close($conn); } else { $msg = ("You have entered and invalid name or password. Please press 'Try Again' to re-try."); //mysql_close(mysql_connect); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Login Problem</title> <link rel="stylesheet" type="text/css" href="global.css" /> <script language="JavaScript" type="text/javascript"> <!-- function goBack() { window.history.go(-1); } //--> </script> </head> <body> <center> <h1>Login Problem</h1> </center> <p><?php echo($msg); ?></p> <form> <input type="button" value="Try Again!" onclick="goBack()" /> </form> </body> </html> No this is also making the cookie. Is there an easy way of making this more secure? Thank you, Brett
×
×
  • 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.