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 08-16-2002, 04:47 AM
mr e's Avatar
mr e mr e is offline
 
Join Date: Dec 2001
Posts: 461
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default can't get info from mysql

ok i have a completely different page, nothing to do with vb, but here's what i have so far...

PHP Code:
$DB mysql_connect"localhost"$DBUSER$DBPASS ) or die("Could not connect to $DBNAME");

mysql_select_db$DBNAME$DB ) or die("Could not find database");

function 
view() {
        
$getshouts mysql_query("SELECT * FROM shouts");
        while(list(
$shouts) = mysql_fetch_array($getshouts$DB)) {
        echo 
$shouts[name];

        }
... 
and yes i DO have more in the view() funcion but i only listed what was neccessary, basically i can't get it to echo anything out, im only using the echo as a test to see if i can actually use the variables, i have tried quite a variety of ways but still can't figure out whats up...hope you can help
Reply With Quote
  #2  
Old 08-16-2002, 11:29 AM
Dark_Wizard Dark_Wizard is offline
 
Join Date: Nov 2001
Location: North Carolina
Posts: 1,251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This:
Code:
echo $shouts[name];
should be this:
Code:
echo "$shouts[name]";
Reply With Quote
  #3  
Old 08-17-2002, 06:14 AM
mr e's Avatar
mr e mr e is offline
 
Join Date: Dec 2001
Posts: 461
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

this is what i have now, i've narrowed it down and i know it's something to do with the SELECT
PHP Code:
$getshouts mysql_query("SELECT name FROM shouts");
if (!
$getshouts) {
echo(
"<P>Error performing query: " mysql_error() . "</P>");
exit();
;}

echo 
"Your name is $name ! "
and i have 4 entries all the same and it prints
Your name is ! Your name is ! Your name is ! Your name is !
so i dunno what the problem is, so hope someone can help
Reply With Quote
  #4  
Old 08-17-2002, 11:33 AM
Dark_Wizard Dark_Wizard is offline
 
Join Date: Nov 2001
Location: North Carolina
Posts: 1,251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Change this:
Code:
$getshouts = mysql_query("SELECT name FROM shouts");
if (!$getshouts) {
echo("<P>Error performing query: " . mysql_error() . "</P>");
exit();
;}

echo "Your name is $name ! ";
to this:
Code:
$getshouts = mysql_query("SELECT name FROM shouts WHERE name=$name");
if (!$getshouts) {
echo("<P>Error performing query: " . mysql_error() . "</P>");
exit();
;}

echo "Your name is $name ! ";
Reply With Quote
  #5  
Old 08-18-2002, 08:57 PM
Ajay Ajay is offline
 
Join Date: Nov 2001
Location: Chicago
Posts: 60
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
        $getshouts mysql_query("SELECT * FROM shouts"); 
change that to
this should work:
PHP Code:

$getshouts 
"SELECT * FROM shouts";
mysql_query($getshouts
or something similar
Reply With Quote
  #6  
Old 08-18-2002, 10:07 PM
mr e's Avatar
mr e mr e is offline
 
Join Date: Dec 2001
Posts: 461
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok i finally got it, thanks all
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 11:11 AM.


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.04253 seconds
  • Memory Usage 2,214KB
  • Queries Executed 11 (?)
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_code
  • (4)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)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