JimD Posted November 3, 2008 Share Posted November 3, 2008 I'm trying to get a php page to search a sql database to find what server the username is on and use that to redirect to a certain page depending on the server that user is on. So this is how it should work. 1. User goes to remodesk.net/download/index.php 2. user types in thier username and presses the go button 3. That username is then transfered over to another php that remembers what they entered and then logs into the sql database which has only username and server No. in it. 4. then it searches for that username and then on the next column over which would be server no. it collects that number and lets say that user is on server 1 it redirects them to remodesk.net/download/serv1connect If someone could code this that would be very great Link to comment https://forums.phpfreaks.com/topic/131140-solved-how-do-i-get-info-from-an-sql-databse-with-php/ Share on other sites More sharing options...
JimD Posted November 3, 2008 Author Share Posted November 3, 2008 Nevermind i figured it out myself: <?php $search = $_REQUEST["Username"]; mysql_connect("xxxxxx", "xxxxxx", "xxxxxxx") or die(mysql_error()); mysql_select_db("xxxxxx") or die(mysql_error()); $X = "That Username does not exist."; $query = mysql_query("SELECT * FROM SERVER_DATA WHERE Username LIKE '%$search%' LIMIT 0, 30 "); while ($row = mysql_fetch_array($query)) { $variable1=$row["Server"]; print ("You are on Server: $variable1"); } if (!$variable1) { print ("$X"); } ?> Link to comment https://forums.phpfreaks.com/topic/131140-solved-how-do-i-get-info-from-an-sql-databse-with-php/#findComment-680903 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.