Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. You can use arrays within a string just like you can with normal variables. Example $message = "whate ever here {$array['key1']} something else here {$array['key2']}";
  2. return does not return the variable itselft. It only return the variables value. You'll need to capture the return value with a variable. For example $results = display_results($query); For more information go to http://php.net/manual/en/functions.returning-values.php
  3. Use a character set $text = 'abcd 14-2334-8896 56"#@(55)'; $text = preg_replace('~[^a-z0-9\(\)\- ]~i', '', $text); echo $text; http://regular-expressions.info is a good site for understanding regular expressions.
  4. Use return not echo http://www.php.net/manual/en/functions.returning-values.php
  5. It looks like you have another application installed using port 80. Apache requires this port to be free. If its being used by another application then Apache will not be able to start. Apache can be configured to use a different port tho.
  6. Don't use session_resister when creating your _SESSION variables. Always do $_SESSION['var_name'] = 'some value'; Also when checking if a session variable exists use isset rather than using session_is_registered if(isset($_SESSION['var_name'])) { // do what ever } session_resister and session_is_registered are old functions which should no longer be used. In any page you use session make sure you have session_start at the start of your scripts.
  7. For multicolumn results read this FAQ.
  8. Use explode with a space as the first parameter. Example list($search_forname, $search_surname) = explode(' ', $_POST['search_friend']);
  9. it could be how your links are coded. There is nothing in your vhost config that will cause a \ in your urls.
  10. Your have too many quotes here ... vip_torrent = '" . $vip_torrent . "''WHERE info_hash='" ... it should be ... vip_torrent = '" . $vip_torrent . "' WHERE info_hash='" ...
  11. You'll want to loop through $_POST['game'] array $data = ''; foreach($_POST['game'] as $gameResult) { list($oppenent, $score) = array_values($gameResult); $data .= "$oppenent,$score\n"; } $fp = fopen("game.txt","w"); // $fp is now the file pointer to file $filename if($fp) { fwrite($fp,$data); // Write information to the file echo "File saved successfully"; } else { echo "Error saving file!"; }
  12. If you're using sasa's code above Change foreach($Rockbands1 as $Rockband) { echo '<tr>'; foreach($Rockband as $item) { echo "<td>$item</td>"; } echo '</tr>'; } To foreach($Rockbands1 as $key => $Rockband) { $tag = ($key === 0) ? 'th' : 'td'; echo '<tr>'; foreach($Rockband as $item) { echo "<$tag>$item</$tag>"; } echo '</tr>'; }
  13. In edit_entry.php you dont output anything once the form has been submit. You only display the form if hasn't being submitted. That could be why you get a blank page maybe.
  14. Your query is most likely failing due to an error. Use mysql_error find out why. $result = mysql_query($sql) or die(mysql_error());
  15. Looks like you're doing something wrong in your code. Post you code here
  16. You should use htmlentities with the ENT_QUOTES flag rather than stripslashes.
  17. If your images are located in http://mysite.co.uk/images/ then start your images path with a / this will always request the images from the root of the url <img src="/images/file.jpg"> Or prepend your sites domain <img src="http://sitename.com/images/file.jpg">
  18. Remove http://www.mysite.co.uk/ from your rewrite rule. Using absolute urls in your rules will redirect the user. RewriteEngine On # Turn on the rewriting engine RewriteRule ^category/([0-9]+)/?$ show_cat.php?cat_ID=$1 [NC,L]
  19. You can mix html/css within PHP just like you would in a html file.
  20. If you url is site.come/file.php?hash=1234 then yes you can use $_GET['hash'] but not if the url is site.com/file.php#1234 Anything after the hash is not sent in the http request to the server. Why are you wanting to get the value after the hash in PHP?
  21. Do you mean you want to get this #1234 from the url? It is not possible to retrieve this value in PHP as it is not sent in the request to the server. You can however get it via javascript.
  22. The other way is using a form button. The teacher clicks the button to view the student they want to see. So if want to go the form route then instead of echo " " . "<a href='student.php?id=".$mijnstudenten['id']."'>volg deze link</a>"; do $mijnstudenten['id']; echo "<form action='student.php' method='POST'>"; echo "<input type='hidden' name='id' value='".$mijnstudenten['id']."'>"; echo "<input type='submit' id='button' value='klik hier'>"; echo "</form>"; Now in student.php do <?php // get the student id, make sure it is set and that is numeric if(isset($_POST['id'] && is_numeric($_POST['id'])) { $student_id = (int) $_POST['id']; $studentenresult2 = mysql_query("SELECT * FROM studenten WHERE id='$student_id'"); $mijnstudent = mysql_fetch_assoc($studentenresult2); if ($mijnstudent["voornaam"] != ""){ echo " " . $mijnstudent["voornaam"]; } else { echo " " . "<strong>niet bekend</strong>"; } } else echo 'Invalid student id'; ?>
  23. Then in student.php amend the query so it selects the student id based on the teachers mentor group you have stored in the session $student_id = (int) $_GET['id']; $id2 = $userid2['mentorgroep']; $studentenresult2 = mysql_query("SELECT * FROM studenten WHERE id='$student_id' AND mentorgroep='$id2'");
  24. This is wrong WHERE @isfeat = 1 $loc_condn" . "echo $sql" . "GROUP BY a.adid it should be WHERE @isfeat = 1 $loc_condn GROUP BY a.adid
×
×
  • 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.