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 03-05-2006, 10:49 PM
DrewM DrewM is offline
 
Join Date: Oct 2005
Posts: 564
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Why am I getting this error?

Well I was poting the "user quick links hack" for presonal use and evry thing was working fine until you save the error is:
Database error in vBulletin 3.5.4:

Quote:
Invalid SQL:
UPDATE usertextfield SET
customquicklinks = 'a:1:{i:0;s:111:\"a:2:{s:5:\"title\";s:11:\"Melon Fresh\";s:3:\"url\";s:56:\"http://sim2world.com/forum/profile.php?do=editquicklinks\";}\";}'
WHERE userid = Array[userid];
Error Number : 1064
Reply With Quote
  #2  
Old 03-06-2006, 12:21 AM
Brad Brad is offline
 
Join Date: Nov 2001
Posts: 4,765
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You're not passing a userid to the query.
Reply With Quote
  #3  
Old 03-06-2006, 09:25 AM
DrewM DrewM is offline
 
Join Date: Oct 2005
Posts: 564
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How can I do this I'm currtenly using:
PHP Code:
userid $vbulletin->userinfo[userid
Is this right?
Reply With Quote
  #4  
Old 03-06-2006, 09:41 AM
Brad Brad is offline
 
Join Date: Nov 2001
Posts: 4,765
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No, use this:

PHP Code:
$userid $vbulletin->userinfo['userid']; 
Reply With Quote
  #5  
Old 03-06-2006, 09:45 AM
DrewM DrewM is offline
 
Join Date: Oct 2005
Posts: 564
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thank you, but still getting errors this is my error now:
Quote:
Database error in vBulletin 3.5.4:

Invalid SQL:
UPDATE usertextfield SET
customquicklinks = 'a:1:{i:0;s:62:\"a:2:{s:5:\"title\";s:4:\"Test\";s :3:\"url\";s:15:\"http://test.com\";}\";}'
WHERE userid = = Array['userid'];;

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 '= Array['userid']' at line 3
Error Number : 1064
And well heres the update code:
PHP Code:
if ($_REQUEST['do'] == 'updatequicklinks')
{
    require_once(
DIR '/includes/functions_misc.php');
     
$vbulletin->input->clean_array_gpc('p', array(
        
'existinglinks' => INT,
    ));
    
$quicklinks = array();
    for (
$i 1;$i <= $existinglinks;$i++)
    {
        
$title '';$url '';
        if (
$title htmlspecialchars(trim($_REQUEST['quicklink' $i '_title'])) AND $url htmlspecialchars(trim($_REQUEST['quicklink' $i '_url'])))
        {
            
$quicklinks[] = serialize(array('title' => $title'url' => 'http://' $url));
        }
    }
    for (
$i 0;$i 3;$i++)
    {
        
$title '';$url '';
        if (
$title trim($_REQUEST['newlink' $i '_title']) AND $url trim($_REQUEST['newlink' $i '_url']))
        {
            
$quicklinks[] = serialize(array('title' => $title'url' => 'http://' $url));
        }
    }

    if (
count($quicklinks))
    {
        
$db->query("UPDATE " TABLE_PREFIX "usertextfield SET
            customquicklinks = '" 
addslashes(serialize($quicklinks)) . "'
            WHERE userid =  
$userid = $vbulletin->userinfo['userid'];
        "
);
    }
    else
    {
        
$db->query("UPDATE " TABLE_PREFIX "usertextfield SET
            customquicklinks = ''
            WHERE  
$userid = $vbulletin->userinfo['userid'];
        "
);
    } 
    
    
$url 'profile.php?do=editquicklinks';
    eval(
print_standard_redirect($vbphrase['quicklinks_saved'],0));

Reply With Quote
  #6  
Old 03-06-2006, 10:42 AM
merk merk is offline
 
Join Date: Nov 2001
Location: Canberra, Australia
Posts: 601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Brad, this is in a query'

Larry:

PHP Code:
if ($_REQUEST['do'] == 'updatequicklinks'

require_once(
DIR '/includes/functions_misc.php'); 
$vbulletin->input->clean_array_gpc('p', array( 
'existinglinks' => INT
)); 
$quicklinks = array(); 
for (
$i 1;$i <= $existinglinks;$i++) 

$title '';$url ''
if (
$title htmlspecialchars(trim($_REQUEST['quicklink' $i '_title'])) AND $url htmlspecialchars(trim($_REQUEST['quicklink' $i '_url']))) 

$quicklinks[] = serialize(array('title' => $title'url' => 'http://' $url)); 


for (
$i 0;$i 3;$i++) 

$title '';$url ''
if (
$title trim($_REQUEST['newlink' $i '_title']) AND $url trim($_REQUEST['newlink' $i '_url'])) 

$quicklinks[] = serialize(array('title' => $title'url' => 'http://' $url)); 


 
if (
count($quicklinks)) 

$db->query("UPDATE " TABLE_PREFIX "usertextfield SET 
customquicklinks = '" 
addslashes(serialize($quicklinks)) . "' 
WHERE userid = 
{$vbulletin->userinfo['userid']}
"
); 

else 

$db->query("UPDATE " TABLE_PREFIX "usertextfield SET 
customquicklinks = '' 
WHERE userid = 
{$vbulletin->userinfo['userid']}
"
); 

 
$url 'profile.php?do=editquicklinks'
eval(
print_standard_redirect($vbphrase['quicklinks_saved'],0)); 

Notice that the $vbulletin calls are surrounded in curley braces - this is necessary for substitution inside strings, if you escape the string and use a concatenation operator its different.
Reply With Quote
  #7  
Old 03-06-2006, 06:55 PM
DrewM DrewM is offline
 
Join Date: Oct 2005
Posts: 564
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks I'm just starting to learn php to mySQL.
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:47 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.03828 seconds
  • Memory Usage 2,257KB
  • 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
  • (4)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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_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