NYCPHP Meetup

NYPHP.org

[nycphp-talk] Help Request

Hans Zaunere zaunere at yahoo.com
Mon May 20 10:00:58 EDT 2002


There could be any number of problems, however I would start by looking
at the SQL that actually gets generated and try to clean things up a
bit.  Although this maybe not be helpful at all, I've attached a file
with some formatting/etc you may want to consider.

I personally dispise the "or die()" scheme (too Perly) so I've used
if() statements.  The real important things to consider is 1) I always
like to supply what connection handle I want to deal with - otherwise
things can get confusing if you have multiple database handles.  2) the
key for large SQL statements is to print it out and examine it if you
have problems.

Of course you may not need so many mysql_escape_string() calls,
depending on the data source, and you'll have to check that your column
types are all agreeable, DB perms, etc.

Hope this helps,

Hans Z.



<?php

if( $var2 == 'Return To Admin Home Page') {
   header('Location: index.htm');
   exit;

> <?php
> If ($var2=="Return To Admin Home Page"){
>         header("Location:index.htm");
>         exit;
> }elseif ($var1=="Modify Database"){
> 
>                 $connection = mysql_connect("localhost", "jwing",
> "xxxxxxxx")
>                         or die ("Couldn't connect to server.");
>                 
> 
>                 $db = mysql_select_db("jwing", $connection)
>                         or die ("Couldn't select database.");
> 
> $sql = "update jobs 
> set 
> KEYWORD1 = \\"$keyword1\\",
> KEYWORD2 = \\"$keyword2\\",
> KEYWORD3 = \\"$keyword3\\",
> KEYWORD4 = \\"$keyword4\\",
> KEYWORD5 = \\"$keyword5\\",
> COMP_ID = \\"$comp_id\\",
> SHOW_DATE = \\"$show_date\\",
> JOB_CAT = \\"$job_cat\\",
> JOB_LOC = \\"$job_loc\\",
> JOB_TITLE = \\"$job_title\\",
> JOB_DESC = \\"$job_desc\\",
> JOB_SALARY = \\"$job_salary\\",
> FIRST_NAME = \\"$first_name\\",
> LAST_NAME = \\"$last_name\\",
> AD_EMAIL = \\"$ad_email\\",
> CNTCT_EMAIL = \\"$cntct_email\\",
> USR_NAME = \\"$usr_name\\",
> P_WORD = \\"$p_word\\",
> AD_PHONE = \\"$ad_phone\\",
> CNTCT_PHONE = \\"$cntct_phone\\",
> AD_FAXPHONE = \\"$ad_faxphone\\",
> WEB_SITE = \\"$web_site\\",
> CCNAME = \\"$ccname\\",
> CCNUMBER = \\"$ccnumber\\",
> MONTHEXP = \\"$monthexp\\",
> YEAREXP = \\"$yearexp\\",
> CCTYPE = \\"$cctype\\",
> STREET1A = \\"$street1A\\",
> STREET2A = \\"$street2A\\",
> STREET3A = \\"$street3A\\",
> CC_CITY = \\"$cc_city\\",
> CC_STATE = \\"$cc_state\\",
> CC_ZIP = \\"$cc_zip\\",
> TRBLFONE = \\"$trblfone\\"
> where job_id = \\"$job_id\\"";
> 
> $sql_result = mysql_query($sql) or die (mysql_error());
> echo "
> <HTML>
> <HEAD>
> <TITLE></TITLE>
> </HEAD>
> <BODY background=\\"rimmabg.jpg\\">
> <FORM METHOD=\\"POST\\" ACTION=\\"jl2s1s.php\\">
> 
> <input name=\\"var1\\" value=\\"Return To Admin Home Page\\"
> Type=\\"submit\\">
> 
> </form>
> </BODY>
> </HTML>
> ";
> };
> ?>
> 


__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ptemp.txt
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20020520/4051642c/attachment.txt>


More information about the talk mailing list