NYCPHP Meetup

NYPHP.org

Mysql UPDATE Problem

Jerry Wing jwing at www.erols.com
Sat May 18 16:42:23 EDT 2002


Jeremy, I made that change and got this error message:

You have an error in your SQL syntax near ' SHOW_DATE = "", JOB_CAT = ,
JOB_LOC = "", JOB_TITLE = "",
JOB_DESC = "", ' at line 8.

  Jeremy here is my script for adding the original record to the
database.  Am I doing a automatic type conversion when I add the record
and is that messing up the UPDATE?
-----------------------------------------------------------------
<HTML>
<HEAD>
<TITLE></TITLE>
<META NAME="generator" CONTENT="">
</HEAD>
<BODY background="rimmabg.jpg">
<hr>
<h2 align="center">Manual Add - A - Job &nbsp;&nbsp;Add - A - Payment
Screen</h2>
<hr>
<p>

<FORM METHOD="POST" ACTION="jl1s.php">

<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver">
<tr><td>Company ID: </td><td>
<input type="text" name="aa" size="10"></td></tr>
</table>
<p>
<hr>

<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver"><TR><TD>

<table border="3" bordercolor="#66CCFF" cellspacing="7"
bgcolor="silver">
<tr><th><B>KEYWORD<br>#</B></th>
<th>WORD<BR>ENTRY</th>
</tr>

<tr><td>1</td>
<td><input type="text" name="a1" size="15"></td>
</TR>
<tr><td>2</td>
<td><input type="text" name="a2" size="15"></td>
</tr>
<tr><td>3</td>
<td><input type="text" name="a3" size="15"></td>
</tr>
<tr><td>4</td>
<td><input type="text" name="a4" size="15"></td>
</tr>
<tr><td>5</td>
<td><input type="text" name="a5" size="15"></td>
</tr>
</table>

<p>

<TD>


</TR>
</TABLE>
<p>
<p>
<hr>

<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver">
<tr><td>
Show Date: </td>
<td>
<input type="text" name="a6" size="8"><br>
</td>

<td>
Job Category: </td>
<td>
<input type="text" name="a7" size="3"><br>
</td>

<td>
Job Location: </td>
<td>
<input type="text" name="a8" size="3"><br>
</td></tr>
</table>
<p>
<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver">
<tr><td>
Job Title:</td>
<td>
<input type="text" name="a9" size="80"><br>
</td></tr>
</table>
<p>
<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver">
<tr><td>
Job Description:</td>
<td>
<textarea name="jobdesc" rows="40" cols="60" wrap="hard"> </textarea>
</td></tr>
</table>
<p>


<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver">
<tr><td>
<table border="3" bordercolor="#66CCFF" cellspacing="7"
bgcolor="silver">
<tr><td>
Job Salary:</td>
<td>
<input type="text" name="a10" size="11"><br>
</td></tr>
</table>
</td>
<td>
<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver">
<tr><td>
Ad Expire:</td>
<td>
<input type="text" name="a11" size="8"><br>
</td></tr>
</table>
</td></tr>
</table>
<p>

<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver">
<tr><td>
<table border="3" bordercolor="#66CCFF" cellspacing="7"
bgcolor="silver">
<tr><td>
First Name:</td>
<td>
<input type="text" name="a12" size="40"><br>
</td></tr>
</table>
</td>
</tr>
<tr>
<td>
<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver">
<tr><td>
Last Name:</td>
<td>
<input type="text" name="a13" size="40"><br>
</td></tr>
</table>
</td></tr>
</table>

<p>

<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver">
<tr><td>
<table border="3" bordercolor="#66CCFF" cellspacing="7"
bgcolor="silver">
<tr><td>
E-Mail For Job Ad:</td>
<td>
<input type="text" name="a14" size="40"><br>
</td></tr>
</table>
</td>
</tr>
<tr>
<td>
<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver">
<tr><td>
Private Contact E-Mail:</td>
<td>
<input type="text" name="a15" size="40"><br>
</td></tr>
</table>
</td></tr>
</table>

<p>

<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver">
<tr><td>
<table border="3" bordercolor="#66CCFF" cellspacing="7"
bgcolor="silver">
<tr><td>
User Name:</td>
<td>
<input type="text" name="a16" size="15"><br>
</td></tr>
</table>
</td>
</tr>
<tr>
<td>
<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver">
<tr><td>
Password:</td>
<td>
<input type="text" name="a17" size="15"><br>
</td></tr>
</table>
</td></tr>
</table>


