Login | Register | FAQ
Anonymous

ip is not selected from mysql

+ Post a reply

Page 1 of 1


ip is not selected from mysql

by chatrapati » Fri Aug 02, 2013 10:01 am

I inserted ip into mysql but when i select the ip of the user from database, ip is not outputed!

i used in html form lyyk this:

<form action="add.php" method="post">
<input type="text" name="name">
<input type="hidden" name="ip" value="<?php

$_SERVER['PHP_SELF'];;
?>">
<input type="submit">
</form>

IS THERE ANY PROBLEM IN FORM??
User avatar

chatrapati

  • Posts: 26
  • Joined: Wed Jul 31, 2013 12:54 pm

Re: ip is not selected from mysql

by XainPro » Fri Aug 02, 2013 11:18 am

yes there are two problems
1) You did not echo the $_SERVER['PHP_SELF']; variable it should be echo to give output
2) For ip address $_SERVER['PHP_SELF'] is wrong super global it should be $_SERVER['REMOTE_ADDR']
if i correct those error your correct code will look like this

Code: Select all
<form action="add.php" method="post">
<input type="text" name="name">
<input type="hidden" name="ip" value="<?php  echo $_SERVER['REMOTE_ADDR']; ?>">
<input type="submit">
</form>
User avatar

XainPro

  • Posts: 2401
  • Joined: Fri Feb 17, 2012 8:10 pm

Re: ip is not selected from mysql

by chatrapati » Fri Aug 02, 2013 11:25 am

XainPro wrote:yes there are two problems
1) You did not echo the $_SERVER['PHP_SELF']; variable it should be echo to give output
2) For ip address $_SERVER['PHP_SELF'] is wrong super global it should be $_SERVER['REMOTE_ADDR']
if i correct those error your correct code will look like this

Code: Select all
<form action="add.php" method="post">
<input type="text" name="name">
<input type="hidden" name="ip" value="<?php  echo $_SERVER['REMOTE_ADDR']; ?>">
<input type="submit">
</form>



Yeah! i used $_SERVER['REMOTE_ADDR'];

and when i selected ip from the database there is no data outputed!
but name is outputed


here is a part of php code

Code: Select all
<?php

while($row=mysql_fetch_array($result))
{
echo $row['name'];

echo $row['ip']
}
?>
User avatar

chatrapati

  • Posts: 26
  • Joined: Wed Jul 31, 2013 12:54 pm

Re: ip is not selected from mysql

by XainPro » Fri Aug 02, 2013 11:32 am

by using phpmyadmin check is there ip addresses saved in database ?
User avatar

XainPro

  • Posts: 2401
  • Joined: Fri Feb 17, 2012 8:10 pm

Re: ip is not selected from mysql

by chatrapati » Fri Aug 02, 2013 1:28 pm

in database

at 'ip' colomn

its just $_SERVER['REM

no any data is stored in 'ip' at database

this is my add.php code
Code: Select all
<?php

$name=$_POST['name'];
$ip=$_POST['ip'];

$sql=mysql_query("INSERT INTO test(name,ip) VALUES ('$name','$ip')");

if($sql)
  {
echo "comment added successfully";

echo "<a href='view.php'>view here</a>";
}
else
{

echo "comment not added";
}

mysql_close();
?>
User avatar

chatrapati

  • Posts: 26
  • Joined: Wed Jul 31, 2013 12:54 pm

Re: ip is not selected from mysql

by XainPro » Wed Aug 14, 2013 9:09 pm

echo $_POST['ip'];

check what it output
User avatar

XainPro

  • Posts: 2401
  • Joined: Fri Feb 17, 2012 8:10 pm

sfcps2d4

by GeorgeHarPeale » Wed Aug 30, 2017 2:35 pm

https://bitbucket.org/snippets/orlandomye1970y6/BBr5ME/
https://bitbucket.org/snippets/montykgi1978w7/nR7pB6/

Apr 17, 2017 Google Chrome Old Version Free Download For Windows 7.
https://www.flickr.com/groups/3930815@N ... 853158863/
https://bitbucket.org/snippets/alvaroypr1971a9/zLnLE9/

Downloads: 103K. Many times you have an image with a colored background, like the one above and you want to take out the background to use the image's subject in a Download Photo Editing Background Change Free - best software for Windows.
https://www.flickr.com/groups/3600507@N ... 553546340/
https://www.flickr.com/groups/3940988@N ... 142729425/

Jun 25, 2017 WATCH watch First Kill (2017) full hd movie download in hd for free no registration movies 1080p and 720p Synopsis, credits, trivia, related films, photos, and links. Guarda Gratis King Arthur Su Megavideo, VK Senza Registrazioni. Planet of the Apes Full Online Watch Megashare Torrent.
http://clansection1.com/UPLOAD/phpBB3/v ... 073#p36073
http://vets1gaming.com/Forum/viewtopic. ... 3488#p3488
http://www.indianrealestatecouncil.com/ ... #pid262008
http://gondorenterprises.net/forums/sho ... 76#pid1576
https://forum.eyrena.ru/viewtopic.php?f ... 873#p44873

http://google.com/q=eaqyecqw
User avatar

GeorgeHarPeale

  • Posts: 1820
  • Joined: Mon Jul 10, 2017 5:19 pm
  • Location: Iceland


+ Post a reply

Page 1 of 1