Help Please :)

This is a discussion on Help Please :) within the PHP Language forums, part of the PHP Programming Forums category; Hey, I am trying to get some code I have written to work. Runs well until I make a request. ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-15-2004
Kurt A. Kaylor
 
Posts: n/a
Default 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\htdocs\veiworderform.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="#009966">
<div align="center"><br>
<table width="799" border="0" ="1" cellspacing="0"
bgcolor="#aaaaaa">
<tr>
<td>
<table width="100%" border="0" bgcolor="#FFFFCC">
<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($sql);

$billcompany = mysql_result($result,0,billcompany);
$billaddress = mysql_result($result,0,billaddress);
$billcity = mysql_result($result,0,billcity);
$billstate = mysql_result($result,0,billstate);
$billzip = mysql_result($result,0,billzip);
$billorder = mysql_result($result,0,billorder);
$billphone = mysql_result($result,0,billphone);
$billfax = mysql_result($result,0,billfax);
$shipcompany = mysql_result($result,0,shipcompany);
$shipaddress = mysql_result($result,0,shipaddress);
$shipcity = mysql_result($result,0,shipcity);
$shipstate = mysql_result($result,0,shipstate);
$shipzip = mysql_result($result,0,shipzip);
$shiporder = mysql_result($result,0,shiporder);
$shipphone = mysql_result($result,0,shipphone);
$shipfax = mysql_result($result,0,shipfax);
$dateneed = mysql_result($result,0,dateneed);
$description = mysql_result($result,0,description);
$proofneed = mysql_result($result,0,proofneed);
$proof = mysql_result($result,0,proof);
$proofemail = mysql_result($result,0,email);
$prooflaser = mysql_result($result,0,prooflaser);
$proofcolor = mysql_result($result,0,proofcolor);
$laserproof = mysql_result($result,0,laserproof);
$dyluxproof = mysql_result($result,0,dyluxproof);
$matchprintproof = mysql_result($result,0,matchprintproof);
$colorkeyproof = mysql_result($result,0,colorkeyproof);
$faxproof = mysql_result($result,0,faxproof);
$colornumber = mysql_result($result,0,colornumber);
$proofnumber = mysql_result($result,0,proofnumber);
$film = mysql_result($result,0,film);
$thickness = mysql_result($result,0,thickness);
$platematerial = mysql_result($result,0,platematerial);
$cylinderdirection = mysql_result($result,0,cylinderdirection);
$cut = mysql_result($result,0,cut);
$gear = mysql_result($result,0,gear);
$pitch = mysql_result($result,0,pitch);
$distort = mysql_result($result,0,distort);
$cornerradius = mysql_result($result,0,cornerradius);
$reapeatcylinder = mysql_result($result,0,reapeatcylinder);
$totalcolors = mysql_result($result,0,totalcolors);
$totalplates = mysql_result($result,0,totalplates);
$imagedimesiontwo = mysql_result($result,0,imagedimesiontwo);
$imagedimensionone = mysql_result($result,0,imagedimensionone);
$ar = mysql_result($result,0,ar);
$ac = mysql_result($result,0,ac);
$gapac = mysql_result($result,0,gapac);
$gapar = mysql_result($result,0,gapar);
$tooth = mysql_result($result,0,tooth);
$returndisk = mysql_result($result,0,returndisk);
$returnart = mysql_result($result,0,returnart);
$instructions = mysql_result($result,0,instructions);
?>
<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="#999999">

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

<td width="50%" colspan="2"><strong>SHIP
TO:</strong> </td>
</tr>
<tr bgcolor="#CCCCCC">

<td>Company Name:

<input type="text" id="billcompany2"
value="$billcompany">
</td>

<td colspan="2">Company Name:

<input type="text" id="shipcompany2"
value="$shipcompany"></td>
</tr>
<tr bgcolor="#CCCCCC">

<td>Address:

<input type="text" id="billaddress2"
value="$billaddress"></td>

<td colspan="2">Address:

