Lotto320 Posted December 31, 2011 Share Posted December 31, 2011 Okay, so I am trying to make a play.php file connected to my database, this database got a table named "webclientcreate". When I go to play.php?id=1, it is showing the proper one (the 1st row wich got id 1 in it), however if I after that go to something random like play.php?fsfasd the ID 1s page still pops up.. I can also go to play.php?id=2 and still get the id 1's data. I want to make it that every row got its own information (well it does, but the php file doesnt seem to recieve it correctly). PHP version: 5.2.17 MySQL version: 5.1 Heres a picture of my table rows: I've censored the MySQL connection information, I know it is working properly. <?php $connect = mysql_connect("mysql12.000webhost.com","****","******") or die(mysql_error()); mysql_select_db("***") or die(mysql_error()); $extract = mysql_query("SELECT * FROM webclientcreate"); $numrows = mysql_num_rows($extract); while ($row = mysql_fetch_assoc($extract)) { $id = $row['id']; $server = $row['name']; $ip = $row['ip']; $port = $row['port']; $background = $row['background']; } if (isset($ip)&&isset($port)&&!empty($ip)&&!empty($port)) { if (! $sock = @fsockopen($ip, $port, $num, $error, 1)) echo ""; else{ echo "<img src='fs/newyear/online.png'/>$ip on port $port is currently<B><FONT COLOR=lime> Online</b></FONT>"; fclose($sock); } } ?> <title>Playing <?php echo $server; ?> - ID <?php echo $id; ?> </title> <center> <body bgcolor="#000000"> <applet name=client width=765 height=503 archive='<?php echo $jars; ?>' code='client.class'> <PARAM name='java_arguments' value='-Xmx700m'> <PARAM name='server_name' value='<?php echo $server; ?>'> <PARAM name='detail' value='low'> <PARAM name='ip' value='<?php echo $ip; ?>'> <PARAM name='port' value='<?php echo $port; ?>'> <PARAM name='background_image' value='<?php echo $background; ?>'> <PARAM name='headicons' value=''> </applet> </center> Quote Link to comment https://forums.phpfreaks.com/topic/254123-phpid123-not-working-properly/ Share on other sites More sharing options...
peter_anderson Posted December 31, 2011 Share Posted December 31, 2011 This line is wrong: $extract = mysql_query("SELECT * FROM webclientcreate"); You are not setting the id to choose: $id = mysql_real_escape_string($_GET['id']); $extract = mysql_query("SELECT * FROM webclientcreate WHERE id='$id' LIMIT 1"); Since there is only one result, you can also get rid of the while loop (But keep the contents). Quote Link to comment https://forums.phpfreaks.com/topic/254123-phpid123-not-working-properly/#findComment-1302812 Share on other sites More sharing options...
Lotto320 Posted December 31, 2011 Author Share Posted December 31, 2011 Thanks, but I didnt understand the "keep the content" part :-\ So I tried to understand it: <?php $connect = mysql_connect("mysql12.000webhost.com","***","***") or die(mysql_error()); mysql_select_db("***") or die(mysql_error()); $id = mysql_real_escape_string($_GET['id']); $extract = mysql_query("SELECT * FROM webclientcreate WHERE id='$id' LIMIT 1 WHERE ip='$ip' WHERE port='$port' WHERE name='$name' WHERE background='$background'"); ?> This ^^ Didnt make any differance then the one with only WHERE id='$id'. The ID's shows up correctly now, but I want this applet to be connected to the database: <applet name=client width=765 height=503 archive='<?php echo $jars; ?>' code='client.class'> <PARAM name='java_arguments' value='-Xmx700m'> <PARAM name='server_name' value='<?php echo $name; ?>'> <PARAM name='detail' value='low'> <PARAM name='ip' value='<?php echo $ip; ?>'> <PARAM name='port' value='<?php echo $port; ?>'> <PARAM name='background_image' value='<?php echo $background; ?>'> <PARAM name='headicons' value=''> </applet> And the $server part to show up in the title too. Quote Link to comment https://forums.phpfreaks.com/topic/254123-phpid123-not-working-properly/#findComment-1302821 Share on other sites More sharing options...
AyKay47 Posted December 31, 2011 Share Posted December 31, 2011 Is this actually solved? Quote Link to comment https://forums.phpfreaks.com/topic/254123-phpid123-not-working-properly/#findComment-1302838 Share on other sites More sharing options...
Lotto320 Posted December 31, 2011 Author Share Posted December 31, 2011 No, its not. I made a new topic before I saw this got unlocked again tho, http://www.phpfreaks.com/forums/index.php?topic=350876.0. Quote Link to comment https://forums.phpfreaks.com/topic/254123-phpid123-not-working-properly/#findComment-1302840 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.