Re: i swear on a stack of bibles ....
| From: | Brian Neal | Date: | Sat, 10 Jun 2000 02:10:09 +0000 |
| Subject: | Re: i swear on a stack of bibles .... | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-302@lists.php.net to get a copy of this message | ||
Hi Kenn,
I think I'll be ok without the beer, but let's see if we can solve this problem
first. ;)
Two things I noticed...first, $salesperson_email is uninitialized unless you are
getting it from somewhere else (passed in on the URI, for example). I assume
that's not the case, however, and that you want to retrieve the value from your
recent query. So:
$salesperson_email = $row[("salesperson_email")];
Now the following should work:
<input type="hidden"
name="salesperson_email"
value="<?php print $salesperson_email;?>">
The other problem I noticed may not really be a problem, but some databases
don't like it nevertheless:
$sql = "update job_info
set production_status='$production_status',
job_number='$job_number'
where job_number = $job_number" ;
You have quotes around $job_number as if it is a character datatype...but you
don't have those quotes in your where clause, so I assume its a numeric
datatype. MySQL may ignore the quotes, but if it doesn't, you will need to
remove them.
Good luck,
-Brian Neal
>From: "Kenn Murrah" <warden@bakergrfx.com>
>To: <php-db@lists.php.net>
>Date: Fri, 9 Jun 2000 14:21:37 -0500
>MIME-Version: 1.0
>Subject: i swear on a stack of bibles ....
>
>I swear I'll never bother you with a newbie question like this again,
>but this is truly driving me nuts !!!
>
>In this example, I've read the salesperson_email from my database
>and can get it to print successfully... then I update the information
>and write to another file and cannot get it to carry over the salesperson_email
>to the next file to save my life.
>
>BRIBE: If you live close enough, I'll buy you a case of beer for your help. If
not, I'll
>be your friend forever .... no, really !!
>
>first file:
><?php
>mysql_connect ("localhost","root");
>mysql_select_db ("bakergrfx");
>
>
>$result = mysql_query("SELECT customer.customer_code, customer_name,
salespersons.salesperson_code,
> salesperson_name, job_number, salesperson_email, csr_email from job_info,
salespersons, customer
>where customer.salesperson_code=salespersons.salesperson_code and
>job_info.customer_code=customer.customer_code and
>job_number = '$job_number'");
>
>
>if ($row = mysql_fetch_array($result))
>{ do { print $row["customer_code"];
>print (" ");print (" ");print (" ");
>print $row["customer_name"];print ("<p>");
>print $row["job_number"];print (" "); print
>$row[("salesperson_email")];
>print ("<p>"); }
>
>while($row = mysql_fetch_array($result)); } else {print "Sorry, no records were
found!";}
>
>?>
> <form method=get action=preflight_3.php>
>
><input type="hidden" name="job_number" value="<?php print
>$job_number;?>">
><input type="hidden" name="salesperson_email" value="<?php print
$salesperson_email;?>">
><input type="hidden" name="csr_email" value="<?php print
>$csr_email;?>">
>
><?php
>$salesperson_email=$row[("salesperson_email")];
>echo "$salesperson_email";
>print $row[("salesperson_email")];
>?>
> <p> UPDATE STATUS:
> <select name="production_status">
> <option>Preflight OK</option>
> <option>PROBLEMS--Fonts Missing</option>
> <option>PROBLEMS--Graphics Missing</option>
> <option>PROBLEMS--Planning Issues</option>
> <option>PROBLEMS--Multiple Preflight/Planning Issues</option>
> </select><P>
>
><textarea name="comments" cols="50"
>rows="9"></textarea>
> <input type=submit>
></body>
></html>
>
>
>second file:
>
><html>
>
><head>
>
><title>
>
>Job Entry</title></head>
>
><body>
>
><?php
>
>echo "$salesperson_email";
>
>mysql_connect ("localhost","root");
>
>mysql_select_db ("bakergrfx");
>
>$sql = "update job_info set
production_status='$production_status',job_number='$job_number' where job_number
= $job_number" ;
>
>$result = mysql_query($sql) or die("cannot execute query");
>
>$subject = "$job_number" . "$production_status";
>
>mail("$salesperson_email", "$subject", "$comments", "From:
>Preflight\n");
>
>$sql = "insert into preflight_activity
(preflight_status,job_number,preflight_comments) values('$production_status',
'$job_number', '$comments')" ;
>
>$result = mysql_query($sql) or die("cannot execute");
>
>
>
>
>
>
>
>?>
>
></form> </body> </html>
>
>
>
>THanks again...
>
>Kenn
>
>
>