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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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! |
|
|||
|
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! > |
|
|||
|
.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 |
|
|||
|
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. |
|
|||
|
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! > > |