MDanz
-
Posts
728 -
Joined
-
Last visited
Posts posted by MDanz
-
-
ok how do i get the page to display? i get this error
Not FoundThe requested URL /test was not found on this server.
for example the url is this
-
if you are talking about the actual text after http://www.example.com/Username,
you can use a regular expression to match the text.
$pattern = '/^http\:\/\/www\.[a-zA-Z0-9]+?\.com\/([a-zA-Z-0-9]+?)/';
so $pattern will get the Username from the url?
-
How do i use GET to get the username if the url is like this
or is there another method rather than GET?
-
at random times i get a parse error unexpected $end on a random line. Then i refresh the page and everything is working.
Does anyone have an idea on why this error is inconsistent?
It's hard to debug because i don't know when it's going to show up, completely random. I have matched brackets and checked semicolons. i would comment out code but like i said it's random. If refreshing the page makes everything work, what could be the culprit?
-
ok i don't understand.
this is the line that causes it
header( 'Location: ' . $return );
The solution is to determine what that output is and prevent it from occurring before you attempt to do a header() redirect.$return is the url of the current page, so when logging out it reloads current page.
What do i have to prevent? I have a session_start(); at the top of the page is that what is causing it?
-
i get the error "Warning: Cannot modify header information - headers already sent by" with the below code. How do i solve it without using output buffering?
function logout($return) { unset($_SESSION['admin']); unset($_SESSION['username']); header( 'Location: ' . $return ); echo "<div class='fontall'><span class='fontdif'>You've been logged out. </span><a href='$return'>Click Here</a><span class='fontdif' to return</span></div>"; }
-
thanks for the replies but do you know why i get the error? it should be a full <br /> tag instead of <br..
-
When i check the source code I get this error
rotator cuff<br />strengthenin<br..
you can see the br tag is cutt off. The code is below.
$thename = "rotator cuff strengthening";
$newname = wordwrap($thename, 12, "<br />", true); $limit = 33; if (strlen($newname) > $limit) { $newname2 = substr($newname, 0, $limit) . '..'; } else { $newname2 = $newname; }
-
With this form... if i typed in "new test" in the search text field the url would come up as
test.php?search=new+test
How do i get the url to replace spaces as a dash instead of a plus sign?
<form action="test.php" method="GET" name="searchbar"> <?php $search = strtolower($_GET['search']); $formpage = $_SERVER['PHP_SELF']; echo "<input type='text' size='40' name='search' style='font-size:16px; font-family:Arial;font-weight:bold;' /> <input type='submit' value='Search' style='font-size:14px;' />"; ?> </div> </form>
-
thanks it works. learned something new.
-
this query isn't working.
foreach($rating as $value) //foreach loop which updates totalsum every array key { if($value>0) { $totalsum = mysql_query("UPDATE block SET totalsum=totalsum+$value WHERE id=$d",$this->connect); } }
i echoed the query and get this
UPDATE block SET totalsum=totalsum+2 WHERE id=16 AND id=17 AND id=18 AND id=19
it should work. I have entries in mysql with those id's. It should update the totalsum column by 2 for those id's
-
i get this error randomly appear Parse error: syntax error, unexpected ..... on line 3094
line 3094 is
function account($username,$email,$password,$cpassword) {
this appears randomly... if i refresh the page, everything works.. Any idea what is the problem?
-
-
$_SESSION[$c] is an array in a loop. How do i do an if statement that gets the current array key?
if($_SESSION[$c][]==$_SESSION[$c][1]) { }
i tried the above but i get this error "Fatal error: Cannot use [] for reading in..."
-
nvm.. i got the solution
end($array); $lastKey = key($array);
-
$_SESSION['people'] is an array. I add to $_SESSION['people'] by doing this...
$_SESSION['people'][] = $people;
basically how do i code "if last key in array?"..
i tried this but it's not correct
if(end($_SESSION['people'])) { //code }
-
How do i do if i've reached of array? i know i could do end of loop. but the array is present many times in my code.
while($row = mysql_fetch_assoc($getdetails)) { $people = $row['people']; $_SESSION['people'][] = $people; if(end($_SESSION['people'])) { //code } }
-
i want the div to start off hidden. I know how to make it show and hide. The problem is when i load the page the border is seen. If i use display:none; in the div css the div doesn't display even when i press the button with the function to show.
open and close function
function infobox(number) { document.getElementById('userinfo').style.display = "block"; //displays userinfo } function closeinfo() { document.getElementById('userinfo').style.display = "none"; }
div css
#userinfo { position:absolute; text-align:left; width:900px; height:auto; top:100px; left:50%; font-size:14px; font-family:Arial; z-index:20; margin-left:-450px; background-color:#FFFFFF; border:1px solid #264971; }
-
nvm i fixed it... thx anyway
-
i put values in the array like this
$_SESSION[$v][] = "<div class='informationtop'></div> <div class='informationmiddle'><p>Added by <b>$theuser</b></p><p>$name</p><p>$reason</p></div> <div class='informationbottom'></div>";
if i print_r($_SESSION[1]); the array has the correct values. but for some reason the error is showing up.
-
yes i've tested it is an array. Still coming up with the error 9 times, each on the same line with the implode.
-
i keep on getting this error.. Warning: implode() [function.implode]: Invalid arguments passed in...
$rowinformation is an array, i don't see where the problem is.
for($v=1;$v<11;$v++) { $rowinformation = $_SESSION[$v]; echo "<div style='display:none;' id='$v'>".implode("<p> </p>",$rowinformation)."</div>"; // outcome string information }
-
-
it's not displaying the image... any help?
echo "<img src='advertimage.php?id=$advertid' />";
advertimage.php
<?php $id= $_GET['id']; $thedatabase = new Database2(); $thedatabase->opendb2(); $advert = $thedatabase->viewadvert($id); header("Content-type: image/jpeg"); echo $advert; $thedatabase->closedb2(); ?>
viewadvert function
function viewadvert($id){ $getadvert = mysql_query("SELECT * FROM `advertise` WHERE `id`='$id' LIMIT 1",$this->connect); $row=mysql_fetch_assoc($getadvert); $image = $row['image']; return $image; }
user profile url help
in PHP Coding Help
Posted
nvm i found a solution...basically i want a "pretty" url. thanks for the help anyway