Jump to content

Maq

Administrators
  • Posts

    9,363
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Maq

  1. This line (called a "ternary operator"): echo (test_url_file($url)) == 1 ? "Connected" : "Not Connected"; Translates to: if(test_url_file($url) == 1) { echo "Connected"; } else { echo "Not Connected"; } As you can see it saves a lot of room when writing code, but in your case if you want to write and execute more code you have to use if/else statements.
  2. So if every other element in the array is going to be a comment then you just grab every other element. Or, in your case, it looks like all the ODD indexed elements. You can probably achieve this by using the modulus operator.
  3. You're supposed to get the value that's returned from the function. Try this. function test_url_file($url) { $res = (($ftest = @fopen($url, 'r')) === false) ? false : @fclose($ftest); return ($res == TRUE) ? 1:0; } $url = "http://www.google.com"; echo (test_url_file($url)) == 1 ? "Connected" : "Not Connected"; ?>
  4. OK, is it always going to be the comment is every other element?
  5. Change this line to: if ($res == 1) {
  6. Sounds to me like you need to check if the values are empty. Try something like: if (count($_POST['artist']) > 0) { foreach ($_POST['artist'] as $key => $val) { if(!empty($val) || !empty($key)) { $song = $_POST['song'][$key]; $artist = $val; $q = "insert into comp_items (compitem_artist, compitem_song, CompID ) values ('$artist', '$song', '$lastID')"; mysql_query($q); } } }
  7. You would need to use fopen and fwrite.
  8. Are the array elements always going to be in the same order/position?
  9. I've seen posts in these forums about this but here's a tutorial I found in 2 seconds with Google that looks promising: Check If URL Exists
  10. If you need more information or clarification about the header errors have a read here: HEADER ERRORS
  11. The only way to interact client side with server side stuff is through something like AJAX. PHP is already interpreted and displayed as HTML when the user sees the page.
  12. Yeah, sorry, change this line to: (wasn't using the correct resource id) $row = mysql_fetch_array($LoginRS); // ADDED That should fix: And as for this error: Make sure you're not outputting anything or have whitespace before the header() calls, it will throw this error.
  13. Well, when you find it, let us know Until then we can't really help you...
  14. I see what's wrong. The information is never actually extracted the information from the table. Change this block of code, I commented what I changed/added: $LoginRS = mysql_query($LoginRS__query, $Login) or die(mysql_error()); $row = mysql_fetch_array($result); // ADDED $loginFoundUser = mysql_num_rows($LoginRS); if ($loginFoundUser) { $loginStrGroup = ""; //declare two session variables and assign them $_SESSION['MM_Username'] = $loginUsername; $_SESSION['MM_UserGroup'] = $loginStrGroup; $_SESSION['MM_name'] = $row['name']; // CHANGED
  15. Why not?
  16. Open up the PHP file in a text editor, like notepad++ or some kind of IDE (netbeans, eclipse etc..)
  17. That's going to require you to read some tutorials. Do you have a DB setup? Do you know how to create tables and fields? Do you know what you want your structure to look like? And I assume you don't know how to INSERT and SELECT data from a DB...? I suggest reading this: PHP & MySQL. Good luck, come back if you have any specific questions, we'll be happy to help.
  18. Besides, like xtopolis mentioned, that looks like source code already rendered by the browser...
  19. Can I see your form?
  20. I can tell! Change this line: </pre> <form action="output.php" method="get">< to: </pre> <form action="output.php" method="POST">< And, in output.php, change this portion of code: to this:
  21. Yes, by all means, please do. All the cool kids are doing it...
  22. Omg, shitty dreamweaver code overload..@#R!#
  23. Yeah, the link I provided has many many examples. A more specific link: mail().
  24. The standard way to transfer this data to the next page is with POST. So change this line: </pre> <form action="output.php" method="POST">< And on "output.php" change this to: You're going to have to store these URL's in the database somewhere to remember what the user put in. Make some sort of login system. P.S. - Looks like you were missing the opening tag there as well.
  25. Use the mail function, make it HTML format, and put HTML in it. There are other posts on these forums that exemplify your question.
×
×
  • 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.