Jump to content

Can someone help me with a redirect.


Deanznet

Recommended Posts

I just need it a simple php/mysql code that i can put at the top of the page..

 

It has to be like

 

It has to check if uStreet ,uApt ,uCity ,uState ,uZip are empty in the mysql database and if it is it redirect to info.php but if not it continues with the script..

 

Can anyone help?

Link to comment
https://forums.phpfreaks.com/topic/153816-can-someone-help-me-with-a-redirect/
Share on other sites

Okay.. I need a way to check if these tables are not empty in the mysql database.

 

uStreet ,uApt ,uCity ,uState ,uZip

 

If they are then the user gets redirect to info.php  But if they are not empty then they dont get redirected and the script can finished.

 

So something like select from blah blah if empty redirect }else{ script finishes.

Well.. If you want to take a look at my code then be my guess.

 

I still don't understand how i can just check those 5 columns.

<?php

$query = "SELECT count(*) FROM pbs_users
WHERE uEmail='".$userInfo[$TbUsers->col_uEmail]."'"); 
$result = mysql_query($query) or die(mysql_error());

if(empty){ 
header("Location: info.php");
}

}else{
header("Location: index.php");
}


Well instead of slecting everything by using (*) add just the row names you need.

COUNT rowname,rowname,rowname etc.

 

Also you should change the way you are checking if they are empty.

 

$query = "SELECT count(*) FROM pbs_users
WHERE uEmail='".$userInfo[$TbUsers->col_uEmail]."'"); 
$result = mysql_query($query) or die(mysql_error());

if(mysql_num_rows($result)==0) ;
header("Location: info.php");
}

}else{
header("Location: index.php");
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.