Help Please :)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kurt A. Kaylor

    Help Please :)

    Hey, I am trying to get some code I have written to work. Runs well
    until I make a request. The I get some problems with PHP related to an
    SQL statement. Here are the errors :Warning: mysql_result(): supplied
    argument is not a valid MySQL result resource in c:\program
    files\apache group\apache\ht docs\veiworderf orm.php on line 25 (error
    goes to 76)

    Here is the code, any help that can be offered would be great. THANKS
    A TON !!

    <?php
    $page_title = 'Webflexo.com -Order Form';
    $page_mark = 'Order Form';

    ?>


    <body bgcolor="#00996 6">
    <div align="center"> <br>
    <table width="799" border="0" ="1" cellspacing="0"
    bgcolor="#aaaaa a">
    <tr>
    <td>
    <table width="100%" border="0" bgcolor="#FFFFC C">
    <tr>
    <td> <div align="center">

    <?php
    $po = $_POST['po'];
    if ($submitone) {
    $db = mysql_connect(" localhost");
    mysql_select_db ("webgraphics", $db);
    $sql = "select * from orderform where po = $po";
    $result = mysql_query($sq l);

    $billcompany = mysql_result($r esult,0,billcom pany);
    $billaddress = mysql_result($r esult,0,billadd ress);
    $billcity = mysql_result($r esult,0,billcit y);
    $billstate = mysql_result($r esult,0,billsta te);
    $billzip = mysql_result($r esult,0,billzip );
    $billorder = mysql_result($r esult,0,billord er);
    $billphone = mysql_result($r esult,0,billpho ne);
    $billfax = mysql_result($r esult,0,billfax );
    $shipcompany = mysql_result($r esult,0,shipcom pany);
    $shipaddress = mysql_result($r esult,0,shipadd ress);
    $shipcity = mysql_result($r esult,0,shipcit y);
    $shipstate = mysql_result($r esult,0,shipsta te);
    $shipzip = mysql_result($r esult,0,shipzip );
    $shiporder = mysql_result($r esult,0,shipord er);
    $shipphone = mysql_result($r esult,0,shippho ne);
    $shipfax = mysql_result($r esult,0,shipfax );
    $dateneed = mysql_result($r esult,0,datenee d);
    $description = mysql_result($r esult,0,descrip tion);
    $proofneed = mysql_result($r esult,0,proofne ed);
    $proof = mysql_result($r esult,0,proof);
    $proofemail = mysql_result($r esult,0,email);
    $prooflaser = mysql_result($r esult,0,proofla ser);
    $proofcolor = mysql_result($r esult,0,proofco lor);
    $laserproof = mysql_result($r esult,0,laserpr oof);
    $dyluxproof = mysql_result($r esult,0,dyluxpr oof);
    $matchprintproo f = mysql_result($r esult,0,matchpr intproof);
    $colorkeyproof = mysql_result($r esult,0,colorke yproof);
    $faxproof = mysql_result($r esult,0,faxproo f);
    $colornumber = mysql_result($r esult,0,colornu mber);
    $proofnumber = mysql_result($r esult,0,proofnu mber);
    $film = mysql_result($r esult,0,film);
    $thickness = mysql_result($r esult,0,thickne ss);
    $platematerial = mysql_result($r esult,0,platema terial);
    $cylinderdirect ion = mysql_result($r esult,0,cylinde rdirection);
    $cut = mysql_result($r esult,0,cut);
    $gear = mysql_result($r esult,0,gear);
    $pitch = mysql_result($r esult,0,pitch);
    $distort = mysql_result($r esult,0,distort );
    $cornerradius = mysql_result($r esult,0,cornerr adius);
    $reapeatcylinde r = mysql_result($r esult,0,reapeat cylinder);
    $totalcolors = mysql_result($r esult,0,totalco lors);
    $totalplates = mysql_result($r esult,0,totalpl ates);
    $imagedimesiont wo = mysql_result($r esult,0,imagedi mesiontwo);
    $imagedimension one = mysql_result($r esult,0,imagedi mensionone);
    $ar = mysql_result($r esult,0,ar);
    $ac = mysql_result($r esult,0,ac);
    $gapac = mysql_result($r esult,0,gapac);
    $gapar = mysql_result($r esult,0,gapar);
    $tooth = mysql_result($r esult,0,tooth);
    $returndisk = mysql_result($r esult,0,returnd isk);
    $returnart = mysql_result($r esult,0,returna rt);
    $instructions = mysql_result($r esult,0,instruc tions);
    ?>
    <h1 align="center"> <strong>Web Graphics Online Order
    Form</strong></h1>
    </title><div align="center">
    <table width="100%" height="30" border="0"
    cellpadding="2" cellspacing="0" >
    <tr bgcolor="#99999 9">

    <td width="50%"><st rong>BILL TO:</strong></td>

    <td width="50%" colspan="2"><st rong>SHIP
    TO:</strong> </td>
    </tr>
    <tr bgcolor="#CCCCC C">

    <td>Company Name:

    <input type="text" id="billcompany 2"
    value="$billcom pany">
    </td>

    <td colspan="2">Com pany Name:

    <input type="text" id="shipcompany 2"
    value="$shipcom pany"></td>
    </tr>
    <tr bgcolor="#CCCCC C">

    <td>Address:

    <input type="text" id="billaddress 2"
    value="$billadd ress"></td>

    <td colspan="2">Add ress:

    <input type="text" id="shipaddress 2"
    value="$shipadd ress"></td>
    </tr>
    <tr bgcolor="#CCCCC C">

    <td>
    <p>City:
    <input type="text" id="billcity2"
    value="$billcit y" size="20">
    State :
    <input type="text" id="billstate2 "
    value="$billsta te" size="2">
    Zip:
    <input type="text" id="billzip2"
    value="$billzip " size="9">
    </p></td>

    <td colspan="2">
    <p>City:
    <input type="text" id="shipcity2"
    value="$shipcit y" size="20">
    State :
    <input type="text" id="shipstate2 "
    value="$shipsta te" size="2">
    Zip:
    <input type="text" id="shipzip2"
    value="$shipzip " size="9">
    </p></td>
    </tr>
    <tr bgcolor="#CCCCC C">

    <td>Ordered By:

    <input type="text" id="billorder2 "
    value="$billord er"></td>

    <td colspan="2">Ord ered By:

    <input type="text" id="shiporder2 "
    value="$shipord er"></td>
    </tr>
    <tr bgcolor="#CCCCC C">

    <td>Phone:

    <input type="text" id="billphone2 "
    value="$billpho ne" size="9">
    Fax:

    <input type="text" id="billfax2"
    value="$billfax " size="9"> </td>

    <td colspan="2">Pho ne:

    <input type="text" id="shipphone2 "
    value="$shippho ne" size="9">
    Fax:

    <input type="text" id="shipfax2"
    value="$shipfax " size="9"></td>
    </tr>
    <tr bgcolor="#99999 9">
    <td colspan="3">&nb sp;</td>
    </tr>
    <tr bgcolor="#CCCCC C">

    <td colspan="3">P.O .# :

    <input type="text" id="po2" value="$po">
    Description:

    <input type="text" id="description 2"
    value="$descrip tion" size="50">
    </td>
    </tr>
    <tr bgcolor="#99999 9">
    <td colspan="3">&nb sp;</td>
    </tr>
    </table>
    <table width="100%" height="30" border="0"
    cellpadding="2" cellspacing="0" >
    <tr bgcolor="#99999 9">

    <td width="50%" colspan="2" bgcolor="#CCCCC C">Date
    Needed
    By: <em> (YYYY-MM-DD) </em> <input type="text"
    value="$datenee d" size="20"></td>

    <td width="50%" colspan="2"
    bgcolor="#CCCCC C">Proof Needed
    By: <em>(YYYY-MM-DD)</em> <input type="text"
    id="proofneed2 " value="$proofne ed" size="20">
    </td>
    </tr>
    <tr bgcolor="#CCCCC C">

    <td colspan="2" bgcolor="#99999 9"><strong>Proo fs
    Before
    Plates:
    <label> </label>
    <label> </label>
    </strong> <label>

    <input <?php if (!(strcmp("$pro of","Yes")))
    {echo "CHECKED";} ?> type="radio" name="proof" value="Yes">
    Yes</label>
    <input <?php if (!(strcmp("$pro of","No")))
    {echo "CHECKED";} ?> type="radio" name="proof" value="No">
    <label>No</label> </td>
    <td colspan="2" bgcolor="#99999 9">&nbsp;</td>
    </tr>
    <tr bgcolor="#CCCCC C">

    <td>
    <label>

    <input <?php if (!(strcmp("$ema ilproof","Yes") ))
    {echo "checked";} ?> name="emailproo f" type="checkbox"
    id="emailproof2 " value="Yes">
    E-Mail</label></td>

    <td> <input <?php if
    (!(strcmp("$fax proof","Yes"))) {echo "checked";} ?> name="faxproof"
    type="checkbox" id="faxproof2" value="Yes">
    Fax</td>

    <td colspan="2">Num ber of Colors:

    <input type="text" id="colornumber 2"
    value="$colornu mber"></td>
    </tr>
    <tr bgcolor="#CCCCC C">

    <td>
    <input <?php if (!(strcmp("$las erproof","Yes") )) {echo "checked";} ?>
    name="laserproo f" type="checkbox" id="laserproof2 " value="Yes">
    Laser</td>

    <td>
    <input <?php if (!(strcmp("$col orlaserproof"," Yes"))) {echo
    "checked";} ?> name="colorlase rproof" type="checkbox"
    id="colorlaserp roof2" value="Yes">
    Color Laser</td>

    <td colspan="2">Num ber of Proofs:

    <input type="text" id="proofnumber 2"
    value="$proofnu mber"></td>
    </tr>
    <tr bgcolor="#CCCCC C">

    <td>
    <label> </label>
    <input <?php if (!(strcmp("$dyl uxproof","Yes") ))
    {echo "checked";} ?> name="dyluxproo f" type="checkbox"
    id="dyluxproof2 " value="Yes">
    Dylux</td>

    <td>
    <input <?php if (!(strcmp("$mat chprintproof"," Yes"))) {echo
    "checked";} ?> name="matchprin tproof" type="checkbox"
    id="matchprintp roof2" value="Yes">
    Match Print</td>

    <td colspan="2">Fil m:

    <input type="text" id="film2"
    value="$film"></td>
    </tr>
    <tr bgcolor="#CCCCC C">

    <td colspan="4">
    <input <?php if (!(strcmp("$col orkeyproof","Ye s"))) {echo "checked";}
    ?> name="colorkeyp roof" type="checkbox" id="colorkeypro of2"
    value="Yes">
    Color Key</td>
    </tr>
    <tr bgcolor="#CCCCC C">

    <td colspan="4">
    <div align="center">
    <table width="100%" border="0"
    cellpadding="0" >
    <tr bgcolor="#99999 9">

    <td width="33%"><st rong>Plate
    Material:</strong></td>

    <td width="33%"><st rong>Step &amp;
    Reapeat</strong></td>
    <td width="33%">&nb sp;</td>
    </tr>
    </table>
    <table width="100%" border="0"
    cellpadding="0" cellspacing="0" >
    <!--DWLayoutTable-->
    <tr>

    <td width="32%" valign="top"> <p>
    <label>
    <input <?php if
    (!(strcmp("$pla tematerial","PQ S"))) {echo "CHECKED";} ?> type="radio"
    name="platemate rial" value="PQS">
    PQS</label>
    <br>
    <label>
    <input <?php if
    (!(strcmp("$pla tematerial","HO S"))) {echo "CHECKED";} ?> type="radio"
    name="platemate rial" value="HOS">
    HOS</label>
    <br>
    <label>
    <input <?php if
    (!(strcmp("$pla tematerial","EX L"))) {echo "CHECKED";} ?> type="radio"
    name="platemate rial" value="EXL">
    EXL</label>
    <br>
    <label>
    <input <?php if
    (!(strcmp("$pla tematerial","UX L"))) {echo "CHECKED";} ?> type="radio"
    name="platemate rial" value="UXL">
    UXL</label>
    <br>
    <label>
    <input <?php if
    (!(strcmp("$pla tematerial","TD R"))) {echo "CHECKED";} ?> type="radio"
    name="platemate rial" value="TDR">
    TDR</label>
    </p>
    <p>
    <label></label>
    <label>

    <input <?php if
    (!(strcmp("$pla tematerial","Ep ic"))) {echo "CHECKED";} ?> type="radio"
    name="platemate rial" value="Epic">

    Epic</label>
    <br>
    <label>

    <input <?php if
    (!(strcmp("$pla tematerial","At las"))) {echo "CHECKED";} ?>
    type="radio" name="platemate rial" value="Atlas">

    Atlas </label>
    <br>
    <label>

    <input <?php if
    (!(strcmp("$pla tematerial","Fl excor"))) {echo "CHECKED";} ?>
    type="radio" name="platemate rial" value="Flexcor" >

    Flexcor</label>
    <br>
    <label>

    <input <?php if
    (!(strcmp("$pla tematerial","Bl ue"))) {echo "CHECKED";} ?> type="radio"
    name="platemate rial" value="Blue">

    Blue</label>
    <br>
    <label>
    <input <?php if
    (!(strcmp("$pla tematerial","Ko r"))) {echo "CHECKED";} ?> type="radio"
    name="platemate rial" value="Kor">
    Kor </label>
    <br>
    <label> Other </label>

    <input type="text" id="platemateri al2"
    value="$platema terial" size="20">
    <br>
    </p>
    <p align="left"> Thickness:</p>
    <p align="left">
    <label>

    <input <?php if
    (!(strcmp("$thi ckness","067")) ) {echo "CHECKED";} ?> type="radio"
    name="thickness " value="067">
    067</label>
    <br>
    <label>

    <input <?php if
    (!(strcmp("$thi ckness","107")) ) {echo "CHECKED";} ?> type="radio"
    name="thickness " value="107">
    107</label>
    <br>
    <label>

    <input <?php if
    (!(strcmp("$thi ckness","187")) ) {echo "CHECKED";} ?> type="radio"
    name="thickness " value="187">
    187</label>
    <br>
    <label> Other

    <input type="text" id="thickness2 "
    value="$thickne ss" size="20">
    </label>
    </p>
    <p align="left">Pl ate Direction Around
    Cylinder:</p>
    <p align="left">
    <label>

    <input <?php if
    (!(strcmp("$cyl inderdirection" ,"Left To Right"))) {echo "CHECKED";} ?>
    type="radio" name="cylinderd irection" value="Left To Right">
    Left To Right</label>
    <br>
    <label>
    <input <?php if
    (!(strcmp("$cyl inderdirection" ,"Top To Bottom"))) {echo "CHECKED";} ?>
    type="radio" name="cylinderd irection" value="Top To Bottom">
    Top To Bottom</label>
    <br>
    <label> Other</label>

    <input type="text"
    id="cylinderdir ection2" value="$cylinde rdirection" size="20">
    </p>
    <p align="left"></p></td>
    <td width="5">&nbsp ;</td>
    <td width="32%" valign="top">
    <p align="left">
    <label> </label>
    <label>

    <input <?php if (!(strcmp("$cut ","Die
    Cut"))) {echo "CHECKED";} ?> type="radio" name="cut" value="Die Cut">
    Die Cut</label>
    <br>
    <label>
    <input <?php if
    (!(strcmp("$cut ","Butt Cut"))) {echo "CHECKED";} ?> type="radio"
    name="cut" value="Butt Cut">
    Butt Cut</label>
    <br>
    <label> Other</label>

    <input type="text" id="cut2"
    value="$cut" size="20">
    </p>
    <p>Gear Pitch: </p>
    <p align="left">
    <label>

    <input <?php if (!(strcmp("$gea r","1/8
    CP"))) {echo "CHECKED";} ?> type="radio" name="gear" value="1/8 CP">
    1/8 CP</label>
    <br>
    <label>

    <input <?php if (!(strcmp("$gea r","32
    DP"))) {echo "CHECKED";} ?> type="radio" name="gear" value="32 DP">
    32 DP</label>
    <br>
    <label>
    <input <?php if
    (!(strcmp("$gea r","10 MIL"))) {echo "CHECKED";} ?> type="radio"
    name="gear" value="10 MIL">
    10 MIL</label>
    </p>
    <p align="left">Di stort Plate:
    <label> </label>
    </p>
    <p align="left">
    <label>

    <input <?php if
    (!(strcmp("$dis tort","Yes"))) {echo "CHECKED";} ?> type="radio"
    name="distort" value="Yes">
    Yes</label>
    <br>
    <label>
    <input <?php if
    (!(strcmp("$dis tort","No"))) {echo "CHECKED";} ?> type="radio"
    name="distort" value="No">
    No</label>
    </p>
    <p align="left">Co rner Radius:

    <input type="text" id="cornerradiu s2"
    value="$cornerr adius" size="8">
    </p>
    <p align="left">Cy linder Repeat:

    <input type="text"
    id="reapeatcyli nder2" value="$reapeat cylinder" size="8">
    </p></td>
    <td width="5">&nbsp ;</td>
    <td width="32%" valign="top"> <p> Total
    Number of
    Colors :

    <input type="text" id="totalcolors 2"
    value="$totalco lors" size="8">
    </p>
    <p>Total Number of Plates :

    <input type="text" id="totalplates 2"
    value="$totalpl ates" size="8">
    </p>
    <p>Image Size:

    <input type="text"
    id="imagedimens ionone2" value="$imagedi mensionone" size="8">
    <font size="-1"> x</font>

    <input type="text"
    id="imagedimesi ontwo2" value="$imagedi mesiontwo" size="8">
    </p>
    <p><font size="-1">AR:</font>

    <input type="text" id="ar2"
    value="$ar" size="20">
    </p>
    <p> <font size="-1">AC:

    <input type="text" id="ac2"
    value="$ac" size="20">
    </font></p>
    <p><font size="-1">Gap AC:

    <input type="text" id="gapac2"
    value="$gapac" size="20">
    </font></p>
    <p><font size="-1">Gap AR:</font>
    <font size="-1">

    <input type="text" id="gapar2"
    value="$gapar" size="20">
    </font></p>
    <p>Tooth:

    <input type="text" id="tooth2"
    value="$tooth" size="20">
    </p>
    <p><font size="-1">

    <input <?php if
    (!(strcmp("$ret urndisk","Yes") )) {echo "checked";} ?>
    name="returndis k" type="checkbox" id="returndisk2 " value="Yes">
    Return Customer Disk <br>
    </font><font size="-1">

    <input <?php if
    (!(strcmp("$ret urnart","$Yes") )) {echo "checked";} ?> name="returnart "
    type="checkbox" id="returnart2 " value="Yes">
    Return Customer Art</font> </p>
    <p>Additional Instructions:

    <textarea cols="25" rows="4"
    id="textarea">$ instructions</textarea>
    </p></td>
    <td width="5">&nbsp ;</td>
    </tr>
    <tr>
    <td height="9"></td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    </tr>
    </table>
    </div></td>
    </tr>
    <tr bgcolor="#99999 9">
    <td colspan="4">&nb sp;</td>
    </tr>
    </table>
    <p align="right">

    </p>

    </div></td>
    </tr>
    </table></td>
    </tr>
    </table>
    <br>
    </div>
    <?php
    }
    else{
    ?>

    <form method="post" action="<?php echo $PHP_SELF?>">
    <div align="center">
    <h1>Order Form Retreival</h1>
    <p align="left"> P.O. # :
    <input name="po" type="text" id="po">
    </p>
    <p align="left">
    <input type="submit" name="submitone " value="Submit">
    </p>
    </div>
    </form>
    <?php
    }

    ?>
  • Pedro Graca

    #2
    Re: Help Please :)

    Kurt A. Kaylor wrote:[color=blue]
    > Hey, I am trying to get some code I have written to work. Runs well
    > until I make a request. The I get some problems with PHP related to an
    > SQL statement. Here are the errors :Warning: mysql_result(): supplied
    > argument is not a valid MySQL result resource in c:\program
    > files\apache group\apache\ht docs\veiworderf orm.php on line 25 (error
    > goes to 76)[/color]
    ( biiiiiiiiiiiiii iig snip )


    Use error_checking!

    Brute-force method
    <?php
    $x = mysql_connect(. ..) or die('Connect error: '. mysql_error());
    ## _______________ _____^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^_

    $y = mysql_query(... ) or die('Query error: ' . mysql_error());
    ## _______________ ___^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^_

    $z = mysql_fetch_arr ay(...) or die('Fetch error: ' . mysql_error());
    ## _______________ _________^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^_
    ?>

    Comment

    • Andy Hassall

      #3
      Re: Help Please :)

      On 15 Jan 2004 00:37:07 GMT, Pedro Graca <hexkid@hotpop. com> wrote:
      [color=blue]
      >$x = mysql_connect(. ..) or die('Connect error: '. mysql_error());[/color]

      Yep.
      [color=blue]
      >$y = mysql_query(... ) or die('Query error: ' . mysql_error());[/color]

      Yep.
      [color=blue]
      >$z = mysql_fetch_arr ay(...) or die('Fetch error: ' . mysql_error());[/color]

      Nope! false from mysql_fetch_* is NOT an error, it just means you've finished
      fetching all the rows.

      --
      Andy Hassall <andy@andyh.co. uk> / Space: disk usage analysis tool
      <http://www.andyh.co.uk > / <http://www.andyhsoftwa re.co.uk/space>

      Comment

      • Pedro Graca

        #4
        Re: Help Please :)

        Pedro Graca wrote:[color=blue]
        > Use error_checking![/color]
        [color=blue]
        > $z = mysql_fetch_arr ay(...) or die('Fetch error: ' . mysql_error());
        > ## _______________ _________^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^_[/color]

        Oops ... sorry ... don't do that for the mysql_fetch_arr ay() function
        --
        --= my mail box only accepts =--
        --= Content-Type: text/plain =--
        --= Size below 10001 bytes =--

        Comment

        • Pedro Graca

          #5
          Re: Help Please :)

          From: Andy Hassall <andy@andyh.co. uk>
          Newsgroups: comp.lang.php
          Subject: Re: Help Please :)
          Date: Thu, 15 Jan 2004 00:45:33 +0000

          It is *now* 00:44:27 on my clock :)


          Andy Hassall wrote:[color=blue][color=green]
          >>$z = mysql_fetch_arr ay(...) or die('Fetch error: ' . mysql_error());[/color]
          >
          > Nope! false from mysql_fetch_* is NOT an error, it just means you've finished
          > fetching all the rows.[/color]

          Right, thanks. I got carried away with error checking :)
          --
          --= my mail box only accepts =--
          --= Content-Type: text/plain =--
          --= Size below 10001 bytes =--

          Comment

          • Kurt A. Kaylor

            #6
            Re: Help Please :)

            Okay, still not helping me. I HAVE THE ERROR !! I need to know how to fix it

            Comment

            • Tom Thackrey

              #7
              Re: Help Please :)


              On 15-Jan-2004, Dozix007@SDF.LO NESTAR.ORG (Kurt A. Kaylor) wrote:
              [color=blue]
              > Okay, still not helping me. I HAVE THE ERROR !! I need to know how to fix
              > it[/color]

              This isn't a chat session. If you don't quote those of us who don't save
              every thread will most likely be unable to help you.

              --
              Tom Thackrey

              tom (at) creative (dash) light (dot) com
              do NOT send email to jamesbutler@wil lglen.net (it's reserved for spammers)

              Comment

              Working...