PHP form question

This is a discussion on PHP form question within the PHP Language forums, part of the PHP Programming Forums category; I was wondering if there was an easy way to show information in a form? I've tried a variety ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-21-2004
phatnugs420@comcast.net
 
Posts: n/a
Default PHP form question

I was wondering if there was an easy way to show information in a form? I've
tried a variety of things, and I'm sure I'm doing something wrong, or just
don't know what I'm doing.. :) could be both! Anyway basically I want to be
able to edit information from a mysql db, but when they go to the edit page
I want the form that I need to edit to show the information from mysql in
the form itself.. One of the examples I have tried is:


$query = mysql_query("SELECT * FROM itltest WHERE jobnum='$jobnum' AND
custID='$custID'") or die (mysql_error());
while ($row = mysql_fetch_assoc($query)) {

?>

<input name="company" type="text" id="company" value="<? echo "$company"?>">



Thanks in advance!

Reply With Quote
  #2 (permalink)  
Old 10-21-2004
jrf[no]
 
Posts: n/a
Default Re: PHP form question

phatnugs420@comcast.net wrote:

> I was wondering if there was an easy way to show information in a form? I've
> tried a variety of things, and I'm sure I'm doing something wrong, or just
> don't know what I'm doing.. :) could be both! Anyway basically I want to be
> able to edit information from a mysql db, but when they go to the edit page
> I want the form that I need to edit to show the information from mysql in
> the form itself.. One of the examples I have tried is:
>
>
> $query = mysql_query("SELECT * FROM itltest WHERE jobnum='$jobnum' AND
> custID='$custID'") or die (mysql_error());
> while ($row = mysql_fetch_assoc($query)) {


ADD THIS HERE:
$company = $row['company'];


>
> ?>
>
> <input name="company" type="text" id="company" value="<? echo "$company"?>">
>
>
>
> Thanks in advance!
>

Reply With Quote
  #3 (permalink)  
Old 10-21-2004
Michael Fesser
 
Posts: n/a
Default Re: PHP form question

.oO(phatnugs420@comcast.net)

> $query = mysql_query("SELECT * FROM itltest WHERE jobnum='$jobnum' AND
>custID='$custID'") or die (mysql_error());
> while ($row = mysql_fetch_assoc($query)) {


Are $jobnum and $custID numeric? If yes remove the single-quotes around
them. Only strings have to be quoted.

Micha
Reply With Quote
  #4 (permalink)  
Old 10-21-2004
Colin McKinnon
 
Posts: n/a
Default Re: PHP form question

Michael Fesser wrote:

>> $query = mysql_query("SELECT * FROM itltest WHERE jobnum='$jobnum' AND
>>custID='$custID'") or die (mysql_error());
>> while ($row = mysql_fetch_assoc($query)) {

>
> Are $jobnum and $custID numeric? If yes remove the single-quotes around
> them. Only strings have to be quoted.
>


Query will work with quotes round numbers - but MySQL may have problems
optimising the query.

C.
Reply With Quote
  #5 (permalink)  
Old 10-21-2004
Mikey P
 
Posts: n/a
Default Re: PHP form question

Sometimes i feel so dumb.. :) Thanks so much, this worked perfectly! you rock... :)

Mikey P


"jrf[no]" <"jrf[no]"@[spam]jokeaday.net> wrote in message news:<41772feb$0$61766$abc4f4c3@news.wanadoo.nl>.. .
> phatnugs420@comcast.net wrote:
>
> > I was wondering if there was an easy way to show information in a form? I've
> > tried a variety of things, and I'm sure I'm doing something wrong, or just
> > don't know what I'm doing.. :) could be both! Anyway basically I want to be
> > able to edit information from a mysql db, but when they go to the edit page
> > I want the form that I need to edit to show the information from mysql in
> > the form itself.. One of the examples I have tried is:
> >
> >
> > $query = mysql_query("SELECT * FROM itltest WHERE jobnum='$jobnum' AND
> > custID='$custID'") or die (mysql_error());
> > while ($row = mysql_fetch_assoc($query)) {

>
> ADD THIS HERE:
> $company = $row['company'];
>
>
> >
> > ?>
> >
> > <input name="company" type="text" id="company" value="<? echo "$company"?>">
> >
> >
> >
> > Thanks in advance!
> >

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 08:12 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0