PDA

View Full Version : need help with converting my php to vbulletin


Mickie D
01-19-2006, 08:16 PM
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)



// ##### 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:


$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



$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):

// 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
Try (not tested, not at my own PC now):

// 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 ;)