Jump to content

Philip

Staff Alumni
  • Posts

    4,665
  • Joined

  • Last visited

  • Days Won

    20

Everything posted by Philip

  1. <?php $query = "SELECT * FROM `comments` WHERE `userid`='".$userid."' && `read`='0'"; // Make sure to change fields/variables to match up with yours $select = mysql_query($query, $connection) or die(mysql_error()); $num_messages = mysql_num_rows($select); if($num_messages > 0) { echo "You have ".$num_messages." new messages!"; } else { echo "No new messages!"; } ?> Try that. Make sure you have something in the database with read=0
  2. What errors come back?
  3. whoops, meant a 0 at read. <?php $query = "SELECT * FROM `comments` WHERE `userid`='".$userid."' && `read`='0'"; $select = mysql_query($query, $connection) or die(mysql_error()); $num_messages = mysql_num_rows($select); if($num_messages > 0) { echo "You have ".$num_messages." new messages!"; } ?> Like that? If you want something live you need to go with AJAX, where if they get a message it will let them know without the user having to refresh the page
  4. <select name="example[]" multiple="multiple"> options.... <?php if ($_post['example']){ foreach ($_post['example'] as $data){echo $data."<br />";} } ?>
  5. $query = "SELECT * FROM `comments` WHERE `userid`='".$userid."' && `read`='1'"
  6. http://primetech.free-web-hosting.biz/index.php You might want a max-length & clean the inputs
  7. What does running just request.php say? Does it echo anything out (try putting something in the DB, then checking it)
  8. Are you getting the variable from the URL to view the page where you have the option to delete? (viewitem.php?ID=1 -> it must be ID because of [var ID = gup(ID);])
  9. Wait, I know micah1701's query would work, but are you asking to have it start on the 4th largest and go down, or end on the 4th largest?
  10. I don't know if it's going to change much, but instead of having localhost, go ahead and put the pull file address http://www.freewebmasterhelp.com/tutorials/htaccess/3 says: AuthName "Enter Password" AuthType Basic AuthUserFile /full/path/to/.htpasswd (possibly C:\wamp\www\InputMaintainance\.htpassword ) require user mecsoft "The /full/parth/to/.htpasswd should be changed to reflect the full server path to the .htpasswd file (more on this later). " Also, in the .htpassword file, make sure the passwords are encrypted, and that there is not a blank line above the first one.
  11. Your forjs function, you should be able to get rid of it. After I changed the way that PHP sent back the request, it was unneeded. And as for the string you said would break it, it comes out like this: Try it yourself: <?php if($_POST) { $array = $_POST['data']; echo addslashes($array); // Please note, if you get 3 slashes, your server // automatically adds slashes for you } else { echo "<form action='".$_SERVER['PHP_SELF']."' method='post'>"; echo "<input type='text' name='data'> <- Put data in<br />"; echo "<input type='submit' name='submit'>"; echo "</form>"; } ?>
  12. You're not even getting the value from the text field, the code above simply makes a request. Why not take a look at this script/tutorial, it's going to lead you in the right direction: http://www.captain.at/howto-ajax-form-post-request.php
  13. Yeah, if you have it to where it is like it is just matching with certain cases, you should be okay, but it is always best to be on the safe side. Glad to help, don't forget to mark it solved if you think everything is running the way you want it to
  14. change echo "".$r['name']." on $r['date']<br>"; to echo $r['name']." on ".$r['date']."<br>";
  15. That's fine. It's upwards of kilobytes of text, like 50KB+ Have you ever cleaned variables for the post before? If not, it's something you're going to want to get into the habit of. http://phpsec.org/projects/guide/1.html That a good basic start & explanation on why you'll need it.
  16. Okay, now that is really frustrating, haha. I did that same code last night, and it wasn't working. I tried every way to make it work with get by ID, and it just wouldn't work. So I went old school and did it the long way, haha. Now it works
  17. I'm don't use PHP's mail function often, but you might want to try this instead: <?php $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers = "From:breeder@gentledoberman.com\r\n"; $headers .= "Reply-To:" . $email . "\r\n"; ?> It's worth a shot, since nobody else has replied
  18. Yeah, it probably be a lot easier to code. I'm no expert though, somebody else might know a really easy way to do it. I just don't have that knowledge
  19. <?php echo "<a href='abc.php?col=name&type=asc'>name</a>"; //use an if statement to change the type to desc and back $query = "SELECT * FROM `table` ORDER BY ".$_GET['col']. " ".$_GET['type']; //Echo results however ?> Make sure to clean the variables when you use GET, as people can change it.
  20. Okay, this is a bit more complicated than I was hoping for. One way that I can think of doing this, its on the pages have the link with the ref code on the end, so the link would be like (dynamically with PHP) www.123domain.com/company.php?ref=12345 (in php terms: echo "www.123domain.com/company.php?ref=".$GET['ref'] That would make things a lot easier, would that be possible?
  21. Try this instead of: <html> <head> <script type="text/javascript"> function addLink (fieldx) { var sampleLink = "Some sample link."; document.forms["form1"].elements[fieldx].value = sampleLink; } </script> </head> <body> <form id="form1" name="form1" method="post" action=""> <p><textarea name="textBox1" cols="45" rows="6"></textarea></p> <p><input name="link1" type="button" id="link1" value="add link" onclick="addLink('textBox1')" /></p> <p><textarea name="textBox2" cols="45" rows="6"></textarea></p> <p><input name="link2" type="button" id="link2" value="add link" onclick="addLink('textBox2')" /></p> </form> </body> </html>
  22. Wow, well, it depends on what the URLs are for. If they are all for the same rewrite, where you are redirecting the user to the same page, then you could just use this code: Options +FollowSymlinks RewriteEngine on RewriteRule ^?ref=([0-9]+)$ 456.php?refID=$1 [R] Could you explaina little more indepth, or give a few examples of what you already have?
  23. You can copy the REF data from the current URL and then add it into the URL It's shown in my above post RewriteRule ^?ref=([0-9]+)$ 456.php?refID=$1 [R] Basically it says: Rewrite the URL that has ?ref=(any numerical value, lets call it X) and throw the user to 456.php?refID=X
  24. You named the 3 things echo does: prints strings, variables and a combo of both. Was there something else you were wanting it to do?
  25. Sorry, wasn't trying to be mean, just wanted to point it out. Technically, you should have that period there at all times, between 2 variables, or a variable and text. I'm kinda surprised it worked for you, lol, it's always given me errors.
×
×
  • 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.