I am not getting the username input into this database, only the ip
address it is inserting a blank?
I echoed the values from the post and I get both ip and uname values.
What can I look for? /They are both text fields. One gets input and
the other doesn't.
The form looks okay, thanks,
if ($_POST['submit']){updatePrinter($ip,$uname) ;}//call insert
function
function updatePrinter($ip,$uname){
$link = mysql_connect("XXX.XXX.XXX.XXX","usr","pwd");
mysql_select_db("cart_order",$link);
$sql="INSERT INTO `cart_order`.printer (ip,uname) ";
$sql.="VALUES('$ip','$uname') ";
$result=mysql_query($sql);
mysql_error();
return $error;
}
|
|
0
|
|
|
|
Reply
|
jr
|
8/4/2010 6:27:25 AM |
|
>I am not getting the username input into this database, only the ip
>address it is inserting a blank?
You said *ONE* field doesn't get input. That sounds like neither
field does. How are $uname and $ip supposed to be set? You're
not depending on having register_globals active, are you? If so,
that's a bad idea.
Echo the value of $sql before running the query. Include it in
any post unless looking at the result solves the problem immediately
so you don't need to post again.
>I echoed the values from the post and I get both ip and uname values.
>What can I look for? /They are both text fields. One gets input and
>the other doesn't.
>The form looks okay, thanks,
I don't see any references to $_GET[] or $_POST[] other than
$_POST['submit'], so where are you using input from the form?
>if ($_POST['submit']){updatePrinter($ip,$uname) ;}//call insert
>function
>
>function updatePrinter($ip,$uname){
>$link = mysql_connect("XXX.XXX.XXX.XXX","usr","pwd");
>mysql_select_db("cart_order",$link);
>$sql="INSERT INTO `cart_order`.printer (ip,uname) ";
>$sql.="VALUES('$ip','$uname') ";
>$result=mysql_query($sql);
>mysql_error();
>return $error;
Where did $error get set?
>}
|
|
0
|
|
|
|
Reply
|
gordonb
|
8/4/2010 7:59:30 AM
|
|
On Aug 4, 12:59=A0am, gordonb.xl...@burditt.org (Gordon Burditt) wrote:
> >I am not getting the username input into this database, only the ip
> >address it is inserting a blank?
>
> You said *ONE* field doesn't get input. =A0That sounds like neither
> field does. =A0How are $uname and $ip supposed to be set? =A0You're
> not depending on having register_globals active, are you? =A0If so,
> that's a bad idea.
>
> Echo the value of $sql before running the query. =A0Include it in
> any post unless looking at the result solves the problem immediately
> so you don't need to post again.
>
> >I echoed the values from the post and I get both ip and uname values.
> >What can I look for? =A0/They are both text fields. =A0One gets input an=
d
> >the other doesn't.
> >The form looks okay, thanks,
>
> I don't see any references to $_GET[] or $_POST[] other than
> $_POST['submit'], so where are you using input from the form?
>
> >if ($_POST['submit']){updatePrinter($ip,$uname) =A0;}//call insert
> >function
>
> >function updatePrinter($ip,$uname){
> >$link =3D mysql_connect("XXX.XXX.XXX.XXX","usr","pwd");
> >mysql_select_db("cart_order",$link);
> >$sql=3D"INSERT INTO `cart_order`.printer (ip,uname) ";
> >$sql.=3D"VALUES('$ip','$uname') ";
> >$result=3Dmysql_query($sql);
> >mysql_error();
> >return $error;
>
> Where did $error get set?
>
>
>
> >}
Okay, one thing that is happening is the $sql to display the data is
not displaying the most recent record and it is not displaying the
name but the data is in the
table.
Only one person uses it at a time so I need to know only the last user
was, ts is the timestamp. I was hoping to get the most recent
record. It isn't getting the most recent record. Probably max(ts) is
wrong? It wasn't displaying the name because that record didn't have
a name.
$sql=3D "SELECT ip,uname, max(ts) from `cart_order`.printer ";
$sql=3D "SELECT ip,uname, max(ts) from `pharm_cart_order`.printer ";
$result=3D mysql_query($sql);
if ( !$result ) {die("<font color=3D'red'>Invalid query:</font>" .
mysql_error() . "<br />$sql");}
//echo "<br>$sql<br>";
$row=3Dmysql_fetch_assoc($result);
$printer=3D$row['ip'];
$name=3D$row['uname'];
|
|
0
|
|
|
|
Reply
|
jr
|
8/4/2010 12:00:53 PM
|
|
On Aug 4, 12:59=A0am, gordonb.xl...@burditt.org (Gordon Burditt) wrote:
> >I am not getting the username input into this database, only the ip
> >address it is inserting a blank?
>
> You said *ONE* field doesn't get input. =A0That sounds like neither
> field does. =A0How are $uname and $ip supposed to be set? =A0You're
> not depending on having register_globals active, are you? =A0If so,
> that's a bad idea.
>
> Echo the value of $sql before running the query. =A0Include it in
> any post unless looking at the result solves the problem immediately
> so you don't need to post again.
>
> >I echoed the values from the post and I get both ip and uname values.
> >What can I look for? =A0/They are both text fields. =A0One gets input an=
d
> >the other doesn't.
> >The form looks okay, thanks,
>
> I don't see any references to $_GET[] or $_POST[] other than
> $_POST['submit'], so where are you using input from the form?
>
> >if ($_POST['submit']){updatePrinter($ip,$uname) =A0;}//call insert
> >function
>
> >function updatePrinter($ip,$uname){
> >$link =3D mysql_connect("XXX.XXX.XXX.XXX","usr","pwd");
> >mysql_select_db("cart_order",$link);
> >$sql=3D"INSERT INTO `cart_order`.printer (ip,uname) ";
> >$sql.=3D"VALUES('$ip','$uname') ";
> >$result=3Dmysql_query($sql);
> >mysql_error();
> >return $error;
>
> Where did $error get set?
>
>
>
> >}
I think it is a subquery, SELECT ip,uname, from
`pharm_cart_order`.printer WHERE max(ts)=3D(max(ts))
|
|
0
|
|
|
|
Reply
|
jr
|
8/4/2010 3:34:08 PM
|
|
In article <a5f3a018-4800-4034-b5a3-ebf98e917d47@v32g2000prd.googlegroups.com>, jr <jlrough@yahoo.com> wrote:
>On Aug 4, 12:59 am, gordonb.xl...@burditt.org (Gordon Burditt) wrote:
>> >I am not getting the username input into this database, only the ip
>> >address it is inserting a blank?
>>
>> You said *ONE* field doesn't get input. That sounds like neither
>> field does. How are $uname and $ip supposed to be set? You're
>> not depending on having register_globals active, are you? If so,
>> that's a bad idea.
>>
>> Echo the value of $sql before running the query. Include it in
>> any post unless looking at the result solves the problem immediately
>> so you don't need to post again.
>>
>> >I echoed the values from the post and I get both ip and uname values.
>> >What can I look for? /They are both text fields. One gets input and
>> >the other doesn't.
>> >The form looks okay, thanks,
>>
>> I don't see any references to $_GET[] or $_POST[] other than
>> $_POST['submit'], so where are you using input from the form?
>>
>> >if ($_POST['submit']){updatePrinter($ip,$uname) ;}//call insert
>> >function
>>
>> >function updatePrinter($ip,$uname){
>> >$link = mysql_connect("XXX.XXX.XXX.XXX","usr","pwd");
>> >mysql_select_db("cart_order",$link);
>> >$sql="INSERT INTO `cart_order`.printer (ip,uname) ";
>> >$sql.="VALUES('$ip','$uname') ";
>> >$result=mysql_query($sql);
>> >mysql_error();
>> >return $error;
>>
>> Where did $error get set?
>>
>>
>>
>> >}
>
>I think it is a subquery, SELECT ip,uname, from
>`pharm_cart_order`.printer WHERE max(ts)=(max(ts))
Janis, how do you expect anyone to be able to help you if you don't answer the
questions that are asked of you in an effort to troubleshoot?
Gordon asked you four specific questions, and also asked that you post the
value of $sql.
You didn't answer *any* of the questions, and you didn't post the value of
that variable, either. Instead, you posted some indefinite and apparently
irrelevant statement about a subquery somewhere, which may or may not have
anything to do with the problem.
|
|
0
|
|
|
|
Reply
|
spambait
|
8/4/2010 3:48:24 PM
|
|
On 4 Aug, 16:48, spamb...@milmac.com (Doug Miller) wrote:
> In article <a5f3a018-4800-4034-b5a3-ebf98e917...@v32g2000prd.googlegroups=
..com>, jr <jlro...@yahoo.com> wrote:
>
>
>
>
>
> >On Aug 4, 12:59 am, gordonb.xl...@burditt.org (Gordon Burditt) wrote:
> >> >I am not getting the username input into this database, only the ip
> >> >address it is inserting a blank?
>
> >> You said *ONE* field doesn't get input. That sounds like neither
> >> field does. How are $uname and $ip supposed to be set? You're
> >> not depending on having register_globals active, are you? If so,
> >> that's a bad idea.
>
> >> Echo the value of $sql before running the query. Include it in
> >> any post unless looking at the result solves the problem immediately
> >> so you don't need to post again.
>
> >> >I echoed the values from the post and I get both ip and uname values.
> >> >What can I look for? /They are both text fields. One gets input and
> >> >the other doesn't.
> >> >The form looks okay, thanks,
>
> >> I don't see any references to $_GET[] or $_POST[] other than
> >> $_POST['submit'], so where are you using input from the form?
>
> >> >if ($_POST['submit']){updatePrinter($ip,$uname) ;}//call insert
> >> >function
>
> >> >function updatePrinter($ip,$uname){
> >> >$link =3D mysql_connect("XXX.XXX.XXX.XXX","usr","pwd");
> >> >mysql_select_db("cart_order",$link);
> >> >$sql=3D"INSERT INTO `cart_order`.printer (ip,uname) ";
> >> >$sql.=3D"VALUES('$ip','$uname') ";
> >> >$result=3Dmysql_query($sql);
> >> >mysql_error();
> >> >return $error;
>
> >> Where did $error get set?
>
> >> >}
>
> >I think it is a subquery, SELECT ip,uname, from
> >`pharm_cart_order`.printer =A0WHERE max(ts)=3D(max(ts))
>
> Janis, how do you expect anyone to be able to help you if you don't answe=
r the
> questions that are asked of you in an effort to troubleshoot?
>
> Gordon asked you four specific questions, and also asked that you post th=
e
> value of $sql.
>
> You didn't answer *any* of the questions, and you didn't post the value o=
f
> that variable, either. Instead, you posted some indefinite and apparently
> irrelevant statement about a subquery somewhere, which may or may not hav=
e
> anything to do with the problem.
I think you'll find that she doesn't understand the questions.
She just blindly spreads some coding similar to what she's seen
elsewhere and hopes that some kind person will write it all for her.
She's been doing it for some years now.
|
|
0
|
|
|
|
Reply
|
Captain
|
8/4/2010 3:52:14 PM
|
|
On Aug 4, 8:48=A0am, spamb...@milmac.com (Doug Miller) wrote:
> In article <a5f3a018-4800-4034-b5a3-ebf98e917...@v32g2000prd.googlegroups=
..com>, jr <jlro...@yahoo.com> wrote:
>
>
>
>
>
> >On Aug 4, 12:59 am, gordonb.xl...@burditt.org (Gordon Burditt) wrote:
> >> >I am not getting the username input into this database, only the ip
> >> >address it is inserting a blank?
>
> >> You said *ONE* field doesn't get input. That sounds like neither
> >> field does. How are $uname and $ip supposed to be set? You're
> >> not depending on having register_globals active, are you? If so,
> >> that's a bad idea.
>
> >> Echo the value of $sql before running the query. Include it in
> >> any post unless looking at the result solves the problem immediately
> >> so you don't need to post again.
>
> >> >I echoed the values from the post and I get both ip and uname values.
> >> >What can I look for? /They are both text fields. One gets input and
> >> >the other doesn't.
> >> >The form looks okay, thanks,
>
> >> I don't see any references to $_GET[] or $_POST[] other than
> >> $_POST['submit'], so where are you using input from the form?
>
> >> >if ($_POST['submit']){updatePrinter($ip,$uname) ;}//call insert
> >> >function
>
> >> >function updatePrinter($ip,$uname){
> >> >$link =3D mysql_connect("XXX.XXX.XXX.XXX","usr","pwd");
> >> >mysql_select_db("cart_order",$link);
> >> >$sql=3D"INSERT INTO `cart_order`.printer (ip,uname) ";
> >> >$sql.=3D"VALUES('$ip','$uname') ";
> >> >$result=3Dmysql_query($sql);
> >> >mysql_error();
> >> >return $error;
>
> >> Where did $error get set?
>
> >> >}
>
> >I think it is a subquery, SELECT ip,uname, from
> >`pharm_cart_order`.printer =A0WHERE max(ts)=3D(max(ts))
>
> Janis, how do you expect anyone to be able to help you if you don't answe=
r the
> questions that are asked of you in an effort to troubleshoot?
>
> Gordon asked you four specific questions, and also asked that you post th=
e
> value of $sql.
>
> You didn't answer *any* of the questions, and you didn't post the value o=
f
> that variable, either. Instead, you posted some indefinite and apparently
> irrelevant statement about a subquery somewhere, which may or may not hav=
e
> anything to do with the problem.
Sorry, what was happening was I was confusing the $sql to display the
data with the $sql to POST. It was writing over itself.
I found the error.
|
|
0
|
|
|
|
Reply
|
jr
|
8/4/2010 6:12:53 PM
|
|
jr wrote:
> On Aug 4, 8:48 am, spamb...@milmac.com (Doug Miller) wrote:
>> In article <a5f3a018-4800-4034-b5a3-ebf98e917...@v32g2000prd.googlegroups.com>, jr <jlro...@yahoo.com> wrote:
>>
>>
>>
>>
>>
>>> On Aug 4, 12:59 am, gordonb.xl...@burditt.org (Gordon Burditt) wrote:
>>>>> I am not getting the username input into this database, only the ip
>>>>> address it is inserting a blank?
>>>> You said *ONE* field doesn't get input. That sounds like neither
>>>> field does. How are $uname and $ip supposed to be set? You're
>>>> not depending on having register_globals active, are you? If so,
>>>> that's a bad idea.
>>>> Echo the value of $sql before running the query. Include it in
>>>> any post unless looking at the result solves the problem immediately
>>>> so you don't need to post again.
>>>>> I echoed the values from the post and I get both ip and uname values.
>>>>> What can I look for? /They are both text fields. One gets input and
>>>>> the other doesn't.
>>>>> The form looks okay, thanks,
>>>> I don't see any references to $_GET[] or $_POST[] other than
>>>> $_POST['submit'], so where are you using input from the form?
>>>>> if ($_POST['submit']){updatePrinter($ip,$uname) ;}//call insert
>>>>> function
>>>>> function updatePrinter($ip,$uname){
>>>>> $link = mysql_connect("XXX.XXX.XXX.XXX","usr","pwd");
>>>>> mysql_select_db("cart_order",$link);
>>>>> $sql="INSERT INTO `cart_order`.printer (ip,uname) ";
>>>>> $sql.="VALUES('$ip','$uname') ";
>>>>> $result=mysql_query($sql);
>>>>> mysql_error();
>>>>> return $error;
>>>> Where did $error get set?
>>>>> }
>>> I think it is a subquery, SELECT ip,uname, from
>>> `pharm_cart_order`.printer WHERE max(ts)=(max(ts))
>> Janis, how do you expect anyone to be able to help you if you don't answer the
>> questions that are asked of you in an effort to troubleshoot?
>>
>> Gordon asked you four specific questions, and also asked that you post the
>> value of $sql.
>>
>> You didn't answer *any* of the questions, and you didn't post the value of
>> that variable, either. Instead, you posted some indefinite and apparently
>> irrelevant statement about a subquery somewhere, which may or may not have
>> anything to do with the problem.
> Sorry, what was happening was I was confusing the $sql to display the
> data with the $sql to POST. It was writing over itself.
> I found the error.
Jesus wept...
|
|
0
|
|
|
|
Reply
|
The
|
8/4/2010 9:07:05 PM
|
|
On Aug 4, 10:07=A0pm, The Natural Philosopher <t...@invalid.invalid>
wrote:
> Jesus wept...
I rest my case!
|
|
0
|
|
|
|
Reply
|
Captain
|
8/4/2010 11:13:38 PM
|
|
El 04/08/2010 17:34, jr escribi�/wrote:
> `pharm_cart_order`.printer WHERE max(ts)=(max(ts))
When the maximum value ever gets different to itself, you'll be into
serious problems.
--
-- http://alvaro.es - �lvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programaci�n web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
|
|
0
|
|
|
|
Reply
|
alvaro.NOSPAMTHANX1 (511)
|
8/5/2010 9:20:44 AM
|
|
El 04/08/2010 17:52, Captain Paralytic escribi�/wrote:
>> You didn't answer*any* of the questions, and you didn't post the value of
>> > that variable, either. Instead, you posted some indefinite and apparently
>> > irrelevant statement about a subquery somewhere, which may or may not have
>> > anything to do with the problem.
> I think you'll find that she doesn't understand the questions.
>
> She just blindly spreads some coding similar to what she's seen
> elsewhere and hopes that some kind person will write it all for her.
> She's been doing it for some years now.
I agree. I would have normally answered her first post with some
explanations about PHP and SQL and how they are different languages but
other threads from her have proved me it is a pointless effort.
Either write a full working snippet she can copy and paste or forget
about the subject.
--
-- http://alvaro.es - �lvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programaci�n web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
|
|
0
|
|
|
|
Reply
|
ISO
|
8/5/2010 9:27:23 AM
|
|
On 5 Aug, 10:27, "=C1lvaro G. Vicario"
<alvaro.NOSPAMTH...@demogracia.com.invalid> wrote:
> El 04/08/2010 17:52, Captain Paralytic escribi=F3/wrote:
>
> >> You didn't answer*any* =A0of the questions, and you didn't post the va=
lue of
> >> > =A0that variable, either. Instead, you posted some indefinite and ap=
parently
> >> > =A0irrelevant statement about a subquery somewhere, which may or may=
not have
> >> > =A0anything to do with the problem.
> > I think you'll find that she doesn't understand the questions.
>
> > She just blindly spreads some coding similar to what she's seen
> > elsewhere and hopes that some kind person will write it all for her.
> > She's been doing it for some years now.
>
> I agree. I would have normally answered her first post with some
> explanations about PHP and SQL and how they are different languages but
> other threads from her have proved me it is a pointless effort.
>
> Either write a full working snippet she can copy and paste or forget
> about the subject.
If you want a good laugh pop over to c.l.j. where she's trying to use
AJAX. Someone's comment there says:
"You seem to be throwing code to this problem at random."
which was posted after I posted my comment.
I think that they may be realising that it would be less painful to
bang their heads against a real brick wall.
|
|
0
|
|
|
|
Reply
|
Captain
|
8/5/2010 11:25:12 AM
|
|
On Thu, 5 Aug 2010 04:25:12 -0700 (PDT), Captain Paralytic wrote:
> If you want a good laugh pop over to c.l.j. where she's trying to use
> AJAX. Someone's comment there says:
> "You seem to be throwing code to this problem at random."
> which was posted after I posted my comment.
> I think that they may be realising that it would be less painful to
> bang their heads against a real brick wall.
Heh. An entire new meaning of "spaghetti coding". As in "it's done if
you throw it onto the wall and it sticks".
--
The Write Many, Read Never drive. For those people that don't know
their system has a /dev/null already.
-- Rik Steenwinkel, singing the praises of 8mm Exabytes
|
|
0
|
|
|
|
Reply
|
Peter
|
8/5/2010 12:55:03 PM
|
|
|
12 Replies
203 Views
(page loaded in 0.153 seconds)
|