GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   php guys -- database query, help! (https://gfy.com/showthread.php?t=145836)

nxventures 06-22-2003 01:13 PM

php guys -- database query, help!
 
On my "add user" page I need a query that will check if the login supplied already exists and if it does I need the user to be redirected to signup.php?name=1.

I am going on 40 something hours of no sleep, and I need to get this done, help is very much appreciated. And needed. Thanks a ton to whoever can help!!

vending_machine 06-22-2003 01:35 PM

Code:

$DBH = mysql_connect( ... );
mysql_select_db( 'database', $DBH );
$sql = "SELECT username FROM table WHERE username = 'foo'";
$query_result = mysql_query( $sql, $DBH );

if ( mysql_num_rows( $query_result ) hahahaha 1 )
{
      header( "Location: http://" . $_SERVER[ 'HTTP_HOST' ] . "/signup.php?name=1" );
}


nxventures 06-22-2003 01:50 PM

thats almost exactly what i have, but does the same thing. no go.

nxventures 06-22-2003 01:52 PM

it just goes through the rest of the actions as if the header redirect doesn't fucking exist.

vending_machine 06-22-2003 02:16 PM

Quote:

Originally posted by nxventures
it just goes through the rest of the actions as if the header redirect doesn't fucking exist.
You should exit your code as well (immediately after the header statement):

Code:

exit();
Do you have that? In addition, the header function will not work if you have already sent text to stdout.

Hansm 06-22-2003 02:26 PM

$DBH = mysql_connect( ... );
mysql_select_db( 'database', $DBH );
$sql = "SELECT username FROM table WHERE username = 'foo'";
$query_result = mysql_query( $sql, $DBH );

if ( mysql_num_rows( $query_result ) hahahaha 1 )
{
header( "Location: http://" . $_SERVER[ 'HTTP_HOST' ] . "/signup.php?name=1" );
exit();
}

nxventures 06-22-2003 03:18 PM

I have no idea why I didn't exit my code, I write beautiful code, must be time to catch up on that sleep. Thanks a ton guys, you're fucking great.


All times are GMT -7. The time now is 04:10 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123