<input type="text" id="shipaddress2"
value="$shipaddress"></td>
</tr>
<tr bgcolor="#CCCCCC">

<td>
<p>City:
<input type="text" id="billcity2"
value="$billcity" size="20">
State :
<input type="text" id="billstate2"
value="$billstate" 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="$shipcity" size="20">
State :
<input type="text" id="shipstate2"
value="$shipstate" size="2">
Zip:
<input type="text" id="shipzip2"
value="$shipzip" size="9">
</p></td>
</tr>
<tr bgcolor="#CCCCCC">

<td>Ordered By:

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

<td colspan="2">Ordered By:

<input type="text" id="shiporder2"
value="$shiporder"></td>
</tr>
<tr bgcolor="#CCCCCC">

<td>Phone:

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

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

<td colspan="2">Phone:

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

<input type="text" id="shipfax2"
value="$shipfax" size="9"></td>
</tr>
<tr bgcolor="#999999">
<td colspan="3">&nbsp;</td>
</tr>
<tr bgcolor="#CCCCCC">

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

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

<input type="text" id="description2"
value="$description" size="50">
</td>
</tr>
<tr bgcolor="#999999">
<td colspan="3">&nbsp;</td>
</tr>
</table>
<table width="100%" height="30" border="0"
cellpadding="2" cellspacing="0">
<tr bgcolor="#999999">

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

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

<td colspan="2" bgcolor="#999999"><strong>Proofs
Before
Plates:
<label> </label>
<label> </label>
</strong> <label>

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

<td>
<label>

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

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

<td colspan="2">Number of Colors:

<input type="text" id="colornumber2"
value="$colornumber"></td>
</tr>
<tr bgcolor="#CCCCCC">

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

<td>
<input <?php if (!(strcmp("$colorlaserproof","Yes"))) {echo
"checked";} ?> name="colorlaserproof" type="checkbox"
id="colorlaserproof2" value="Yes">
Color Laser</td>

<td colspan="2">Number of Proofs:

<input type="text" id="proofnumber2"
value="$proofnumber"></td>
</tr>
<tr bgcolor="#CCCCCC">

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

<td>
<input <?php if (!(strcmp("$matchprintproof","Yes"))) {echo
"checked";} ?> name="matchprintproof" type="checkbox"
id="matchprintproof2" value="Yes">
Match Print</td>

<td colspan="2">Film:

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

<td colspan="4">
<input <?php if (!(strcmp("$colorkeyproof","Yes"))) {echo "checked";}
?> name="colorkeyproof" type="checkbox" id="colorkeyproof2"
value="Yes">
Color Key</td>
</tr>
<tr bgcolor="#CCCCCC">

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

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

<td width="33%"><strong>Step &amp;
Reapeat</strong></td>
<td width="33%">&nbsp;</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("$platematerial","PQS"))) {echo "CHECKED";} ?> type="radio"
name="platematerial" value="PQS">
PQS</label>
<br>
<label>
<input <?php if
(!(strcmp("$platematerial","HOS"))) {echo "CHECKED";} ?> type="radio"
name="platematerial" value="HOS">
HOS</label>
<br>
<label>
<input <?php if
(!(strcmp("$platematerial","EXL"))) {echo "CHECKED";} ?> type="radio"
name="platematerial" value="EXL">
EXL</label>
<br>
<label>
<input <?php if
(!(strcmp("$platematerial","UXL"))) {echo "CHECKED";} ?> type="radio"
name="platematerial" value="UXL">
UXL</label>
<br>
<label>
<input <?php if
(!(strcmp("$platematerial","TDR"))) {echo "CHECKED";} ?> type="radio"
name="platematerial" value="TDR">
TDR</label>
</p>
<p>
<label></label>
<label>

<input <?php if
(!(strcmp("$platematerial","Epic"))) {echo "CHECKED";} ?> type="radio"
name="platematerial" value="Epic">

Epic</label>
<br>
<label>

<input <?php if
(!(strcmp("$platematerial","Atlas"))) {echo "CHECKED";} ?>
type="radio" name="platematerial" value="Atlas">