<p>

<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver">
<tr><td>
<table border="3" bordercolor="#66CCFF" cellspacing="7"
bgcolor="silver">
<tr><td>
Advertisement Phone No.:</td>
<td>
<input type="text" name="a18" size="12"><br>
</td>
</table>
</td>


<td>
<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver">
<td>
Private Contact Phone No.:</td>
<td>
<input type="text" name="a19" size="12"><br>
</td>
</table>
</td>
<td>
<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver">
<td>
Advertisement Fax Phone No.:</td>
<td>
<input type="text" name="a20" size="12"><br>
</td>
</table>
</td></tr>
</table>
<P>


<table border="3" bordercolor="#66CCFF" cellspacing="7" align="center"
bgcolor="silver">
<tr><td>
Web Site:</td>
<td>
<input type="text" name="a21" size="50"><br>
</td>
</table>

<hr>
<h3 align="center">Credit Card Information</h3>
<hr>
<p>

<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver"><TR><TD>
Name On Card:</td>
<td><input type="text" name="a22" size="70"></td></tr>
</table>
<p>
<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver"><TR><TD>
Credit Card Number:</td>
<td><input type="text" name="a23" size="30"></td></tr>
</table>
<p>

<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver"><TR><TD>

<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver"><TR><TD>
Expiration Month:</td>
<td><input type="text" name="a24" size="2"></td></tr>
</table>
<p>
</td>
<td>
<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver"><TR><TD>
Expiration Year:</td>
<td><input type="text" name="a25" size="2"></td></tr>
</table>
<p>
</td>
<td>
<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver"><TR><TD>
(V)isa,(M)astercard,(A)merican Express:</td>
<td><input type="text" name="a26" size="2"></td></tr>
</table>
<p>
</td>
</tr>
</table>
<p>
<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver"><TR><TD>
Street 1:</td>
<td><input type="text" name="a27" size="80"></td></tr>
</table>
<p>

<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver"><TR><TD>
Street 2:</td>
<td><input type="text" name="a28" size="80"></td></tr>
</table>
<p>

<table border="3" bordercolor="#66CCFF" cellspacing="7" align="center"
bgcolor="silver"><TR><TD>
Street 3:</td>
<td><input type="text" name="a29" size="80"></td></tr>
</table>
<p>

<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver"><TR><TD>

<table border="3" bordercolor="#66CCFF" cellspacing="7"
bgcolor="silver"><TR><TD>
City:</td>
<td><input type="text" name="a30" size="40"></td></tr>
</table>
</td>
<td>
<table border="3" bordercolor="#66CCFF" cellspacing="7"
bgcolor="silver"><TR><TD>
State:</td>
<td><input type="text" name="a31" size="2"></td></tr>
</table>
</td>
<td>
<table border="3" bordercolor="#66CCFF" cellspacing="7"
bgcolor="silver"><TR><TD>
Zipcode:</td>
<td><input type="text" name="a32" size="10"></td></tr>
</table>
</td>
</tr>
</table>
<p>

<table border="3" bordercolor="#66CCFF" cellspacing="7" align="center"
bgcolor="silver"><TR><TD>

<table border="3" bordercolor="#66CCFF" cellspacing="7"
bgcolor="silver"><TR><TD>
Telephone:</td>
<td><input type="text" name="a33" size="12"></td></tr>
</table>
</td>

</tr>
</table>

<p>
<hr>

<input name="var1" value="Add To Database" Type="submit">
<p>
<input name="var2" value="Return To Admin Home Page" Type="submit">
<p>

</form>
</BODY>
</HTML><HTML>
<HEAD>
<TITLE></TITLE>
<META NAME="generator" CONTENT="">
</HEAD>
<BODY background="rimmabg.jpg">
<hr>
<h2 align="center">Manual Add - A - Job &nbsp;&nbsp;Add - A - Payment
Screen</h2>
<hr>
<p>

<FORM METHOD="POST" ACTION="jl1s.php">

<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver">
<tr><td>Company ID: </td><td>
<input type="text" name="aa" size="10"></td></tr>
</table>
<p>
<hr>

<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver"><TR><TD>

<table border="3" bordercolor="#66CCFF" cellspacing="7"
bgcolor="silver">
<tr><th><B>KEYWORD<br>#</B></th>
<th>WORD<BR>ENTRY</th>
</tr>

