Jump to content

Recommended Posts

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  :confused:

 

I appreciate any help I can get!

Link to comment
https://forums.phpfreaks.com/topic/254127-multiple-query-fields/
Share on other sites

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.

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):

711881b87a9449199c2cc88.png

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>

 

:shrug:

 

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'");

 

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']);

?

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

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.