Jump to content

squiblo

Members
  • Posts

    483
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by squiblo

  1. just a general question guys a girls, is the rand() function 100% random or is it based on time?
  2. problem is described in the code... <?php $query = mysql_query("SELECT * FROM mail WHERE pageid='$pageid' ORDER BY read, when"); //from changing this line $checkbox = 1; while ($row = mysql_fetch_assoc($query)){ // i get an error on this line saying "supplied argument is not a valid MySQL result" $subject = $row['subject']; $message = $row['message']; $from = $row['from']; $when = $row['when']; $read = $row['read']; $date = date("d/m/Y", strtotime(" $when +0 year ")); //unread = n if ($read == "n") { //unread $readicon = "<img src='./Images/pageimages/unread_icon.png' alt='not read'>"; $startbold = "<b>"; $endbolt = "</b>"; } else //read $readicon = "<img src='./Images/pageimages/opened_icon.png' alt='read'>"; ?>
  3. - the date field in the table is called "when". - the value that shows if something has been read is "n" for if it is unread and "y" for if it is read and these values are stored in a field called "read".
  4. this code works well but does not order how i want, i would like the unread to be displayed first and by date order, then the unread displayed by date order, how can i do this? <?php $query = mysql_query("SELECT * FROM mail WHERE pageid='$pageid'"); $checkbox = 1; while ($row = mysql_fetch_assoc($query)){ $subject = $row['subject']; $message = $row['message']; $from = $row['from']; $when = $row['when']; $read = $row['read']; $date = date("d/m/Y", strtotime(" $when +0 year ")); //this is the only way i know of changing date format if ($read == "n") { $readicon = "<img src='./Images/pageimages/unread_icon.png' alt='not read'>"; $startbold = "<b>"; $endbolt = "</b>"; } else $readicon = "<img src='./Images/pageimages/opened_icon.png' alt='read'>"; echo "<tr><td width='40%'><hr width='100%' height='1px' color='#E6E6E6'> <input type='checkbox' name='checkbox$checkbox'>$startbold $readicon - $subject $endbold </td></tr>"; $checkbox++; } echo "<tr><td><hr width='100%' height='1px' color='#E6E6E6'>"; ?>
  5. i want to echo the result number by the side of each result but i do not no how to do this, $checkbox is the variable i want to hold the number... <?php $query = mysql_query("SELECT * FROM mail WHERE pageid='$pageid'"); while ($row = mysql_fetch_assoc($query)){ $subject = $row['subject']; $message = $row['message']; $from = $row['from']; $when = $row['when']; $checkbox = 1++; echo "<tr><td>$checkbox - $subject - $message</td></tr>"; } ?>
  6. sorry, ive just figured it out, im tired. <?php if ($img1) echo "<td width='33.3%' align='center'> <FORM action='' method='GET'><input type='hidden' name='pageid' value='$pageid'> <INPUT type='submit' name='images' value='Images' onClick=\"window.open('http://www.squiblo.com/images.php?pageid=$pageid','mywindow','width=600,height=400,left=0px,top=0px,status=no,location=no,resizable=no,scrollbars=no')\"> </FORM> </td>"; ?>
  7. my aim is to open a new window and put some information in the new windows url by using "method='GET'" but when i click the submit button i do not want the original page to redirect to any other page, how can this be done? i have tried doing these different things but none work... this problem with this code is that the original page redirects and the new window does not have the information (pageid) in the url.... <?php if ($img1) echo "<td width='33.3%' align='center'> <FORM action='images.php' method='GET'><input type='hidden' name='pageid' value='$pageid'> <INPUT type='submit' name='images' value='Images' onClick=\"window.open('http://www.squiblo.com/images.php','mywindow','width=600,height=400,left=0px,top=0px,status=no,location=no,resizable=no,scrollbars=no')\"> </FORM> </td>"; ?> when i click submit with this code (with the action as current page) the original page stay the same but the new windows url does not hold the pageid <?php if ($img1) echo "<td width='33.3%' align='center'> <FORM action='' method='GET'><input type='hidden' name='pageid' value='$pageid'> <INPUT type='submit' name='images' value='Images' onClick=\"window.open('http://www.squiblo.com/images.php','mywindow','width=600,height=400,left=0px,top=0px,status=no,location=no,resizable=no,scrollbars=no')\"> </FORM> </td>"; ?>
  8. thank you!
  9. im trying to echo this... <?php if ($img1) echo "<td width='33.3%' align='center'> <FORM> <INPUT type='button' value='New Window!' onClick="window.open('http://www.pageresource.com/jscript/jex5.htm','mywindow','width=400,height=200')"> </FORM> </td>"; ?> but the quotation marks are giving an error, but if i change the quotation marks to apostrophes then the link does not work, how is this suppose to be wrote out?
  10. on the if statement or the echo?
  11. <?php //connect to db mysql_connect("","","") or die ("Couldn't connect"); mysql_select_db("squiblo_com") or die ("Couldn't find db"); $query = mysql_query("SELECT * FROM members WHERE pageid='$pageid'"); $row = mysql_fetch_assoc($query); //get current hits $hits = $row['counter']; //get ip file $ipfile = file("ips.txt"); $linecount = count($ipfile); //set defaul increment to true $increment = true; //this is the persons ip address $ip = $_SERVER['REMOTE_ADDR']. $pageid; //start loop for($x=0;$x<=$linecount;$x++) { //does ip match an ip in ips.txt if(intval($ipfile[$x].$pageid) == $ip) $increment = false; echo ($ipfile[$x].$pageid) . " == " . $ip . "<br />"; } //if it matches if ($increment == true) { $newhit = $hits + 1; mysql_query("UPDATE members SET counter='$newhit' WHERE pageid='$pageid'"); $filenewip = fopen("ips.txt",'a'); fwrite($filenewip,$ip."\n"); } echo $ipfile[0]; ?>
  12. without intval this is returned...
  13. "$ipfile[0]" is echoing the first line on the .txt file, this is what the file looks like... this is what i echoed... (in the loop)... echo intval($ipfile[$x]. $pageid) . " == " . $ip . "<br />"; (out of the loop) echo $ipfile[0]; and this is what returned...
  14. this was returned, the "1" before "==" is the appended pageid
  15. with my hit counter, every time i refresh the page the hits go up by one everytime, but it should only go up by one the first time the page is viewed because the ip address is stored in a .txt file, and if the ip address is already stored then the hit should stay the same, also everytime i refresh the ip is stored again when it should only be stored once, i don't understand where i am going wrong <?php //connect to db mysql_connect("localhost","","") or die ("Couldn't connect"); mysql_select_db("") or die ("Couldn't find db"); $query = mysql_query("SELECT * FROM members WHERE pageid='$pageid'"); $row = mysql_fetch_assoc($query); //get current hits $hits = $row['counter']; //get ip file $ipfile = file("ips.txt"); $linecount = count($ipfile); //set defaul increment to true $increment = true; //this is the persons ip address $ip = $_SERVER['REMOTE_ADDR']. $pageid; //start loop for($x=0;$x<=$linecount;$x++) { //does ip match an ip in ips.txt if(intval($ipfile[$x]. $pageid) == $ip) $increment = false; } //if it matches if ($increment == true) { $newhit = $hits + 1; mysql_query("UPDATE members SET counter='$newhit' WHERE pageid='$pageid'"); $filenewip = fopen("ips.txt",'a'); fwrite($filenewip,$ip."\n"); } echo $newhit; ?>
  16. squiblo

    window sizes

    im not sure if i can phrase this question correctly but ill give it ago. when i resize my window making it smaller, elements on my page move to try and stay in view, but i would like them to stay still how can this be done? i am using table tags to place everything neatly, if you dont understand ill try my best to explain more, please help
  17. squiblo

    I HATE IE

    okay, this is my full css... @charset "utf-8"; /* CSS Document */ body { color: black; background-color: #E6E6E6; font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif; margin-top: 30px; margin-bottom: 50px; margin-left: 0%; /*Here is where you change the width.*/ margin-right: 0%; padding:0px; } .title { font-size: 50px; } table.header { background-color:white; border: 1px solid black; } table.mainbody { background-color:white; border: 1px solid black; } table.footer { background-color:white; border: 1px solid black; } table.footersearch { border:1px solid #999999; }
  18. squiblo

    I HATE IE

    the table is supposed to be fixed to the bottom of the screen, and it does in FF but in IE the table is like 20px from the bottom any idea how this can be solved? or anything you think that might be worth while checking the css table.footersearch { border:1px solid #999999; } the html <div style='position:fixed;left:1px;bottom:0px;width:100%;'> <form action='http://www.squiblo.com/results.php' method='GET'> <table width='100%' align='center' border='0' bgcolor='#E6E6E6' class='footersearch'> <tr align='center'> <td align='right' width='43%'>Search:</td> <td align='left' width='47%'><input type='text' name='search'> <input type='submit' name='searchsubmit' value='Search'></td> <td align='center' width='10%'><a href='http://www.squiblo.com' style='text-decoration:none'><font color='orange'><b>Squiblo.com</b></font></a></td> </tr> </table> </form> </div>
  19. hi, i am just wondering, what is the better option... this... or this... <style><?php include("./footylinks_style.css"); ?></style> please give your reasons, thank you
  20. hi, i have a date store in my database like "Y-m-d" (2009-10-16) and i have selected this from the database and stored it in a variable called $startdate ($startdate = $row['registered')... how can i add 1 year onto this date and store the new date in a variable called $enddate? <?php mysql_connect("localhost","","") or die ("Couldn't connect"); mysql_select_db("") or die ("Couldn't find db"); $query = mysql_query("SELECT * FROM members where username='$username'"); $row = mysql_fetch_assoc($query); $startdate = $row['registered']; ?>
  21. if it goes back one directory, shouldn't that then be correct?
  22. sorry the "about.php" file is not in the root folder, it is in " root > footerlinks > about.php "
  23. ok, firstly my directories look like this... " root > includes > php and css files " i have a file in the root folder called "about.php" and a line of the code in this file says... <?php include './includes/footerlinks.php'; ?> but i am getting 3 different error messages popping up when i want to view the page that say... does anybody know why? please help.
  24. if you could post the class im sure i would find it very useful thank you for your help
  25. that is why i need help with it, i understand why the page will not goto 11, on the 1st page i would like the page numbers shown like "1 2 3 4 5 6 7 8 9 10" but the second page to show "2 3 4 5 6 7 8 9 10 11"
×
×
  • 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.