Jump to content

Using $_GET


Shadowing

Recommended Posts

I am really confused about how people use $_GET to give a page a link

 

so far what I understand is that $_GET grabs the information from a link

 

So if my link was http://localhost/stargate/users/profile.php?goauld=Sam

 

how do I turn this into viewing Sams profile soon as i type in that link with out having to hit a search button first

 

would really appreciate if someone help me understand this please cause it appears i really need to know how to do this.

 

 

<?php	

if(isset($_POST['search'])) {						

			// searches goaulds then displays them				

		$search3 = "SELECT goauld,id FROM users WHERE goauld='".mysql_real_escape_string($_POST['goaulds'])."'"; 									

		$search2 = mysql_query($search3) or die(mysql_error());								

WHILE($search1 = mysql_fetch_array($search2)){ 									

		$grab_goauld = $search1['goauld'];						


echo '<table width="300" height="5" border="1" align="center">';  

echo '<th><center>Goauld Statistics</center></th>';     

echo "<tr><td height='340'>$grab_goauld</td></tr>";   			   			

}			

}	  


echo '</table>';  ?>

Link to comment
https://forums.phpfreaks.com/topic/253195-using-_get/
Share on other sites

I have this so far

im thinking it should be something close to this

 

I type in the link http://localhost/stargate/users/goaulds.php?goauld=baal

and it should excute the script filling in baal on GET

but it doesnt work

 

 

 

<?php	

		$search3 = "SELECT goauld FROM game WHERE goauld='".mysql_real_escape_string($_GET['goauld'])."'"; 									

		mysql_query($search3) or die(mysql_error());								

		$grab_goauld = $search3['goauld'];								


echo '<table width="300" height="5" border="1" align="center">';  

echo '<th><center>Goauld Statistics</center></th>';     

echo "<tr><td height='340'>$grab_goauld</td></tr>";   			   			


echo '</table>';  

?>

Link to comment
https://forums.phpfreaks.com/topic/253195-using-_get/#findComment-1298000
Share on other sites

ROAR!!! yes I figured it out!

 

geez ive been wanting to know how to do this for ever

 

 

 

<?php	

			// searches goaulds then displays them				

		$search3 = "SELECT goauld FROM game WHERE goauld='".mysql_real_escape_string($_GET['goauld'])."'"; 									

		$search2 = mysql_query($search3) or die(mysql_error());								

WHILE($search1 = mysql_fetch_array($search2)){ 												


		$grab_goauld = $search1['goauld'];								

echo '<table width="300" height="5" border="1" align="center">';  

echo '<th><center>Goauld Statistics</center></th>';     

echo "<tr><td height='340'>$grab_goauld</td></tr>";   			   			


}			



echo '</table>';  

?>

Link to comment
https://forums.phpfreaks.com/topic/253195-using-_get/#findComment-1298002
Share on other sites

<?php
header("Content-type:text/html; charset=utf-8");
if(isset($_GET['goauld'])){
$search3 = "SELECT goauld FROM game WHERE goauld='".mysql_real_escape_string($_GET['goauld'])."'";
$result = mysql_query($search3) or die(mysql_error());
while($row_arr = mysql_fetch_assoc($result)){
    // use $row_arr, it associative array contents one row from table
}
}
?>

Link to comment
https://forums.phpfreaks.com/topic/253195-using-_get/#findComment-1298003
Share on other sites

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.