Atlas </label>
<br>
<label>

<input <?php if
(!(strcmp("$platematerial","Flexcor"))) {echo "CHECKED";} ?>
type="radio" name="platematerial" value="Flexcor">

Flexcor</label>
<br>
<label>

<input <?php if
(!(strcmp("$platematerial","Blue"))) {echo "CHECKED";} ?> type="radio"
name="platematerial" value="Blue">

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

<input type="text" id="platematerial2"
value="$platematerial" size="20">
<br>
</p>
<p align="left"> Thickness:</p>
<p align="left">
<label>

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

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

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

<input type="text" id="thickness2"
value="$thickness" size="20">
</label>
</p>
<p align="left">Plate Direction Around
Cylinder:</p>
<p align="left">
<label>

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

<input type="text"
id="cylinderdirection2" value="$cylinderdirection" 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("$gear","1/8
CP"))) {echo "CHECKED";} ?> type="radio" name="gear" value="1/8 CP">
1/8 CP</label>
<br>
<label>

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

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

<input type="text" id="cornerradius2"
value="$cornerradius" size="8">
</p>
<p align="left">Cylinder Repeat:

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

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

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

<input type="text"
id="imagedimensionone2" value="$imagedimensionone" size="8">
<font size="-1"> x</font>

<input type="text"
id="imagedimesiontwo2" value="$imagedimesiontwo" 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("$returndisk","Yes"))) {echo "checked";} ?>
name="returndisk" type="checkbox" id="returndisk2" value="Yes">
Return Customer Disk <br>
</font><font size="-1">

<input <?php if
(!(strcmp("$returnart","$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="#999999">
<td colspan="4">&nbsp;</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
}

?>
Reply With Quote
  #2 (permalink)  
Old 01-15-2004
Pedro Graca
 
Posts: n/a
Default Re: Help Please :)

Kurt A. Kaylor wrote:
> 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\htdocs\veiworderform.php on line 25 (error
> goes to 76)

( biiiiiiiiiiiiiiiig 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_array(...) or die('Fetch error: ' . mysql_error());
## ________________________^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^_
?>
Reply With Quote
  #3 (permalink)  
Old 01-15-2004
Pedro Graca
 
Posts: n/a
Default Re: Help Please :)

Pedro Graca wrote:
> Use error_checking!


> $z = mysql_fetch_array(...) or die('Fetch error: ' . mysql_error());
> ## ________________________^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^_


Oops ... sorry ... don't do that for the mysql_fetch_array() function
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Reply With Quote
  #4 (permalink)  
Old 01-15-2004
Pedro Graca
 
Posts: n/a
Default 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:
>>$z = mysql_fetch_array(...) or die('Fetch error: ' . mysql_error());

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


Right, thanks. I got carried away with error checking :)
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Reply With Quote
  #5 (permalink)  
Old 01-15-2004
Andy Hassall
 
Posts: n/a
Default Re: Help Please :)

On 15 Jan 2004 00:37:07 GMT, Pedro Graca <hexkid@hotpop.com> wrote:

>$x = mysql_connect(...) or die('Connect error: '. mysql_error());


Yep.

>$y = mysql_query(...) or die('Query error: ' . mysql_error());


Yep.

>$z = mysql_fetch_array(...) or die('Fetch error: ' . mysql_error());


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.andyhsoftware.co.uk/space>
Reply With Quote
  #6 (permalink)  
Old 01-15-2004
Kurt A. Kaylor
 
Posts: n/a
Default Re: Help Please :)

Okay, still not helping me. I HAVE THE ERROR !! I need to know how to fix it
Reply With Quote
  #7 (permalink)  
Old 01-15-2004
Tom Thackrey
 
Posts: n/a
Default Re: Help Please :)


On 15-Jan-2004, Dozix007@SDF.LONESTAR.ORG (Kurt A. Kaylor) wrote:

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


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
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to jamesbutler@willglen.net (it's reserved for spammers)
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 07:15 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0