vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   need help with converting my php to vbulletin (https://vborg.vbsupport.ru/showthread.php?t=105742)

Mickie D 01-19-2006 08:16 PM

need help with converting my php to vbulletin
 
this code below works fine out of the vbulletin system and converting it to work with vbulletin is proving very dificult for me can someone assist please

as you can see i did convert some of the code (i.e the get stuff)

PHP Code:


// ##### CLEAN GET COMMANDS AND PROCESS SEARCHSTR VARIABLE #####

$vbulletin->input->clean_gpc('r''item'TYPE_NOHTML); 
$searchstr $vbulletin->GPC['searchstr'];


// ##### CHECK SEARCHSTR IS NOT MORE THAN 8 DIGITS #####

if(strlen($searchstr) < 8)
{
$footoutput 'sorry you have entered more than 8 charactors for your players first name you wont find him like that';
}


$sql $db->query_read("SELECT SUBSTRING(footie_data,9,16) AS footie_data FROM football WHERE footie_data LIKE '$searchstr%'");


$results = @mysql_query($sql); 
$numResults = @mysql_num_rows($results); 

if(
$numResults >0

while (
$row mysql_fetch_object($results)) 


$footoutput=$row->footie_data
}


i think it may have something to do with this bit:

PHP Code:

$results = @mysql_query($sql); 
$numResults = @mysql_num_rows($results); 


i am using a template but its not displaying the results when i use the get command from the same template (maybe its not parsing it right ?) but all i get is the message from first instance of $footoutput and it wont search the database ??

im not sure if i can use the code above in vbulletin code ?

thanks for any help given

Regards
Mickie

anyone help ?

Mickie D 01-21-2006 04:00 PM

right i have been playing and can someone help i think im nearly there

edited code from above

PHP Code:


$results 
= @mysql_query($sql);    ### dunno what to do with this line
$numResults $db->num_rows($results);   

if(
$numResults >0)   
{   
while (
$row $db->fetch_array($results))  
{   

$footoutput=$row->footie_data;  ### dunno what to do with this line 
}  


the lines marked ### dunno what to.....

are where i am stuck but i think some advice is needed please

Kind Regards
Mickie

Guest210212002 01-21-2006 04:18 PM

I'm not sure the exact answer to your question, but my opinion is that the vb.com sales support guys should at least take a crack at answering this for you, so it might be worthwhile to post it over there.

Mickie D 01-21-2006 05:18 PM

i did with no response so far from yesterday.

i know i will get the modifying is todo with vbulletin.org reply sooner or later

i can write (well find all the stuff from php.net) that i need to make stuff but the whole vbulletin thing is beyond me they take the php code and use it a little different i think in a good way as i seen they use the $db-> to make it easier to call mysql, maybe if it was well documented or someone knew where i can find all the mysql calls (abbreviations) i would be a little better off... saying all that im not a coder i just know a few things from running a site for a while

i would be really greatful if someone could help i need to integrate this into my forums for my paid members,

Marco van Herwaarden 01-21-2006 06:19 PM

Try (not tested, not at my own PC now):

PHP Code:

// this line is also not needed, you already done in the full example above: $results = $db->query_read($sql);    ### dunno what to do with this line (or query_write)

while ($row $db->fetch_array($results))   
{    

$footoutput=$row['footie_data'];  ### dunno what to do with this line  


PS You will not get an answer about custom coding at vb.com

Mickie D 01-21-2006 07:44 PM

Quote:

Originally Posted by MarcoH64
Try (not tested, not at my own PC now):

PHP Code:

// this line is also not needed, you already done in the full example above: $results = $db->query_read($sql);    ### dunno what to do with this line (or query_write)

while ($row $db->fetch_array($results))   
{    

$footoutput=$row['footie_data'];  ### dunno what to do with this line  


PS You will not get an answer about custom coding at vb.com

thanks very much for the reply its getting closer with the code you have given me it actually pulls the first ID when i try and search it gives me the same result all the time.

basicly i insert "phillip" and it spits out "hendros-wiganund" if i then put in gavin it still spits out "hendros-wiganund" when it should have told me "banstop-wiganund"

so i am a step forward and happy i got a reply

thanks very much

any ideas guys ;)


All times are GMT. The time now is 04:17 PM.

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.01088 seconds
  • Memory Usage 1,749KB
  • 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
  • (5)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete