Jump to content

peranha

Members
  • Posts

    878
  • Joined

  • Last visited

Everything posted by peranha

  1. do you have a function that cleans data already as far as other things. if so just add mysql_real_escape_string() to the function.
  2. try changing this section of code $addnew1=$_GET["addnew"]; if($addnew1=='1'){ $add_offername=$_POST["add_offername"]; $add_urlrewrite=$_POST["add_urlrewrite"]; $add_description=$_POST["add_description"]; $add_url=$_POST["add_url"]; $add_points=$_POST["add_points"]; $add_level=$_POST["add_level"]; mysql_query("insert into offers (offerid,title,titlerewrite,description,url,pointworth,level,active)". "VALUES ('NULL','$add_offername','$add_urlrewrite','$add_description','$add_url','$add_points','$add_level','1')"); echo "<b>* The new offer has been added to the database.</b><br>"; echo "<br>"; } to if (isset($_POST['addnew'] { $addnew1=$_GET["addnew"]; if($addnew1=='1'){ $add_offername=$_POST["add_offername"]; $add_urlrewrite=$_POST["add_urlrewrite"]; $add_description=$_POST["add_description"]; $add_url=$_POST["add_url"]; $add_points=$_POST["add_points"]; $add_level=$_POST["add_level"]; mysql_query("insert into offers (offerid,title,titlerewrite,description,url,pointworth,level,active)". "VALUES ('NULL','$add_offername','$add_urlrewrite','$add_description','$add_url','$add_points','$add_level','1')"); echo "<b>* The new offer has been added to the database.</b><br>"; echo "<br>"; } } You never check to see if submit is pressed.
  3. Chang this line $percent = $products["percent"]; to this $percent = $margins["percent"];
  4. 42: $i++ I believe that should be 42: $i++;
  5. I just moved the no results section to the bottom of the page, and the links in the loop that if results are found.
  6. I dont think it is mysql. If you are using apache, I believe this is what you want. Look for a line that says this in the config file. ServerAdmin webmaster@website.com
  7. Not a problem, glad it is working fine. Please mark the topic as solved. There is a button on the bottom left under the last post.
  8. This is what I use for my pagination, I have png files with arrows on them, and it shows them, but it doesnt make the link active if there is only 1 page, or no pages at all. If you want, just put your < > in the place of the images and it will show them instead. It should work. if ($pageno == 1) { echo "<img src='pics/first.png' alt='' /> <img src='pics/previous.png' alt=''/> "; } else { echo " <a href='{$_SERVER['PHP_SELF']}?pageno=1'><img src='pics/first.png' alt=''/></a> "; $prevpage = $pageno-1; echo " <a href='{$_SERVER['PHP_SELF']}?pageno=$prevpage'><img src='pics/previous.png' alt=''/></a> "; } // if echo " ( Page $pageno of $lastpage ) "; if ($pageno == $lastpage) { echo " <img src='pics/next.png' alt=''/> <img src='pics/last.png' alt=''/>"; } else { $nextpage = $pageno+1; echo " <a href='{$_SERVER['PHP_SELF']}?pageno=$nextpage'><img src='pics/next.png' alt=''/></a>"; echo " <a href='{$_SERVER['PHP_SELF']}?pageno=$lastpage'><img src='pics/last.png' alt=''/></a>"; } // if
  9. You can try this and see if it works the way you want it to. I rearrange the logic a little, and I didnt test it, but should work. <?php // database connection info $conn = mysql_connect('localhost','root', 'pass') or trigger_error("SQL", E_USER_ERROR); $db = mysql_select_db('database', $conn) or trigger_error("SQL", E_USER_ERROR); // find out how many rows are in the table $sql = "SELECT COUNT(*) FROM table"; $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); $r = mysql_fetch_row($result); $numrows = $r[0]; // number of rows to show per page $rowsperpage = 5; // find out total pages $totalpages = ceil($numrows / $rowsperpage); // get the current page or set a default if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) { // cast var as int $currentpage = (int) $_GET['currentpage']; } else { // default page num $currentpage = 1; } // end if // if current page is greater than total pages... if ($currentpage > $totalpages) { // set current page to last page $currentpage = $totalpages; } // end if // if current page is less than first page... if ($currentpage < 1) { // set current page to first page $currentpage = 1; } // end if // the offset of the list, based on current page $offset = ($currentpage - 1) * $rowsperpage; // get the info from the db $sql = "SELECT * FROM table LIMIT $offset, $rowsperpage"; $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); if(mysql_num_rows($result) > 1){ while($row = mysql_fetch_assoc($result)) { // echo results from search. echo "Results"; } // end while /****** build the pagination links ******/ // if not on page 1, show back links if ($currentpage > 1) { // show << link to go back to page 1 echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=1'><<</a> "; // get previous page num $prevpage = $currentpage - 1; // show < link to go back to 1 page echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$prevpage'><</a> "; } // end if // range of num links to show $range = 3; // loop to show links to range of pages around current page for ($x = (($currentpage - $range) - 1); $x < (($currentpage + $range) + 1); $x++) { // if it's a valid page number... if (($x > 0) && ($x <= $totalpages)) { // if we're on current page... if ($x == $currentpage) { // 'highlight' it but don't make a link echo " [$x] "; // if not current page... } else { // make it a link echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$x'>$x</a> "; } // end else } // end if } // end for // if not on last page, show forward and last page links if ($currentpage != $totalpages) { // get next page $nextpage = $currentpage + 1; // echo forward link for next page echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$nextpage'>></a> "; // echo forward link for lastpage echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$totalpages'>>></a> "; } // end if /****** end build pagination links ******/ } // end else else { echo "<p>No results.</p>"; } ?>
  10. The logic of the page will have to be redone. A die statement stops the script from running after that point.
  11. Then change these lines { echo "<p>No results.</p>"; } to { echo "<p>No results.</p>"; die(); }
  12. $query1 = "INSERT INTO `slaterjohn`.`minifeed` (`miniID`, `feedtitle`, `itemtitle`, `itemdate`, `itemlink`, `itembody`, `favico`) VALUES (NULL , '1', '2', '3', '4', '5', '6')"; mysql_query($query1); Try that, I took out the first ; in the query. you dont need it
  13. On the page do yo get "No results" with the linkable carrots (< << >> >)
  14. Put this in a different file call it getimage.php <?php $path = $_GET['id']; $extension = substr($path, -3); if($extension == "jpg" || $extension == "jpeg"){ header("Content-type: image/jpeg"); }elseif($extension == "gif"){ header("Content-type: image/gif"); }elseif($extension == "bmp"){ header("Content-type: image/bmp"); } readfile($path); ?> then on your page call it like this echo "<img src='getimage.php?id=" . $destination . "' alt='' />"; This worked on my server.
  15. Are you trying to connect to it from inside your private network, or from outside?
  16. <?php $path = 'c:\wamp\tmp'."\\".$_FILES['pix']['name']; $extension = substr($path, -3); if($extension == "jpg" || $extension == "jpeg"){ header("Content-type: image/jpeg"); }elseif($extension == "gif"){ header("Content-type: image/gif"); }elseif($extension == "bmp"){ header("Content-type: image/bmp"); } readfile($path); ?> echo "<img src='$path' />"; try that and see what you get.
  17. dont you save the name of the file in a database or something? If not, I would, and if it is only displayed once, you can use this to display it once $_FILES['pix']['name']
  18. <img src='path_to_pic.jpg' alt='' />
  19. Add http:// in front of it, mine works fine in hotmail this is what I have. $message.="http://www.website.com/confirmation.php?passkey=$uniqueid \r\n";
  20. Also you need to change you query to $result = mysql_query("select Email, user, etc... from Accounts where AccountID='$_POST[username]'") or die(mysql_error()); from $result = mysql_query("select Email from Accounts where AccountID='$_POST[username]'") or die(mysql_error());
  21. yes you would $accemail = $row[0]; $accname = $row[1]; etc. row[1], may not be the name, not sure how your database is set up.
  22. thats because you are not checking the database to make sure that the info matches it. you will have to do something similar to this for all fields else if ($_POST['oldemail'] != $accemail) { echo "email invalid."; echo '<a href="email.php">Return to email page</a>'; die(); }
  23. try adding http:// in front of it do you know if it is a specific email server that is doing this, I havent had any problems, but I have http:// in front of mine.
×
×
  • 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.