Maq
Administrators-
Posts
9,363 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Maq
-
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.
-
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.
-
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"; ?>
-
OK, is it always going to be the comment is every other element?
-
Change this line to: if ($res == 1) {
-
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); } } }
-
You would need to use fopen and fwrite.
-
Are the array elements always going to be in the same order/position?
-
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
-
If you need more information or clarification about the header errors have a read here: HEADER ERRORS
-
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.
-
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.
-
Well, when you find it, let us know Until then we can't really help you...
-
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
-
Open up the PHP file in a text editor, like notepad++ or some kind of IDE (netbeans, eclipse etc..)
-
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.
-
Besides, like xtopolis mentioned, that looks like source code already rendered by the browser...
-
Can I see your form?
-
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:
-
Omg, shitty dreamweaver code overload..@#R!#
-
Yeah, the link I provided has many many examples. A more specific link: mail().
-
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.
-
Use the mail function, make it HTML format, and put HTML in it. There are other posts on these forums that exemplify your question.