header (loaction:url);

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Mark817
Forum Newbie
Posts: 2
Joined: Tue Jun 03, 2003 2:39 am

header (loaction:url);

Post by Mark817 »

I have a login system setup using sessions; each user has an html page with information they need displayed. After logging in I'd like for the user to be redirected directly to that page. Can I make location:url a partial variable?

ex:

Code: Select all

<?php

header(location:'http://www.orphanivy.net/users/'.'&user_name.''.html');

?>
How would I parse that so it would work?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

try

Code: Select all

header('location:http://www.orphanivy.net/users/'. $user_name . '.html');
and have a read of http://php.net/language.types.string , http://php.net/language.operators.string
[]InTeR[]
Forum Regular
Posts: 416
Joined: Thu Apr 24, 2003 6:51 am
Location: The Netherlands

Post by []InTeR[] »

[start correction everything mode]
volka wrote:try

Code: Select all

header('location:http://www.orphanivy.net/users/'. $user_name . '.html');
and have a read of http://php.net/language.types.string , http://php.net/language.operators.string
If you follow the rfc's you need to have a space between location and the url. and it's ucfirst("location");

[end correction everything mode]
:)
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

:wink:
ok ok

Code: Select all

header('Location: http://www.orphanivy.net/users/'. $user_name . '.html');
Mark817
Forum Newbie
Posts: 2
Joined: Tue Jun 03, 2003 2:39 am

Post by Mark817 »

Thanks for the help. Ill read up on strings.

Another problem im having is with msql_num_rows();

here is my code

Code: Select all

<?php
	$result = MYSQL_QUERY($query, $conn);
	$affected_rows = mysql_num_rows($result);
?>
My errors..

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\Program Files\Apache Group\Apache2\htdocs\login.php on line 14

Any ideas?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

probably your query failed

Code: Select all

$result = mysql_query($query, $conn) or die($query. ': '. mysql_error());
Post Reply