PDA

View Full Version : [MYSQL] WHERE = 'Where is this code?'


pyro.699
10-27-2005, 09:00 PM
sup, im making my rpg mod, still, and al i need now, is the where command, ive tryed tons of crap!


$vbulletin->db->query_write(
"UPDATE ". TABLE_PREFIX ."thread
SET rpg_name_int = '" . $db->escape_string($vbulletin->GPC['rpg_name_int']) . "',
WHERE threadid = '" . $vbulletin->threadinfo['threadid'] . "' "
);


thats what i got so far

now, ive goten errors, and its showed me that the set command works, but, the WHERE command dosent... what do i ened to alter?

// More Info \\

Hook: newthread_post_complete

What its suposta do?: it is suposta write querys to the thread it just made..
\\ End More Info //

Paul M
10-27-2005, 09:10 PM
huh ?

Guest190829
10-27-2005, 09:15 PM
sup, im making my rpg mod, still, and al i need now, is the where command, ive tryed tons of crap!


$vbulletin->db->query_write(
"UPDATE ". TABLE_PREFIX ."thread
SET rpg_name_int = '" . $db->escape_string($vbulletin->GPC['rpg_name_int']) . "',
WHERE threadid = '" . $vbulletin->threadinfo['threadid'] . "' "
);


thats what i got so far

now, ive goten errors, and its showed me that the set command works, but, the WHERE command dosent... what do i ened to alter?

// More Info \\

Hook: newthread_post_complete

What its suposta do?: it is suposta write querys to the thread it just made..
\\ End More Info //

What's the exact error you're getting?

pyro.699
10-27-2005, 09:15 PM
lol,?

umm, i need to write a query, and i need to know how to specify the thread that it has just created...?

umm, yeah, i linke umms, lol; ok, as i said above, its for adding the #1 to a table i created in the thread table, (i like tables aswell it seems/; ) leaves it alone, (need to make that code <)

hope that makes it easyer

as for the error question, i figured that out, i said when i got errors. i got the erorrs figured out ^^ i just need the where command

Guest190829
10-27-2005, 09:17 PM
So it's not giving errors? But just not working? It could be your hook location.

pyro.699
10-27-2005, 09:19 PM
lol, posts while im posting ^^, umm.... idk what other hook location to try? you got any ideas?

(im sorta new to plugins)

pyro.699
10-29-2005, 12:29 AM
ok, major breakthrew here, ill post yo the error i got


Database error in vBulletin 3.5.0:

Invalid SQL:
UPDATE thread
SET rpg_name_int = '0',
WHERE threadid = '';

MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE threadid = ''' at line 3
Error Number : 1064
Date : Friday, October 28th 2005 @ 10:26:20 PM
Script : http://localhost/php_testing/test/newthread.php
Referrer : http://localhost/php_testing/test/newthread.php?do=newthread&f=26
IP Address : 127.0.0.1
Username : Pyro
Classname : vB_Database


Thats right 127.0.0.1

anyways, as you can see the script knows everythign except for the location.

I looked threw a code that aj gave to me

echo '<pre>';
print_r($vbulletin);
echo '</pre>';


Made a plugin outa that, and i coudlent find the forum id, so... idk.. you figure it out... i really ned this last step! please help em!

Softcore
11-03-2005, 04:46 AM
I hope you don't mind me butting In here pyro.699,

I wish I knew the answer to your question, but I only know how to code for 3.0.9, not 3.5.0....however, I'd like to make It clear what your asking as I understood and It seems other did not....

He's trying to run a query that updates a field WHERE the threadid equal's the threadid he gives....The problem Is, as you can see from the query, It's not giving a thread ID, now this could be because he does not have the query correctly for vb 3.5.0 (as I said I have no Idea about), or because the, used to be $threadinfo array Is not being passed to his script....

Hope someone can help you, and hopefully they understand now

Adrian Schneider
11-03-2005, 05:56 AM
It's working now, he was trying to run a query instead of using the datamanager. :)