RE: [PHP-DB] Undefined Variable and argument not valid . . .

2001-02-14 Thread John Halladay

Is it possible to add, subtract, etc on values as I am demonstrating below.
I'm getting an error with this.  I want to be able to add the values of
CMAPER and CMUPER when displayed.

printf("%s%s\n", $myrow["CMPLNDESC"],
$myrow["CMAPER"+"CMUPER"]);

Thanks,
John

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Undefined Variable and argument not valid . . .

2001-02-14 Thread Jorge Santos

Hi John,

Considering that I don't have MySql installed here and therefore can't test
your code, I'm going to guess that the msql_fetch_array is not storing the
array as per the indexes that you want. Try using MYSQL_ASSOC or MYSQL_BOTH
as the second parameter. MYSQL_ASSOC causes the elements to be indexed by
field names and MYSQL_BOTH FORCES the indexes to be stored both ways. It may
be possible that your default is setup to MYSQL_NUM and that would be why
you're getting an error.

Try:
$myrow = mysql_fetch_array($result,MYSQL_ASSOC);

Hope this helps.
Later,
Jorge
[EMAIL PROTECTED]
- Original Message -
From: John Halladay <[EMAIL PROTECTED]>
To: 'Jorge Santos' <[EMAIL PROTECTED]>
Sent: Wednesday, February 14, 2001 1:11 PM
Subject: RE: [PHP-DB] Undefined Variable and argument not valid . . .


