Re: [PHP] qry not running??

2003-07-07 Thread Jeff Harris
On Jul 7, 2003, "Micah Montoy" claimed that:

|Well, I redid the code a bit but it is still blowing up with the same error
|message.  I also did the echo bit and it returned "Resource id #10".  What
|ever that is.  At least I know its returning something.  But when I did
|mssql_row_nums($result), it returned the value 0.  I'm not sure if this is
|where its encountering problems or not.  Here is the script that I'm using
|for everything.  I believe the syntax is correct but let me know if you see
|anything out of place.

[snip]
If the number of rows being returned is zero, what data do you expect to
get? Shouldn't you check to see if the number of rows returned is zero and
produce some other message and stop processing the non-existant results?

Jeff
-- 
Registered Linux user #304026.
"lynx -source http://jharris.rallycentral.us/jharris.asc | gpg --import"
Key fingerprint = 52FC 20BD 025A 8C13 5FC6  68C6 9CF9 46C2 B089 0FED
Responses to this message should conform to RFC 1855.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] qry not running??

2003-07-07 Thread Micah Montoy
Well, I redid the code a bit but it is still blowing up with the same error
message.  I also did the echo bit and it returned "Resource id #10".  What
ever that is.  At least I know its returning something.  But when I did
mssql_row_nums($result), it returned the value 0.  I'm not sure if this is
where its encountering problems or not.  Here is the script that I'm using
for everything.  I believe the syntax is correct but let me know if you see
anything out of place.

//check through to see if new category or an existing
if ($_POST["cat_nameID"] = ""){
 $cat_name = $_POST["new_cat"];

 //insert new category
 $new_cat = "INSERT INTO category"
   . "(cat_name)";
 $new_cat = "VALUES (";
 $new_cat = "'{$cat_name}'";
 mssql_query ($new_cat);
}
else {
 //get active category info
 $cat_name = $_POST["cat_nameID"];
 $result = mssql_query("SELECT cat_id, cat_name FROM category WHERE cat_id =
'$cat_name'");
}

//get new category info
if ($_POST["cat_nameID"] = ""){
 $result = mssql_query("SELECT cat_id, cat_name FROM category WHERE cat_name
= '$cat_name'");
}
//get values for $cat_name
$catID = mssql_result($result,0,"cat_id");
$catName = mssql_result($result,0,"cat_name");


thanks




"Miles Thompson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Micah,
>
> Echo your SELECT statement to make certain it reads the way it should.
> Test for number of rows returned, or an error - $result probably contains
> nothing, that is it's not pointing to an array.
>
> Miles
>
>
> At 01:23 PM 7/7/2003 -0600, Micah Montoy wrote:
> >Anyone see what is wrong with this?
> >
> >//get category info
> >$result = mssql_query("SELECT cat_id, cat_name FROM category WHERE cat_id
=
> >'$cat_name'");
> >$catID = mssql_result($result,0,"cat_id");  //line 32
> >$catName = mssql_result($result,0,"cat_name");  //line 33
> >
> >I'm getting the error:
> >
> >Warning: mssql_result(): Bad row offset (0) in
> >c:\inetpub\wwwroot\webpage10\example\u_images\act_load_imgs.php on line
32
> >
> >Warning: mssql_result(): Bad row offset (0) in
> >c:\inetpub\wwwroot\webpage10\example\u_images\act_load_imgs.php on line
33
> >
> >
> >thanks
> >
> >
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] qry not running??

2003-07-07 Thread Miles Thompson
Micah,

Echo your SELECT statement to make certain it reads the way it should.
Test for number of rows returned, or an error - $result probably contains 
nothing, that is it's not pointing to an array.

Miles

At 01:23 PM 7/7/2003 -0600, Micah Montoy wrote:
Anyone see what is wrong with this?

//get category info
$result = mssql_query("SELECT cat_id, cat_name FROM category WHERE cat_id =
'$cat_name'");
$catID = mssql_result($result,0,"cat_id");  //line 32
$catName = mssql_result($result,0,"cat_name");  //line 33
I'm getting the error:

Warning: mssql_result(): Bad row offset (0) in
c:\inetpub\wwwroot\webpage10\example\u_images\act_load_imgs.php on line 32
Warning: mssql_result(): Bad row offset (0) in
c:\inetpub\wwwroot\webpage10\example\u_images\act_load_imgs.php on line 33
thanks



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] qry not running??

2003-07-07 Thread Brad Pauly
Micah Montoy wrote:
//get category info
$result = mssql_query("SELECT cat_id, cat_name FROM category WHERE cat_id =
'$cat_name'");
$catID = mssql_result($result,0,"cat_id");  //line 32
$catName = mssql_result($result,0,"cat_name");  //line 33
I'm getting the error:

Warning: mssql_result(): Bad row offset (0) in
c:\inetpub\wwwroot\webpage10\example\u_images\act_load_imgs.php on line 32
Warning: mssql_result(): Bad row offset (0) in
c:\inetpub\wwwroot\webpage10\example\u_images\act_load_imgs.php on line 33
Is your WHERE clause what you want it to be?

WHERE cat_id = '$cat_name'

I don't know what $cat_name is, but since you have a cat_name column, I 
am wondering if you are comparing two different things.

Brad



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] qry not running??

2003-07-07 Thread Micah Montoy
Anyone see what is wrong with this?

//get category info
$result = mssql_query("SELECT cat_id, cat_name FROM category WHERE cat_id =
'$cat_name'");
$catID = mssql_result($result,0,"cat_id");  //line 32
$catName = mssql_result($result,0,"cat_name");  //line 33

I'm getting the error:

Warning: mssql_result(): Bad row offset (0) in
c:\inetpub\wwwroot\webpage10\example\u_images\act_load_imgs.php on line 32

Warning: mssql_result(): Bad row offset (0) in
c:\inetpub\wwwroot\webpage10\example\u_images\act_load_imgs.php on line 33


thanks



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php