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
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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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