> Great!  That fixed the first error, but I'm still getting the other error
on
> the second page stating:
>
> Warning: Supplied argument is not a valid MySQL result resource in
> C:\Inetpub\wwwroot/maybe.php on line 15
> Company Name:
> Contact:
> Phone Number:
>
> Here is line 15:
>
> $myrow = mysql_fetch_array($result);
>
> Any ideas?  Thanks again for your help.
>
> John
>
> -Original Message-
> From: Jorge Santos [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 14, 2001 11:05 AM
> To: John Halladay
> Cc: PHP-DB
> Subject: Re: [PHP-DB] Undefined Variable and argument not valid . . .
>
>
> Hi  John,
>
> You're trying to use a variable that is not set. Try using the isset
> function... Like this:
>
> if (isset($COCOD))
> $result = mysql_query("SELECT * FROM tblAA_MIKER_COMPDAT WHERE
> COCOD=$COCOD",$db);
>
> Hope this helps...
> Later,
> Jorge
> [EMAIL PROTECTED]
> ----- Original Message -----
> From: John Halladay <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, February 14, 2001 12:51 PM
> Subject: [PHP-DB] Undefined Variable and argument not valid . . .
>
>
> > Could someone please give me some direction on what is wrong with what I
> am
> > trying to do below.  I've checked it over but still get the same errors.
> > What I'm trying to do is have a list of links that display information
> when
> > you click them.
> >
> > I'm getting the following error at the top of the first page where all
the
> > links are displayed.
> > Warning: Undefined variable: COCOD in C:\Inetpub\wwwroot/maybe.php on
line
> > 11
> >
> > I'm getting this error when I click on one of the links and there is no
> info
> > displayed under the three listing below.
> > Warning: Supplied argument is not a valid MySQL result resource in
> > C:\Inetpub\wwwroot/maybe.php on line 15
> > Company Name:
> > Contact:
> > Phone Number:
> >
> >
> > 
> >
> > 
> >
> >  >
> > $db = mysql_connect("localhost", "root", "***");
> >
> > mysql_select_db("schedules",$db);
> >
> > if ($COCOD) {
> >
> > $result = mysql_query("SELECT * FROM tblAA_MIKER_COMPDAT WHERE
> > COCOD=$COCOD",$db);
> >
> > $myrow = mysql_fetch_array($result);
> >
> > printf("Company Name: %s\n", $myrow["CONAM"]);
> >
> > printf("Contact: %s\n", $myrow["Contact"]);
> >
> > printf("Phone Number: %s\n", $myrow["PhoneNumber"]);
> >
> > } else {
> >
> > $result = mysql_query("SELECT * FROM tblAA_MIKER_COMPDAT",$db);
> >
> > if ($myrow = mysql_fetch_array($result)) {
> >
> > do {
> >
> > printf("%s\n", $PHP_SELF,
$myrow["COCOD"],
> > $myrow["CONAM"]);
> >
> > } while ($myrow = mysql_fetch_array($result));
> >
> > } else {
> >
> > echo "Sorry, no records were found!";
> >
> > }
> >
> > }
> >
> > ?>
> >
> > 
> >
> > 
> >
> > Thanks.
> >
> > John Halladay
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Undefined Variable and argument not valid . . .

2001-02-14 Thread Jorge Santos

Hi  John,

You're trying to use a variable that is not set. Try using the isset
function... Like this:

if (isset($COCOD))
$result = mysql_query("SELECT * FROM tblAA_MIKER_COMPDAT WHERE
COCOD=$COCOD",$db);

Hope this helps...
Later,
Jorge
[EMAIL PROTECTED]
- Original Message -
From: John Halladay <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 14, 2001 12:51 PM
Subject: [PHP-DB] Undefined Variable and argument not valid . . .


> Could someone please give me some direction on what is wrong with what I
am
> trying to do below.  I've checked it over but still get the same errors.
> What I'm trying to do is have a list of links that display information
when
> you click them.
>
> I'm getting the following error at the top of the first page where all the
> links are displayed.
> Warning: Undefined variable: COCOD in C:\Inetpub\wwwroot/maybe.php on line
> 11
>
> I'm getting this error when I click on one of the links and there is no
info
> displayed under the three listing below.
> Warning: Supplied argument is not a valid MySQL result resource in
> C:\Inetpub\wwwroot/maybe.php on line 15
> Company Name:
> Contact:
> Phone Number:
>
>
> 
>
> 
>
> 
> $db = mysql_connect("localhost", "root", "***");
>
> mysql_select_db("schedules",$db);
>
> if ($COCOD) {
>
> $result = mysql_query("SELECT * FROM tblAA_MIKER_COMPDAT WHERE
> COCOD=$COCOD",$db);
>
> $myrow = mysql_fetch_array($result);
>
> printf("Company Name: %s\n", $myrow["CONAM"]);
>
> printf("Contact: %s\n", $myrow["Contact"]);
>
> printf("Phone Number: %s\n", $myrow["PhoneNumber"]);
>
> } else {
>
> $result = mysql_query("SELECT * FROM tblAA_MIKER_COMPDAT",$db);
>
> if ($myrow = mysql_fetch_array($result)) {
>
> do {
>
> printf("%s\n", $PHP_SELF, $myrow["COCOD"],
> $myrow["CONAM"]);
>
> } while ($myrow = mysql_fetch_array($result));
>
> } else {
>
> echo "Sorry, no records were found!";
>
> }
>
> }
>
> ?>
>
> 
>
> 
>
> Thanks.
>
> John Halladay
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Undefined Variable and argument not valid . . .

2001-02-14 Thread John Halladay

Could someone please give me some direction on what is wrong with what I am
trying to do below.  I've checked it over but still get the same errors.
What I'm trying to do is have a list of links that display information when
you click them.

I'm getting the following error at the top of the first page where all the
links are displayed.
Warning: Undefined variable: COCOD in C:\Inetpub\wwwroot/maybe.php on line
11

I'm getting this error when I click on one of the links and there is no info
displayed under the three listing below.
Warning: Supplied argument is not a valid MySQL result resource in
C:\Inetpub\wwwroot/maybe.php on line 15
Company Name: 
Contact: 
Phone Number: 






", $myrow["CONAM"]);

printf("Contact: %s\n", $myrow["Contact"]);

printf("Phone Number: %s\n", $myrow["PhoneNumber"]);

} else {

$result = mysql_query("SELECT * FROM tblAA_MIKER_COMPDAT",$db);

if ($myrow = mysql_fetch_array($result)) {

do {

printf("%s\n", $PHP_SELF, $myrow["COCOD"],
$myrow["CONAM"]);

} while ($myrow = mysql_fetch_array($result));

} else {

echo "Sorry, no records were found!";   

}

}

?>





Thanks.

John Halladay

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]