Lotto320 Posted December 31, 2011 Share Posted December 31, 2011 According to http://www.phpfreaks.com/forums/index.php?topic=350872.0: Is this a correct usage of what I am trying to create? <?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'"); ?> <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=''> I've tried several types of the query line such as : webclientcreate WHERE id='$id' LIMIT 1, WHERE ip='$ip', WHERE port='$port' webclientcreate WHERE id='$id' LIMIT 1, ip='$ip', port='$port' webclientcreate WHERE id='$id' LIMIT 1 ip='$ip' port='$port' Without any success I appreciate any help I can get! Quote Link to comment https://forums.phpfreaks.com/topic/254127-multiple-query-fields/ Share on other sites More sharing options...
AyKay47 Posted December 31, 2011 Share Posted December 31, 2011 Two things, 1. Your select syntax is invalid. Look here for correct syntax. 2. Where are your other values besides $id coming from in your script? 3. I lied, there are 3 things, if $id is expected to be a numerical value, mysql_real_escape_string() is not needed. Quote Link to comment https://forums.phpfreaks.com/topic/254127-multiple-query-fields/#findComment-1302841 Share on other sites More sharing options...
Lotto320 Posted December 31, 2011 Author Share Posted December 31, 2011 I can write play.php?id=62&name=hello while having: $id = mysql_real_escape_string($_GET['id']); $name = mysql_real_escape_string($_GET['name']); $extract = mysql_query("SELECT * FROM webclientcreate WHERE id='$id','name='$name'"); Thought this is not what I want. I want it that way it reads all of the fields from ID 1's row in the database table. This is row 2 (ID 2): So going to play.php?id=2 would make the source be this while being on the page would make the title "Playing testwebclient - ID 2". And the applet should be filled: <applet name=client width=765 height=503 archive='' code='client.class'> <PARAM name='java_arguments' value='-Xmx700m'> <PARAM name='server_name' value='testwebclient'> <PARAM name='detail' value='low'> <PARAM name='ip' value='85.585.26.2'> <PARAM name='port' value='88888'> <PARAM name='background_image' value='http://askfreud.org/wp-content/uploads/2010/11/carrot.jpg'> <PARAM name='headicons' value=''> </applet> I've also readed the manual, I think this is correct but it doesnt work.. $id = mysql_real_escape_string($_GET['id']); $name = mysql_real_escape_string($_GET['name']); $extract = mysql_query("SELECT * FROM webclientcreate WHERE id='$id' AND name='$name'"); Quote Link to comment https://forums.phpfreaks.com/topic/254127-multiple-query-fields/#findComment-1302843 Share on other sites More sharing options...
AyKay47 Posted December 31, 2011 Share Posted December 31, 2011 Did you look at the link I provided? You do not use a comma to separate you where clause statements, you use AND. Select something from something where something = something and something = something Quote Link to comment https://forums.phpfreaks.com/topic/254127-multiple-query-fields/#findComment-1302844 Share on other sites More sharing options...
Lotto320 Posted December 31, 2011 Author Share Posted December 31, 2011 I've also readed the manual, I think this is correct but it doesnt work.. $id = mysql_real_escape_string($_GET['id']); $name = mysql_real_escape_string($_GET['name']); $extract = mysql_query("SELECT * FROM webclientcreate WHERE id='$id' AND name='$name'"); Is this correct? Shouldnt name be something like $name = (row['name']); ? Quote Link to comment https://forums.phpfreaks.com/topic/254127-multiple-query-fields/#findComment-1302845 Share on other sites More sharing options...
AyKay47 Posted December 31, 2011 Share Posted December 31, 2011 I've also readed the manual, I think this is correct but it doesnt work.. $id = mysql_real_escape_string($_GET['id']); $name = mysql_real_escape_string($_GET['name']); $extract = mysql_query("SELECT * FROM webclientcreate WHERE id='$id' AND name='$name'"); Is this correct? looks correct Quote Link to comment https://forums.phpfreaks.com/topic/254127-multiple-query-fields/#findComment-1302852 Share on other sites More sharing options...
jcbones Posted December 31, 2011 Share Posted December 31, 2011 You still need to get the data with one of the fetch functions. mysql_fetch_array mysql_fetch_row mysql_fetch_assoc Quote Link to comment https://forums.phpfreaks.com/topic/254127-multiple-query-fields/#findComment-1302858 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.