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

Reply
 
Thread Tools Display Modes
  #1  
Old 11-28-2002, 09:17 PM
ManagerJosh's Avatar
ManagerJosh ManagerJosh is offline
 
Join Date: Feb 2002
Posts: 348
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default non-vb script help

Could someone tell me what I did wrong? I suck at PHP and it shows really

Parse error: parse error, unexpected T_STRING in /home/virtual/site3/fst/var/www/html/store/admin/includes/functions/general.php on line 785


PHP Code:
// the $filename parameter is an array with the following elements:
// name, type, size, tmp_name
  
function tep_copy_uploaded_file($filename$target) {
 
    if (
substr($target, -1) != '/'$target .= '/$manufacturers_data['manufacturers_directory']';

    
$target .= $filename['name'];

    
move_uploaded_file($filename['tmp_name'], $target);
  } 

I modified this and it gave me the error

PHP Code:
    if (substr($target, -1) != '/'$target .= '/$manufacturers_data['manufacturers_directory']'
Reply With Quote
  #2  
Old 11-28-2002, 09:38 PM
NTLDR's Avatar
NTLDR NTLDR is offline
Coder
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 3,644
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try:

PHP Code:
if (substr($target, -1) != '/'$target .= "/$manufacturers_data['manufacturers_directory']"
I expect it doesn't like the nested ' in the variable name
Reply With Quote
  #3  
Old 11-28-2002, 10:49 PM
ManagerJosh's Avatar
ManagerJosh ManagerJosh is offline
 
Join Date: Feb 2002
Posts: 348
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by NTLDR
Try:

PHP Code:
if (substr($target, -1) != '/'$target .= "/$manufacturers_data['manufacturers_directory']"
I expect it doesn't like the nested ' in the variable name
I got

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/virtual/site3/fst/var/www/html/store/admin/includes/functions/general.php on line 782

with your recommended suggestion.
Reply With Quote
  #4  
Old 11-28-2002, 10:56 PM
NTLDR's Avatar
NTLDR NTLDR is offline
Coder
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 3,644
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Lets try with {}:

PHP Code:
if (substr($target"-1") != "/") {
    
$target .= "/$manufacturers_data['manufacturers_directory']";

If that doesn't work try:

PHP Code:
$target2=substr($target"-1");
if (
$target2!= "/") {
    
$target .= "/$manufacturers_data['manufacturers_directory']";

Reply With Quote
  #5  
Old 11-28-2002, 11:07 PM
ManagerJosh's Avatar
ManagerJosh ManagerJosh is offline
 
Join Date: Feb 2002
Posts: 348
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by NTLDR
Lets try with {}:

PHP Code:
if (substr($target"-1") != "/") {
    
$target .= "/$manufacturers_data['manufacturers_directory']";

If that doesn't work try:

PHP Code:
$target2=substr($target"-1");
if (
$target2!= "/") {
    
$target .= "/$manufacturers_data['manufacturers_directory']";


Neither works NTLDR.


Just to let you know the original is:

PHP Code:
  function tep_copy_uploaded_file($filename$target) {
 
    if (
substr($target, -1) != '/'$target .= '/';

    
$target .= $filename['name'];

    
move_uploaded_file($filename['tmp_name'], $target);
  } 
Problem is that with that, it uploads a file to a directory and I'm hoping that variable I added (From data it is pulling from the MySQL) will allow me to upload to that directory I specified.

THe current directory it is uploading to is /images/

I'm hoping with that variable it uploads to: /images/$manufacturers_data['manufacturers_directory'] where $manufacturers_data['manufacturers_directory'] would be information it is obtaining from MySQL.

I think i might be overlooking something which may be why it isn't working.
Reply With Quote
  #6  
Old 11-28-2002, 11:12 PM
ManagerJosh's Avatar
ManagerJosh ManagerJosh is offline
 
Join Date: Feb 2002
Posts: 348
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here are the files just to give you an idea what I'm dealing with

-_-
Attached Files
File Type: zip new folder.zip (21.5 KB, 8 views)
Reply With Quote
  #7  
Old 11-28-2002, 11:23 PM
NTLDR's Avatar
NTLDR NTLDR is offline
Coder
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 3,644
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

All I can think of is to make sure you add:

PHP Code:
global $manufacturers_data
After the function line which is need, other than that I can't think of anything else right now.
Reply With Quote
  #8  
Old 11-29-2002, 07:41 AM
ManagerJosh's Avatar
ManagerJosh ManagerJosh is offline
 
Join Date: Feb 2002
Posts: 348
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

in general.php and not another php script in the zip file I attached.

Perhaps I should ask for help to finish this script up cause I'm stumped really bad.

Should I ask in this forum or should I ask in the Help Me Finish Forum? I get the impression the Help Me Finish Forum is limited to vB hacks...though I might be wrong..

If a mod would point this thread in the right direction...
Reply With Quote
  #9  
Old 11-29-2002, 12:11 PM
MUG MUG is offline
 
Join Date: Apr 2002
Posts: 104
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You can't use quotes when dealing with arrays in double-quotes. Try:
PHP Code:
if (substr($target, -1) != '/'$target .= "/$manufacturers_data[manufacturers_directory]"
Reply With Quote
  #10  
Old 11-29-2002, 07:51 PM
ManagerJosh's Avatar
ManagerJosh ManagerJosh is offline
 
Join Date: Feb 2002
Posts: 348
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by MUG
You can't use quotes when dealing with arrays in double-quotes. Try:
PHP Code:
if (substr($target, -1) != '/'$target .= "/$manufacturers_data[manufacturers_directory]"
Wouldn't that affect my variable in the first place? Because my variable is:

PHP Code:

$manufacturers_data
['manufacturers_directory'
where i have specified earlier that:


PHP Code:
    $manufacturers_array = array(array('id' => '''text' => TEXT_NONE));
    
$manufacturers_query tep_db_query("select manufacturers_id, manufacturers_name, manufacturers_directory from " TABLE_MANUFACTURERS " order by manufacturers_name");
    while (
$manufacturers tep_db_fetch_array($manufacturers_query)) {
      
$manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'],
                                     
'text' => $manufacturers['manufacturers_name']);
    }
    
// Directory Code Hack
    
$manufacturers_data tep_db_fetch_array($manufacturers_query);
// Directory Code Hack 

Edited: your suggestion works MUG, but I wonder if it affects my variable...
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 07:17 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06696 seconds
  • Memory Usage 2,318KB
  • Queries Executed 14 (?)
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
  • (14)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)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
  • postbit_attachment
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete