vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Few vbcoding queries (https://vborg.vbsupport.ru/showthread.php?t=189898)

Marco van Herwaarden 09-26-2008 05:23 AM

What is the value of $result['colscore']?

veenuisthebest 09-26-2008 05:35 AM

any integer between 1 to 10. But when 10 is the value, it doesn't select in list box !

Dismounted 09-26-2008 05:39 AM

Is that value "10" when it's meant to be "10"?

veenuisthebest 09-26-2008 05:41 AM

YES... sure !

I told in my second last post that 10 displays fine when using text-field BUT does not select through list box.

Marco van Herwaarden 09-26-2008 06:09 AM

Then what are you trying with:
PHP Code:

$score["$scor[0]"] = 'selected="selected"'

Why use $scor[0] when it is just an text value and not an array? $scor[0] will just return the first character, so if the value is "10" it will return "1":

PHP Code:

<?php
$result
['colscore'] = "10"
$scor $result['colscore']; 
echo 
"<br />Var result[colscore]: " $result['colscore'];
echo 
"<br />Var scor: " $scor;
echo 
"<br />Var scor[0]: " $scor[0];
 
?>

PS It is not an integer, but a text with the value "10".

veenuisthebest 09-26-2008 06:28 AM

Quote:

$scor[0] will just return the first character, so if the value is "10" it will return "1":
Yes.. I was getting exactly the same problem and I also noticed that this was happening with all 2 digit numbers like 10, 11, 12 and so on.

BUT I just figured it out and this WORKED:-

PHP Code:

$scor explode('-'$result['colscore']);
$score["$scor[0]"] = 'selected="selected"'


I just put explode and its working perfect. But may I know plz what explode did, that the list box is now selecting 2 digit numbers.

Dismounted 09-26-2008 08:19 AM

An explode makes $result['colscore'] an array, since it is the first and only element, it is assigned the ID of 0. You know you could just have done this:
PHP Code:

$score["$result[colscore]"] = 'selected="selected"'


veenuisthebest 10-15-2008 04:00 AM

I have a similar problem again but this time related to retrieving text values in select box.

I have this in template:-

HTML Code:

<select name="category" size="1" id="category">
<option value="Arts and Literature">Arts and Literature</option>
<option value="Blogs and Personal">Blogs and Personal</option>
<option value="Cartoon and Animations">Cartoon and Animations</option>
<option value="Technology">Technology</option>
</select>


Suppose, the value in the database is Technology, How do I retrieve it automatically selected in the select box.

Thank you


All times are GMT. The time now is 10:02 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.01680 seconds
  • Memory Usage 1,737KB
  • 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
  • (1)bbcode_html_printable
  • (4)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete