Jump to content

Mod-Jay

Members
  • Posts

    155
  • Joined

  • Last visited

    Never

Posts posted by Mod-Jay

  1. I dont know whats wrong

     

    Error:

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '::1, 3, , now())' at line 1

     

    Error Line:

                    mysql_query('INSERT INTO `'. $db .'`.`votes` (`ip`, `serverId`, `ownerId`, `date`) VALUES ('. $ip .', '. $serverId .', '. $ownerId .', now())') or die(mysql_error());
    

  2. Hi im trying to make it so the time says how many hows left, not how many hours past. i have the right idea but it shows a negative number under "$time"

     

                  $hours = number_format(($diffrence / 60 / 60));
                  $time = number_format(($hours - 24));

  3. Hi im trying to Make a Timer count down in this code

     

     function getTime($host, $user, $pass, $db, $hours, $ip, $serverId) {
      $c = @mysql_connect($host, $user, $pass);
          if(mysql_select_db($db, $c)) {
                  $dateQ = mysql_query('SELECT MAX(date) AS lastVoteDate FROM `'. $db .'`.`votes` WHERE ip="'. $ip .'"') or die(mysql_error());
                  $getDate = mysql_fetch_assoc($dateQ);
                  $diffrence = time() - strtotime($getDate['lastVoteDate']);
                  $hours = number_format(($diffrence / 60 / 60));
                  $minutes = number_format(($hours / 60));
                  if(!$hours < 1){
                    return ("". $hours ."");
                    } else {
                    return ("0");
                    }
          } else {
              return array(1, "Error connecting to DB.");
          }   
    }

  4. Umm.. Yeah, this MySQL line needs some reviewing

     

    list($total_banned_servers) = mysql_fetch_row(mysql_query("SELECT COUNT(id) FROM `toplist` WHERE banned='1' && serverowner=". $_SESSION['user'] .""));
    

  5. Something isn't adding up here. Have you searched your php.ini file to see if there's a line in it that contains -5.0/no DST?

     

    Paste this at the top of the script and see if the error disappears. If it does, either that value in php.ini is being overwritten later in the file, or that php.ini file is not the one being used by php.

    date_default_timezone_set("America/New_York");
    

    There was no line but i search it with windows 7 and 5 other files came up. i placed that in the php.ini spot where it should go and it still isnt working. i have team viewer if you want to look for yourself

  6. Error

     

    Warning: date_default_timezone_get() [function.date-default-timezone-get]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for '-5.0/no DST' instead in C:\Users\cory j\Desktop\xampp\htdocs\phpinfo.php on line 3
    America/New_York

  7. yep, my bad. i didn't see the post. but you didn't have to be such a @$%@ about it. I won't bother trying to help YOU again. meh!

     

    Yup.. i agree, i wouldn't want to help myself either. I have restarted Apache and it show the same error, Anymore help? Please

  8. potentially important part of that notice:

     

    We selected 'America/New_York' for '-5.0/no DST' instead in C:\Users\cory j\Desktop\xampp\htdocs\NoXIp\Toplist\inc\vote.php on line 56

     

    what's on line 56 of vote.php?

     

    Are you blind? it says it right there Line 56

  9. I have a Xampp Timezone Error

     

    Error

    Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for '-5.0/no DST' instead in C:\Users\cory j\Desktop\xampp\htdocs\NoXIp\Toplist\inc\vote.php on line 56
    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' NOW())' at line 1

     

    Line 56

                  $diffrence = time() - strtotime($getDate['lastVoteDate']);
    

     

    The Date Function in Php.ini

    [Date]
    ; Defines the default timezone used by the date functions
    ; http://php.net/date.timezone
    date.timezone = "America/New_York"
    date.timezone = "America/New_York"
    ; http://php.net/date.default-latitude
    ;date.default_latitude = 31.7667
    
    ; http://php.net/date.default-longitude
    ;date.default_longitude = 35.2333
    
    ; http://php.net/date.sunrise-zenith
    ;date.sunrise_zenith = 90.583333
    
    ; http://php.net/date.sunset-zenith
    ;date.sunset_zenith = 90.583333

  10. Hi im trying to make it get the server from the toplist data by the server owner, after that i want it to check if theres more then 1 server if there is i want it to add all the votes together and if there isnt more then 1 i want it to show the votes

     

    <?php
    $votes = mysql_query("SELECT * FROM toplist WHERE serverowner='{$_SESSION['user']}'") or die(mysql_error());
        while($vote = mysql_fetch_array($votes)) 
        {
        if(mysql_num_rows($vote) > 1 {
        //gets the server votes and adds them
        } else {
        $servervotes = $vote['votes'];
        }
    echo $servervotes; ?>
        }

  11. New  Question im trying to do the same thing but this one is alittle complicated

     

    list($total_votes) = mysql_fetch_row(mysql_query("SELECT COUNT(id) FROM toplist WHERE id='{$_SESSION['id']}', votes='votes'"));

  12. Hi i am trying to make a dropdown box, the drop down works but the design does not. im trying to make it have a border on everyone on hover and normal. whats it does it leaves the top border empty on the top and it works for the rest. i want it to have the borders on it on normal too. if you need pictures/more explanation please post about it. Thanks!

     

    #menus a.fly {
    display: block;
    width: 184px;
    height: 22px;
    overflow: hidden;
    line-height: 15px;
    color: green;
    text-decoration: none;
    text-align: left;
    border-bottom: 2px solid white;
    }
    
    #menus a.fly span {
    display: block;
    padding: 3px 4px 0;
    }
    
    
    #menus a.fly:hover {
    color: red;
    margin: center;
    border-right: 2px solid white;
    border-left: 2px solid white;
    background-color: #898989;
    background-position: 1px -48px;
    }

  13. function sendText()
    {
    if($_SERVER['REQUEST_METHOD'] == 'POST'){
    return mysql_query("INSERT INTO `test`.`chat` (`date` ,`username` ,`text`) VALUES (NOW( ) , 'Guest', '". realEscape($_POST['text']) ."');");
    } else {
    }
    }

    thats sends it to the db , thats what keeps resending

     

    From code:

    <form METHOD="POST"><textarea class="box2" style="float:left;resize:none;" name="text" id="text"></textarea>
    <input type="submit" value="Send" style="height:56px;" onClick="reloadIt();sendText();"></form>

  14. Lol.. New one:

    <?php
    // database connection info
    $conn = mysql_connect('localhost','root','') or trigger_error("SQL", E_USER_ERROR);
    $db = mysql_select_db('school',$conn) or trigger_error("SQL", E_USER_ERROR);
    
    // find out how many rows are in the table 
    $sql = "SELECT COUNT(*) FROM main";
    $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 = 10;
    // 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 
    
      // Get the search variable from URL
    
      $var = @$_GET['q'] ;
      $trimmed = trim($var); //trim whitespace from the stored variable
    
    // rows to return
    $limit=10; 
    
    // check for an empty string and display a message.
    if ($trimmed == "")
      {
      echo "<p>Please enter a search...</p>";
      exit;
      }
    
    // check for a search parameter
    if (!isset($var))
      {
      echo "<p>We dont seem to have a search parameter!</p>";
      exit;
      }
    
    // Build SQL Query  
    $query = "SELECT * FROM main WHERE username LIKE '%$trimmed%' ORDER BY username LIMIT $offset, $rowsperpage"; // EDIT HERE and specify your table and field names for the SQL query
    $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR);
    $numresults=mysql_query($query) or die(mysql_error());
    $numrows=mysql_num_rows($numresults);
    
    // If we have no results, offer a google search as an alternative
    
    if ($numrows == 0)
      {
      echo "<h4>Results</h4>";
      echo "<p>Sorry, your search: "" . $trimmed . "" returned zero results</p>";
    
    // google
    echo "<p><a href=\"http://www.google.com/search?q=" 
      . $trimmed . "\" target=\"_blank\" title=\"Look up 
      " . $trimmed . " on Google\">Click here</a> to try the 
      search on google</p>";
      }
    
    // next determine if s has been passed to script, if not use 0
      if (empty($s)) {
      $s=0;
      }
    
    // get results
      $query .= " limit $s,$limit";
      $result = mysql_query($query)  or die(mysql_error()) ;
    
    // display what the person searched for
    echo "<p>You searched for: "" . $var . ""</p>";
    
    // begin to show results set
    echo "<p>Results</p>";
    $count = 1 + $s ;
    
      while ($row= mysql_fetch_array($result)) {
      $title = $row["username"];
      $id=$row["id"];
    ?><table width="100%" height="15%" cellpadding="2" id="box-table-a" summary="Employee Pay Sheet">
    <thead>
    <tr>
    <td>
    <p><?php echo $count ?>.)  <a href="member.php?members=view&id=<?php echo $id ?>"><?php echo $title ?></a></p>
    </td>
    </tr>
    </thead>
    </table>
    <?php
      $count++ ;
      }
    
    $currPage = (($s/$limit) + 1);
    
    //break before paging
      echo "<br />";
    
      // next we need to do the links to other results
      if ($s>=1) { // bypass PREV link if s is 0
      $prevs=($s-$limit);
      print " <a href=\"$PHP_SELF?s=$prevs&q=$var\"><< 
      Prev 10</a>&nbsp ";
      }
    
    // calculate number of pages needing links
      $pages=intval($numrows/$limit);
    
    // $pages now contains int of pages needed unless there is a remainder from division
    
      if ($numrows%$limit) {
      // has remainder so add one page
      $pages++;
      }
    
    // check to see if last page
      if (!((($s+$limit)/$limit)==$pages) && $pages!=1) {
    
      // not last page so give NEXT link
      $news=$s+$limit;
    
      echo " <a href=\"$PHP_SELF?s=$news&q=$var\">Next 10 >></a>";
      }
    
    $a = $s + ($limit) ;
      if ($a > $numrows) { $a = $numrows ; }
      $b = $s + 1 ;
      echo "<p>Showing results $b to $a of $numrows</p>";
    
    /******  build the pagination links ******/
    // range of num links to show
    $range = 3;
    
    // if not on page 1, don't 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 
    
    // loop to show links to range of pages around current page
    for ($x = ($currentpage - $range); $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 " [<b>$x</b>] ";
          // 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 ******/
    ?>

     

    Error:

    Line = $query = "SELECT * FROM main WHERE username LIKE '%$trimmed%' ORDER BY username LIMIT $offset, $rowsperpage"; 
    ===  You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'limit 0,10' at line 1

  15. <?php
    // database connection info
    $conn = mysql_connect('localhost','root','') or trigger_error("SQL", E_USER_ERROR);
    $db = mysql_select_db('school',$conn) or trigger_error("SQL", E_USER_ERROR);
    
    // find out how many rows are in the table 
    $sql = "SELECT COUNT(*) FROM main";
    $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 = 2;
    // 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 
    
      // Get the search variable from URL
    
      $var = @$_GET['q'] ;
      $trimmed = trim($var); //trim whitespace from the stored variable
    
    // rows to return
    $limit=10; 
    
    // check for an empty string and display a message.
    if ($trimmed == "")
      {
      echo "<p>Please enter a search...</p>";
      exit;
      }
    
    // check for a search parameter
    if (!isset($var))
      {
      echo "<p>We dont seem to have a search parameter!</p>";
      exit;
      }
    
    // Build SQL Query  
    $query = "SELECT * FROM main WHERE username LIKE '%$trimmed%' ORDER BY username"; // EDIT HERE and specify your table and field names for the SQL query
    $numresults=mysql_query($query) or die(mysql_error());
    $numrows=mysql_num_rows($numresults);
    
    // If we have no results, offer a google search as an alternative
    
    if ($numrows == 0)
      {
      echo "<h4>Results</h4>";
      echo "<p>Sorry, your search: "" . $trimmed . "" returned zero results</p>";
    
    // google
    echo "<p><a href=\"http://www.google.com/search?q=" 
      . $trimmed . "\" target=\"_blank\" title=\"Look up 
      " . $trimmed . " on Google\">Click here</a> to try the 
      search on google</p>";
      }
    
    // next determine if s has been passed to script, if not use 0
      if (empty($s)) {
      $s=0;
      }
    
    // get results
      $query .= " limit $s,$limit";
      $result = mysql_query($query)  or die(mysql_error()) ;
    
    // display what the person searched for
    echo "<p>You searched for: "" . $var . ""</p>";
    
    // begin to show results set
    echo "<p>Results</p>";
    $count = 1 + $s ;
    
      while ($row= mysql_fetch_array($result)) {
      $title = $row["username"];
      $id=$row["id"];
    ?><table width="100%" height="15%" cellpadding="2" id="box-table-a" summary="Employee Pay Sheet">
    <thead>
    <tr>
    <td>
    <p><?php echo $count ?>.)  <a href="member.php?members=view&id=<?php echo $id ?>"><?php echo $title ?></a></p>
    </td>
    </tr>
    </thead>
    </table>
    <?php
      $count++ ;
      }
    
    $currPage = (($s/$limit) + 1);
    
    //break before paging
      echo "<br />";
    
      // next we need to do the links to other results
      if ($s>=1) { // bypass PREV link if s is 0
      $prevs=($s-$limit);
      print " <a href=\"$PHP_SELF?s=$prevs&q=$var\"><< 
      Prev 10</a>&nbsp ";
      }
    
    // calculate number of pages needing links
      $pages=intval($numrows/$limit);
    
    // $pages now contains int of pages needed unless there is a remainder from division
    
      if ($numrows%$limit) {
      // has remainder so add one page
      $pages++;
      }
    
    // check to see if last page
      if (!((($s+$limit)/$limit)==$pages) && $pages!=1) {
    
      // not last page so give NEXT link
      $news=$s+$limit;
    
      echo " <a href=\"$PHP_SELF?s=$news&q=$var\">Next 10 >></a>";
      }
    
    $a = $s + ($limit) ;
      if ($a > $numrows) { $a = $numrows ; }
      $b = $s + 1 ;
      echo "<p>Showing results $b to $a of $numrows</p>";
    
    /******  build the pagination links ******/
    // range of num links to show
    $range = 3;
    
    // if not on page 1, don't 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 
    
    // loop to show links to range of pages around current page
    for ($x = ($currentpage - $range); $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 " [<b>$x</b>] ";
          // 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 ******/
    ?>

     

    No idea Whats Wrong with it. But need Help! Thanks. im doing Pagniation with a search.

×
×
  • 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.