Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 05-16-2003, 11:30 PM
dv6cougar dv6cougar is offline
 
Join Date: Mar 2003
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default my update query isn't working :(

i'm working on a raffle system and so far so good

however this update statement is not working

$urh = $DB_site->query("UPDATE raffle_images SET comment='$comment' WHERE id='$id'");


i'm echo out $urh afterwards btw and it just returns a 1!!!!

how does that give me one? and it does it for all my images in the database :disappointed:


i tried using different variables for urh, hence why it's urh haha....

but it alwasy gives me 1, which is odd :cross-eyed:



the $id comes from teh title bar, which it is catching correctly i checked.

this is for a script in admin panel btw... my other update portion works fine just like this....

thanks all :banana:
Reply With Quote
  #2  
Old 05-17-2003, 02:40 AM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Updates never return anything useful beyond success or failure (and on failure the script will die anyway)...what are you trying to do?
Reply With Quote
  #3  
Old 05-17-2003, 03:20 AM
dv6cougar dv6cougar is offline
 
Join Date: Mar 2003
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks for your reply and it's a field in the database comment that i need to update through a form, here's the entire portion of the script

PHP Code:
if($update) {

$urh $DB_site->query("UPDATE raffle_images SET comment='$comment' WHERE id='$id'");
echo 
"<center><br><h2>Image Options</h2><br><br>";
echo 
"Updated your comment to $comment<br>$urh";
} else {
$sele $DB_site->query("SELECT * FROM raffle_images WHERE id='$id'");
echo 
"<center><br><h2>Image Options</h2><br><br>";
$seleql $DB_site->fetch_array($sele);
echo 
"<form action=\"misc.php?action=imgupd\" method=\"post\">";
echo 
"<textarea name=\"comment\" rows=10 cols=40>".$seleql['comment']."</textarea><br><br>";
echo 
"<input type=submit name=\"update\" value=\"Update Comment\"></form>";


so upon submit(update in this case) the script will run througha nd update the field, and the if($update) {
is workign as it comes up and gives me that it has been updated, although it has not.

but with what your saying above is true, and it's eitehr gonna go through or have an error, i'm thinking it is throwing an error and that the error is error # 1 whatever that one is.

thanks
Reply With Quote
  #4  
Old 05-17-2003, 01:02 PM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If it fails, the script will die anyway. Your failure code will never execute.
Reply With Quote
  #5  
Old 05-17-2003, 01:41 PM
dv6cougar dv6cougar is offline
 
Join Date: Mar 2003
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i'm gonna add or die(""); and see if it is my query, which i'm guessing it must be

thanks for your help, hopefully i'll figure it out soon
Reply With Quote
  #6  
Old 05-17-2003, 02:12 PM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You don't seem to understand. With the MySQL wrapper class that vB uses, it will die by itself if the query fails.
Reply With Quote
  #7  
Old 05-17-2003, 04:50 PM
dv6cougar dv6cougar is offline
 
Join Date: Mar 2003
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Today at 04:12 PM filburt1 said this in Post #6
You don't seem to understand. With the MySQL wrapper class that vB uses, it will die by itself if the query fails.

ohhhhh yeah your right i didn't understand...

however I fixed my problem, what I had forgotten to do in the form action was

PHP Code:
action="misc.php?action=updimg[b]&id=$id[/b]
so my query couldn't determine the $id variable hence there's nothing to update


thanks alot though......

so no matter what query you run in any VB page the query dies if it's failure then?
Reply With Quote
  #8  
Old 05-17-2003, 05:12 PM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

As long as you call it via $DB_site->query(), then yes
Reply With Quote
Reply


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 On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:17 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.03685 seconds
  • Memory Usage 2,233KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete