Jump to content

Nexy

Members
  • Posts

    119
  • Joined

  • Last visited

Everything posted by Nexy

  1. Thank you very much! Learned some new keywords
  2. Hello! I need help making a query for this statement: Drinkers who frequent exactly one of the bars which Joe frequents The table looks like this: --------------------------------------------- | drinker | bar | --------------------------------------------- | Mike |A.P. Stump's | | Bob |Blue Angel | | Erik |Blue Angel | | Herb |Blue Angel | | Jesse |Blue Angel | | Joe |Blue Angel | | John |Blue Angel | | Justin |Blue Angel | | Mike |Blue Angel | | Rebecca |Blue Angel | | Tom |Blue Angel | | Vince |Blue Angel | | John |Cabana | | Mike |Cabana | | Vince |Cabana | | Joe |Caravan | | John |Caravan | | Tom |Caravan | | Bob |Coconut Willie's Cocktail Lounge | | Joe |Coconut Willie's Cocktail Lounge | | Rebecca |Coconut Willie's Cocktail Lounge | | Justin |Gecko Grill | | Rebecca |Gecko Grill | | Herb |Seven Bamboo | | Vince |Seven Bamboo | | Mike |The Shark and Rose | --------------------------------------------- I can't seem to understand the logic that is needed to build the query. I started with this: SELECT DISTINCT * FROM frequents F1 WHERE NOT EXISTS (SELECT * FROM frequents F2 WHERE F1.drinker = 'Joe' AND /* Something here */); The way I'm reading is that my NOT EXISTS sub query should have Drinkers who like SOME of the bars which Joe frequents then somehow turn that into only one. How should I proceed? Any help would be appreciated! Thanks in advance!
  3. Thank You, I'll play with it and see what happens.
  4. Thanks for the reply, all that did was move it down with < p >, it's still not on the bottom. You said, you couldn't login to the forums. It's actually a PM layout. You can login with Iori/testtest. You will notice you have 1 "PM(1)". http://divnx.net Here's what I did to the code: <table class='margin'> <tr> <td style='vertical-align: top'> <div class='pm_msgbody'> <p>Test</p> Avatar <p>Gold | Rep</p> </div> </td> <td style='vertical-align: top'> <div class='pm_msgtext'> <div style='border-bottom: 1px solid #000; margin: 0'> PM Topic --- Date </div> <div style='text-align: left; padding-bottom: .4em'>Message</div> <div class='pm_msgans'> <p class='left'>Quote PM | Ping Shoutbox</p> <p class='right'>Delete | Reply</p> </div> </div> </td> </tr> </table> Unless I misunderstood your explantion, it didn't seem to work. Also, if I was unclear before, I always want this to appear on the bottom and only move more down if the message is long enough. Thank You!
  5. Why Hello There! I've tried countless way to do this: From the red rectangle on top, I want it so its always on the bottom rectangle. Of course there is no way of knowing how big the message above will be. So as the message grows the red rectangle goes more down as well. Here's the code: <table class='margin'> <tr> <td style='vertical-align: top'> <div class='pm_msgbody'> <p>Test</p> Avatar <p>Gold | Rep</p> </div> </td> <td style='vertical-align: top'> <div class='pm_msgtext'> <div style='border-bottom: 1px solid #000; margin: 0'> PM Topic --- Date </div> <div style='text-align: left; margin-bottom: .4em'>Message</div> <div class='pm_msgans'> Quote PM | Ping Shoutbox <div class='pm_msgrep'> Delete | Reply </div> </div> </div> </td> </tr> </table> And the CSS: .margin { margin-left: auto; margin-right: auto; } .pm_msgbody { width: 180px; color: #ADD8E6; font-size: .9em; } .pm_msgtext { width: 500px; color: #ADD8E6; font-size: .9em; padding: .2em; } .pm_msgans { text-align: left; border-top: 1px solid #000; } .pm_msgrep { display: inline; margin-left: 19.8em; } The part I want moved down is: <div class='pm_msgans'> Quote PM | Ping Shoutbox <div class='pm_msgrep'> Delete | Reply </div> Any help would be appreciated. Thank You!
  6. Thank You!
  7. Why Hello There! I have this code: <?php $sql = "SELECT count(*) FROM pm_inbox WHERE status = 'Unread' AND user = '".$_SESSION['user']."'"; $res = mysql_query($sql) OR die(mysql_error()); $db = mysql_fetch_array($res); echo $db[0][0]; ?> The problem starts after 9 entries. If there are 10 entries, it echoes the number 1, if there is 20, it echoes 2, and so on. Just wondering how do I fix this, so it shows numbers after 9? Any help would be appreciated. Thank You!
  8. Thank You, both of you!! Both methods worked perfectly. :) :)
  9. Why Hello There! How would I be able to something like this: if($text contains a specific word == "word1" && $text contains another specific word == "word2") { do something; } Basically, if word1 and word2 are in the variable $text in respective order, then do something. Also, $text can contain any other words in there too. So if there was something like this: $text = "Hello word1 there! Welcome to word2 today!"; Then the if statement would see those 2 words are in there in order. But if it's something like this: $text = "Hello word2 there! Welcome to word1 today!"; Then do nothing, since "word1" is not first. I hope that made sense. Any help would be appreciated. Thank You!
  10. Nvm, I figured it out.
  11. Yes, I do. But it didn't work the way I did it. I replaced $pm_set = "1"; with $_SESSION['pm_set'] = "1"; and the other with "2". And it didn't display anything under the echo.
  12. Why Hello There! Just wondering how I would save a variable even after you change pages. I have this: <?php if($_POST['pmsend'] && $_GET['do'] == "mod") { $sql = "SELECT username FROM users WHERE username = '$pmuser'"; $res = mysql_query($sql) OR die(mysql_error()); if(!empty($pmuser) && !empty($subject) && !empty($message) && mysql_num_rows($res) == 1) { $pm_set = "1"; if($_SESSION['user']) { mysql_query("INSERT INTO pm_inbox(user, sender, subject, date, message, status) VALUES('$pmuser', '".$_SESSION['user']."', '$subject', '".date('m-j-Y')."', '$message', 'Unread')"); mysql_query("INSERT INTO pm_draft(user, sender, subject, date, message, status) VALUES('$pmuser', '".$_SESSION['user']."', '$subject', '".date('m-j-Y')."', '$message', 'Unread')"); } else if($_COOKIE['user']) { mysql_query("INSERT INTO pm_inbox(user, sender, subject, date, message, status) VALUES('$pmuser', '".$_COOKIE['user']."', '$subject', '".date('m-j-Y')."', '$message', 'Unread')"); mysql_query("INSERT INTO pm_draft(user, sender, subject, date, message, status) VALUES('$pmuser', '".$_COOKIE['user']."', '$subject', '".date('m-j-Y')."', '$message', 'Unread')"); } } else if(empty($pmuser) || empty($subject) || empty($message) || mysql_num_rows($res) == 0) { $pm_set = "2"; } } if($pm_set == "1") { echo "<div class='create' style='width: 495px; padding: .2em; color: #00FF7F'> <img src='images/update.ico' alt='' /> Your Message to " . $_SESSION['suser'] . ' has been sent! </div>'; } else if($pm_set == "2") { echo "<div class='create' style='width: 495px; padding: .2em; color: #CD5C5C'> <img src='images/remove.ico' alt='' /> Your message has encountered a problem! </div>"; } ?> When you click submit on the form, it takes you to index.php?page=PM&pg=send&do=mod. After that it takes you back to index.php?page=PM&pg=send. But, once you change pages, I'm guessing the variable $pm_set doesn't have those values any more. Since it doesn't have those variables, it doesn't echo the what is set under them. I tried using a session, but it still didn't display. My question is; is there any way I can save that variable's value once it changes pages and comes back and it shows the message? I did this, to stop the user from pressing refresh and inserting the same thing more than once. I had <form action='index.php?page=PM&pg=send'>, but your still able to press refresh and insert multiple entries of the same thing. I can't use PHP_SELF because this is an included inside of index.php, so it would take me back to the main page. Any help would be appreciated. Thank You!
  13. NVM, I figured it out. Instead of innerHTML it had to be value.
  14. Oh wow, another stupid mistake D:! Thank You!
  15. I ran into another problem. :'( <?php if($_SESSION['user']) { $sql = "INSERT INTO pm_inbox(user, sender, subject, date, message, status) VALUES('$pmuser', '".$_SESSION['user']."', '$subject', '".date('m-j-Y')."', '$message', 'Unread')"; $res = mysql_query($sql) OR die(mysql_error()); $sqld = "INSERT INTO pm_draft(user, sender, subject, date, message) VALUES('$pmuser', '".$_SESSION['user']."', '$subject', '".date('m-j-Y')."', '$message', 'Unread')"; $resd = mysql_query($sqld) OR die(mysql_error()); } ?> The 2nd sql statement doesn't work. It inserts fine in the first one to pm_inbox, but it doesn't go into pm_draft. Any ideas? Thank You!
  16. Oh, Thank You very much!
  17. Why Hello There! I seem to get an SQL syntax error with this code: <?php $pmuser = mysql_real_escape_string(addslashes(htmlentities($_POST['pmuser']))); $subject = mysql_real_escape_string(addslashes(htmlentities($_POST['pmsub']))); $message = mysql_real_escape_string(addslashes(nl2br(htmlentities($_POST['pmmsg'])))); if($_SESSION['user']) { $sql = "INSERT INTO pm_inbox(user, from, subject, date, message, status) VALUES('$pmuser', '".$_SESSION['user']."', '$subject', '".date('m-j-Y')."', '$message', 'Unread')"; $res = mysql_query($sql) OR die(mysql_error()); } ?> 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 'from, subject, date, message, status) VALUES('Nexy', 'Nexy', 'O.O' at line 1 One thing I noticed is the error doesn't mention 'user' before 'from' and the values after subject don't come up. Any help would be appreciated! Thank You!
  18. Sorry, I really had no idea what I was doing there. I just found those functions online and thought they were valid already. I looked more into this and I got this to work to some extent: <script type="text/javascript"> function insertText(text) { var elem = document.getElementById('pmmsg'); elem.innerHTML += text; document.getElementById('pmmsg').focus(); } </script> <?php echo "<img src=\"board/images/smiles/happy.gif\" alt=\"\" onclick=\"insertText(' ')\" /> <textarea id='pmmsg' name='pmmsg' rows='12' cols='45' tabindex='8'></textarea>"; ?> The only problem now is if you click the textarea or an input button, the smiles stop working. If you never click the textarea or the input buttons, then those smiles work just fine. I'm using Firefox if that makes any difference. Any ideas? Thank You Again!
  19. Why Hello There! I seem to be having a problem with this little code: <script type="text/javascript"> function insertSmiley(smiley) { var area = document.getElementById("pmmsg"); area.setValue(area.getValue() + smiley); document.getElementById("pmmsg").focus(); } </script> <?php echo "<img src='board/images/smiles/happy.gif' alt='' onclick='insertSmiley(\"\")' /> <textarea id='pmmsg' name='pmmsg' rows='12' cols='45' tabindex='8'></textarea>"; ?> I have the last part in php because this is only part of the code. The problem is when I click the image, nothing happens. It doesn't add ": )" into the textarea. Any help would be appreciated. Thank You!
  20. You were right, I took it out and it the 1st row appeared. Thank You!
  21. I have that there because I also have in the code: if($_GET['pg'] == "read") Right after if($_GET['pg'] == "inbox") ends. So I thought it would be some ease of access instead of making a new query for the pg == read part. I'll take it out and see what happens.
  22. I put that before the while statement and I got this: Array ( => PM [pg] => inbox ) when I put it inside the while statement, it doesn't show anything.
  23. Why Hello There! I don't understand why the following won't echo anything: <?php if($_GET['page'] == "PM") { if($_SESSION['user']) { $sql = "SELECT * FROM pm_inbox WHERE user = '".$_SESSION['user']."' ORDER BY id DESC"; } else if($_COOKIE['user']) { $sql = "SELECT * FROM pm_inbox WHERE user = '".$_COOKIE['user']."' ORDER BY id DESC"; } $res = mysql_query($sql) OR die(mysql_error()); $db = mysql_fetch_array($res); if($_GET['pg'] == "inbox") { while($db = mysql_fetch_array($res)) { echo "<div class='pm_inbox'> <table> <tr> <td> </td> <td>From:</td> <td>Subject:</td> <td>Date:</td> <td>Status</td> </tr> <tr> <td><input type='checkbox' id='$del' name='delete[]' value='$del' style='border: 0' /></td> <td><a href='index.php?page=Profile&user=".$db['from']."'>" . $db['from'] . '</a></td>'; echo "<td><a href='index.php?page=PM&pg=read&do=".$db['id']."'>" . $db['subject'] . '</a></td> <td>' . $db['date'] . '</td> <td>' . $db['status'] . '</td> </tr> </table> </div>'; } } } ?> I get no errors, it just doesn't display anything on the page. There is 1 entry into pm_inbox, so it should spit out something at least. Any help would be appreciated. Thank You!
  24. Well, with your way, could a hacker manipulate the variables? As in change them? If I had: $member = sha1(392); $admin = sha1(333); if($_SESSION['id'] == $member) Could a hacker be able to change the variables? If so, any way to protect from that? Thank You!
  25. None of those 2 ways worked Maybe Jabop is right D:!!
×
×
  • 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.