vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   loop problem, getting MySQL error (https://vborg.vbsupport.ru/showthread.php?t=111809)

Red Blaze 03-31-2006 01:29 PM

loop problem, getting MySQL error
 
Quote:

Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /home/prophot/public_html/order/cart.php on line 150
That's the error I get.
This is the block of code in that area:

PHP Code:

              <?php
              $itemname 
$row_callitems['itemname'];
$addedsize "SELECT * items WHERE userid = $userid AND itemname = $itemname AND original = '0'";
$result mysql_query($addedsize);
$num mysql_num_rows($result);
mysql_close();
$i=0;
while (
$i $num) {
$size=mysql_result($result,$i,"size");
$paper=mysql_result($result,$i,"paper");
$quantity=mysql_result($result,$i,"quantity");
              
?>

Line 150 is "$num = mysql_num_rows($result);" so I assume something is wrong with line 149? Which is the $addedsize variable. I updated the txt file that has the entire code. Help would be greatly appreciated, thank you.

Just so you'd know, this loop is inside a repeat region generated by Dreamweaver. Could that be a cause of the problem?

~RB

Xenon 03-31-2006 01:59 PM

remove the mysql_close(); if you have that in a loop, because that would close the connection and therefore the second run of the loop cannot give you a result

Red Blaze 03-31-2006 02:17 PM

That wasn't inside the loop, but I removed it anyway. I got this loop coding from a tutorial, so I didn't know it wasn't needed.

Also, since I removed it, it still didn't work. =/

Xenon 03-31-2006 02:19 PM

and it's sure that the connection exists?

Red Blaze 03-31-2006 02:32 PM

*sigh* I hate it when this happens.
I found out what it all was.

I forgot to put "FROM" between "* items".

Xenon 03-31-2006 04:20 PM

oops ;)


All times are GMT. The time now is 07:32 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01052 seconds
  • Memory Usage 1,724KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete