home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

PHP help!

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 2667
Discussions: 200,965, Posts: 2,379,623, Members: 246,332
Old July 31st, 2006, 06:19 AM   Digg it!   #1 (permalink)
Member
 
Join Date: Nov 2005
Posts: 120
PHP help!

anyone know whats the code to connecting to another url?
this is what i wanted to do.

<?
$link=mysql_connect("localhost")or die("Could not connect");
mysql_select_db("cs259")or die("Could not select database");
$query="select * from epitaph where uname='" . $_REQUEST["uname"] . "'";
$result=mysql_query($query);

if(mysql_num_rows($result)==0)
{

"GO TO AN URL"

}
else{


[B]"GO TO ANOTHER URL"[/b]

}
mysql_close($link);
?>

can i do this in php? please help, tnx
unwanted is offline   Reply With Quote
Old July 31st, 2006, 03:17 PM     #2 (permalink)
SoMuchAnime-SoLittleTime
 
EXreaction's Avatar
 
Join Date: Aug 2003
Location: Plymouth, WI
Posts: 14,983
Blog Entries: 1
Send a message via MSN to EXreaction
Try
Code:
header("Location: http://www.example.com/");
Leave the Location: part. Just change the http://www.example.com/ to change the url.
__________________
My photography: Flickr

Lithium Studios - phpBB3, PHP, and Web Development
EXreaction is offline   Reply With Quote
Old August 1st, 2006, 04:22 AM     #3 (permalink)
Member
 
Join Date: Nov 2005
Posts: 120
tried this :

<?
$link=mysql_connect("localhost")or die("Could not connect");
mysql_select_db("cs259")or die("Could not select database");
$query="select * from epitaph where uname='" . $_REQUEST["uname"] . "'";
$result=mysql_query($query);

if(mysql_num_rows($result)==0)
{
header("Location: http://localhost/saint/failed.php");
}
else{

header("Location: http://localhost/saint/myquiz.php");

}
mysql_close($link);
?>



but gave me this error:

Warning: Cannot modify header information - headers already sent by (output started at D:\cs259garcia\check.php:9) in D:\cs259garcia\check.php on line 17
unwanted is offline   Reply With Quote
Old August 1st, 2006, 08:56 AM     #4 (permalink)
Senior Member
 
Join Date: May 2003
Location: Aus, Gold Coast :)
Posts: 802
Send a message via ICQ to exally
hey mate, found some code i did ages ago and i think it is

window.frames[1].location = "<enter url here>";

though this is used for frames, i guess u just go:

window.location = "<enter url here>";

that does work though , well the top one, might test the second now
exally is offline   Reply With Quote
Old August 1st, 2006, 10:17 AM     #5 (permalink)
Member
 
drizzle's Avatar
 
Join Date: Oct 2001
Location: Louisiana, USA
Posts: 256
Send a message via MSN to drizzle
Try placing this at the very top of your script (it allows headers to be sent after output has already been sent to the browser)

This changes the setting at runtime (Not 100% sure this one can be changed at runtime but give it a shot)...

PHP Code:
<?php  ini_set('output_buffering','On');  ?>

Last edited by drizzle : August 1st, 2006 at 11:03 AM.
drizzle is offline   Reply With Quote
Old August 2nd, 2006, 03:20 AM     #6 (permalink)
Member
 
Join Date: Nov 2005
Posts: 120
tried it both, but no luck!
unwanted is offline   Reply With Quote
Old August 2nd, 2006, 07:13 AM     #7 (permalink)
Ultimate Member
 
Join Date: Dec 2004
Posts: 1,558
If you aren't able to do it sending headers, your best bet is to use a meta redirect:
PHP Code:
echo '<meta http-equiv="Refresh" content="0;url=http://www.domain.com/">';
exit; 
Where the number before the semi-colon is the number of seconds before the page is redirected; 0 works well.

Just note that meta redirects can be disabled within browsers. So you may want to provide the user with a link:
PHP Code:
echo '<meta http-equiv="Refresh" content="0;url=http://www.domain.com/">';
echo 
'<A HREF="http://www.domain.com/">Click here</A> if you\'re not automatically redirected';
exit; 
__________________
"Be quiet, Brain, or I'll stab you with a Q-tip"
-Homer Simpson
large_nostril is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads
Thread Thread Starter Forum Replies Last Post
php coding assistance with templete.php herbal_lavender Webmastering and Programming 2 December 29th, 2005 09:35 AM
index.php?mode=something.php RyanD Webmastering and Programming 16 October 20th, 2004 11:20 PM
More PHP Help Rand Dusing Webmastering and Programming 3 September 6th, 2004 11:51 AM
php help BlueIce Webmastering and Programming 0 August 28th, 2004 05:45 PM
PHP under M$ SysRq Webmastering and Programming 25 August 6th, 2002 05:01 PM


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Forty-six years ago today (6)
Is It Just Me? (3006)
The disrespect of Obama by Russian .. (46)
Laptop with wireless problem. (12)
Wireless Televisions. (12)
CPU fan stops spinning randomly (11)
Regular Build (11)
Internet Lost (5)
windows 7 problem (7)
windows vista security holes (14)
Point and Shoot Camera Suggestions. (6)
Is the PSU I received dead? (13)
radeon x850xt platinum & shader.. (6)
HIS HD5770 graphic card question (15)
Recent Discussions
Laptop with wireless problem. (12)
Open With ..... Win7 (2)
Internet Lost (5)
Skillsoft Network+ Study Software Que.. (9)
Help getting around port 80 for camer.. (3)
virus blocking exe. files (1)
windows vista security holes (14)
Point and Shoot Camera Suggestions. (6)
CPU fan stops spinning randomly (11)
Nvidia GTX 260 problem (1)
Modern Warfare 2: Who Bought It? (65)
Is the PSU I received dead? (13)
Print spooler problem (16)
Kingston Bluetooth Dongle Driver (1)
Multiple Restarts Required at Boot (3)
webcam (0)
upgrade for hp a6101 (0)
tv not turn on-makes clicking sound (2)
EVGA 9800 gtx help with finding a goo.. (11)
Regular Build (11)
Help with onclick and buttons (0)
Virus advise (8)
My monitor won't turn on after instal.. (1)
Dept. of HS: NSA 'Helped' Develop Vis.. (16)
Ideal cheap graph card for PC-Gaming? (18)


All times are GMT -4. The time now is 01:48 PM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28