vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   my update query isn't working :( (https://vborg.vbsupport.ru/showthread.php?t=53033)

dv6cougar 05-16-2003 11:30 PM

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:

filburt1 05-17-2003 02:40 AM

Updates never return anything useful beyond success or failure (and on failure the script will die anyway)...what are you trying to do?

dv6cougar 05-17-2003 03:20 AM

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 :)

filburt1 05-17-2003 01:02 PM

If it fails, the script will die anyway. Your failure code will never execute.

dv6cougar 05-17-2003 01:41 PM

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

filburt1 05-17-2003 02:12 PM

You don't seem to understand. With the MySQL wrapper class that vB uses, it will die by itself if the query fails.

dv6cougar 05-17-2003 04:50 PM

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? :p

filburt1 05-17-2003 05:12 PM

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


All times are GMT. The time now is 02:44 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.00979 seconds
  • Memory Usage 1,735KB
  • 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
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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