<tr><td>1</td>
<td><input type="text" name="a1" size="15"></td>
</TR>
<tr><td>2</td>
<td><input type="text" name="a2" size="15"></td>
</tr>
<tr><td>3</td>
<td><input type="text" name="a3" size="15"></td>
</tr>
<tr><td>4</td>
<td><input type="text" name="a4" size="15"></td>
</tr>
<tr><td>5</td>
<td><input type="text" name="a5" size="15"></td>
</tr>
</table>

<p>

<TD>


</TR>
</TABLE>
<p>
<p>
<hr>

<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver">
<tr><td>
Show Date: </td>
<td>
<input type="text" name="a6" size="8"><br>
</td>

<td>
Job Category: </td>
<td>
<input type="text" name="a7" size="3"><br>
</td>

<td>
Job Location: </td>
<td>
<input type="text" name="a8" size="3"><br>
</td></tr>
</table>
<p>
<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver">
<tr><td>
Job Title:</td>
<td>
<input type="text" name="a9" size="80"><br>
</td></tr>
</table>
<p>
<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver">
<tr><td>
Job Description:</td>
<td>
<textarea name="jobdesc" rows="40" cols="60" wrap="hard"> </textarea>
</td></tr>
</table>
<p>


<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver">
<tr><td>
<table border="3" bordercolor="#66CCFF" cellspacing="7"
bgcolor="silver">
<tr><td>
Job Salary:</td>
<td>
<input type="text" name="a10" size="11"><br>
</td></tr>
</table>
</td>
<td>
<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver">
<tr><td>
Ad Expire:</td>
<td>
<input type="text" name="a11" size="8"><br>
</td></tr>
</table>
</td></tr>
</table>
<p>

<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver">
<tr><td>
<table border="3" bordercolor="#66CCFF" cellspacing="7"
bgcolor="silver">
<tr><td>
First Name:</td>
<td>
<input type="text" name="a12" size="40"><br>
</td></tr>
</table>
</td>
</tr>
<tr>
<td>
<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver">
<tr><td>
Last Name:</td>
<td>
<input type="text" name="a13" size="40"><br>
</td></tr>
</table>
</td></tr>
</table>

<p>

<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver">
<tr><td>
<table border="3" bordercolor="#66CCFF" cellspacing="7"
bgcolor="silver">
<tr><td>
E-Mail For Job Ad:</td>
<td>
<input type="text" name="a14" size="40"><br>
</td></tr>
</table>
</td>
</tr>
<tr>
<td>
<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver">
<tr><td>
Private Contact E-Mail:</td>
<td>
<input type="text" name="a15" size="40"><br>
</td></tr>
</table>
</td></tr>
</table>

<p>

<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver">
<tr><td>
<table border="3" bordercolor="#66CCFF" cellspacing="7"
bgcolor="silver">
<tr><td>
User Name:</td>
<td>
<input type="text" name="a16" size="15"><br>
</td></tr>
</table>
</td>
</tr>
<tr>
<td>
<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver">
<tr><td>
Password:</td>
<td>
<input type="text" name="a17" size="15"><br>
</td></tr>
</table>
</td></tr>
</table>


<p>

<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver">
<tr><td>
<table border="3" bordercolor="#66CCFF" cellspacing="7"
bgcolor="silver">
<tr><td>
Advertisement Phone No.:</td>
<td>
<input type="text" name="a18" size="12"><br>
</td>
</table>
</td>


<td>
<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver">
<td>
Private Contact Phone No.:</td>
<td>
<input type="text" name="a19" size="12"><br>
</td>
</table>
</td>
<td>
<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver">
<td>
Advertisement Fax Phone No.:</td>
<td>
<input type="text" name="a20" size="12"><br>
</td>
</table>
</td></tr>
</table>
<P>


<table border="3" bordercolor="#66CCFF" cellspacing="7" align="center"
bgcolor="silver">
<tr><td>
Web Site:</td>
<td>
<input type="text" name="a21" size="50"><br>
</td>
</table>

<hr>
<h3 align="center">Credit Card Information</h3>
<hr>
<p>

<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver"><TR><TD>
Name On Card:</td>
<td><input type="text" name="a22" size="70"></td></tr>
</table>
<p>
<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver"><TR><TD>
Credit Card Number:</td>
<td><input type="text" name="a23" size="30"></td></tr>
</table>
<p>

<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver"><TR><TD>

<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver"><TR><TD>
Expiration Month:</td>
<td><input type="text" name="a24" size="2"></td></tr>
</table>
<p>
</td>
<td>
<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver"><TR><TD>
Expiration Year:</td>
<td><input type="text" name="a25" size="2"></td></tr>
</table>
<p>
</td>
<td>
<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver"><TR><TD>
(V)isa,(M)astercard,(A)merican Express:</td>
<td><input type="text" name="a26" size="2"></td></tr>
</table>
<p>
</td>
</tr>
</table>
<p>
<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver"><TR><TD>
Street 1:</td>
<td><input type="text" name="a27" size="80"></td></tr>
</table>
<p>

<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver"><TR><TD>
Street 2:</td>
<td><input type="text" name="a28" size="80"></td></tr>
</table>
<p>

<table border="3" bordercolor="#66CCFF" cellspacing="7" align="center"
bgcolor="silver"><TR><TD>
Street 3:</td>
<td><input type="text" name="a29" size="80"></td></tr>
</table>
<p>

<table border="3" bordercolor="#66CCFF" cellspacing="7"align="center"
bgcolor="silver"><TR><TD>

<table border="3" bordercolor="#66CCFF" cellspacing="7"
bgcolor="silver"><TR><TD>
City:</td>
<td><input type="text" name="a30" size="40"></td></tr>
</table>
</td>
<td>
<table border="3" bordercolor="#66CCFF" cellspacing="7"
bgcolor="silver"><TR><TD>
State:</td>
<td><input type="text" name="a31" size="2"></td></tr>
</table>
</td>
<td>
<table border="3" bordercolor="#66CCFF" cellspacing="7"
bgcolor="silver"><TR><TD>
Zipcode:</td>
<td><input type="text" name="a32" size="10"></td></tr>
</table>
</td>
</tr>
</table>
<p>

<table border="3" bordercolor="#66CCFF" cellspacing="7" align="center"
bgcolor="silver"><TR><TD>

<table border="3" bordercolor="#66CCFF" cellspacing="7"
bgcolor="silver"><TR><TD>
Telephone:</td>
<td><input type="text" name="a33" size="12"></td></tr>
</table>
</td>

</tr>
</table>

<p>
<hr>

<input name="var1" value="Add To Database" Type="submit">
<p>
<input name="var2" value="Return To Admin Home Page" Type="submit">
<p>

</form>
</BODY>
</HTML>

then the second script, Jeremy:
----------------------------------------------------------------

<?php
If ($var2=="Return To Admin Home Page"){
	header("Location:index.htm");
	exit;
}elseif ($var1=="Add To Database"){
}
?>
<HTML>
<HEAD>
<TITLE></TITLE>
<META NAME="generator" CONTENT="">
</HEAD>
<BODY background="rimmabg.jpg">
<FORM METHOD="POST" ACTION="jl1s1.php">

<?PHP
// Connect to the server
 $dbcnx = @mysql_connect("localhost", "jwing", "athens");
if (!$dbcnx) {
  echo( "<p>Unable to connect to the " .
  "cedar server at this time.</p>" );
  exit();
}

// Select the jwing database
if (! @mysql_select_db("jwing") ) {
  echo( "<p>Unable to locate the  " .
  "jwing database at this time.</p >" );
   exit();
}

$sql = "insert into jobs
(keyword1,keyword2,keyword3,keyword4,keyword5,comp_id,show_date,job_cat,job_loc,job_title,job_desc,job_salary,ad_expire,first_name,last_name,ad_email,cntct_email,usr_name,p_word,ad_phone,cntct_phone,ad_faxphone,web_site,ccname,ccnumber,
monthexp,yearexp,cctype,street1A,street2A,street3A,cc_city,cc_state,cc_zip,trblfone) 
values
('$a1','$a2','$a3','$a4','$a5','$aa','$a6','$a7','$a8','$a9','$jobdesc','$a10','$a11','$a12','$a13','$a14','$a15','$a16','$a17','$a18','$a19','$a20','$a21','$a22','$a23','$a24','$a25','$a26','$a27','$a28','$a29','$a30','$a31','$a32','$a33')";

$sql_result = mysql_query ($sql,$dbcnx) or die ("Couldn't execute
query")


?>

<input name="var1" value="Return To Admin Home Page" Type="submit">
</form>
</BODY>
</HTML>

---------------------------------------------------------------

I have posted the column types in my earlier post, and I have changed
the script, Jeremy, like you showed me to do, and my question is whether
when I add data to the data base I am doing an automatic type
conversion....Second question: should i change all the columns in the
table to varchar or char since i am not doing any math with the
thing)))))... Thanks for being patient, Jeremy.



More information about the talk mailing list