The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Using "trim" not working anymore?
A person wrote a system that allowed us to update mountain bike trail conditions on a single page - displaying all our trails and a quick condition next to each one.
This was written a while ago and I was able to get it working with vb 3.0 - but now the new 3.5 broke it again. I went in and replaced a bunch of $db calls and it seems to display just fine. However, when i click on a trail to edit the condition the script does not seem to pull out the action of "edit" Here is the snip of code that I think is not working and how it is called: Called via: Code:
http://www.morcmtb.net/forums/trail.php?s=&action=edittrail&trailid=21 Code:
// now the function used to get the info of the trail updated function gettrailinfo (&$trailid) { global $db; global $trailcache; $trailid = intval($trailid); // if (!isset($trailcache[$trailid])) { if ($db->trailcache[$trailid] == null) { $trailcache[$trailid]=$db->query_first("SELECT * FROM conditiontrail WHERE trailid='$trailid'"); } return $trailcache[$trailid]; } $action = trim($action); // if (!isset($action) or $action=="") { if (($db->action == null) or ($action=="")) { $action="showtrail"; } Can someone help? Its probably pretty obvious I'm no coder and its a real mess... |
#2
|
|||
|
|||
It's not the trim function; it's because $action isn't set:
Code:
// do like this to clean and set $action $vbulletin->input->clean_array_gpc('r', array('action' => TYPE_NOHTML)); $action = $vbulletin->GPC['action']; // do like this to use $action in a query action = '" . $db->escape_string($action) . "' |
#3
|
||||
|
||||
I'll give that a shot. Thanks!
Looks like I'm getting farther along now in the script. It now sees edittrail - thanks. Now I get an error I hope someone can help me through. The error is: Invalid SQL: SELECT descript FROM conditiontrail_general WHERE generalid=; The code on the line that generates this is: Code:
$lastconds=$db->query("SELECT descript FROM conditiontrail_general WHERE generalid=$trailinfo[general]"); |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|