By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,722 Members | 1,247 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,722 IT Pros & Developers. It's quick & easy.

PHP form question

P: n/a
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!

Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
ph*********@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!

Jul 17 '05 #2

P: n/a
.oO(ph*********@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
Jul 17 '05 #3

P: n/a
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.
Jul 17 '05 #4

P: n/a
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:<41***********************@news.wanadoo.nl>.. .
ph*********@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!

Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.