The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#11
|
|||
|
|||
I am not interested in what you expect the value to be, but in the real value. You can use a vardump or echo to list the value.
If you are using query_first then you should not have te message that it is a resource id. |
#12
|
|||
|
|||
Quote:
Code:
//jfk $forum_name="$pagetitle"; $query=("SELECT forumid FROM " . TABLE_PREFIX . "forum WHERE title='$forum_name'"); $result=mysql_query($query); if( mysql_num_rows ($result)) //if it has a match from the database/table { $row=mysql_fetch_assoc($result); //lets get that matched row's id, and create a link $forum_link="<a href=\"/forums/forumdisplay.php?f=".$row["forumid"]."\">$forum_name Forum</a>"; } //end jfk |
#13
|
|||
|
|||
Not wrong, but not using teh vB coding standards and functions. Also, unless there is more code, you are not cleaning $forum_name before using it in a query, opening your board to SQL-Injections.
The "correct" vB way to do this: PHP Code:
|
#14
|
||||
|
||||
Not really following vB Coding Standards there either, Marco .
PHP Code:
|
#15
|
|||
|
|||
oh! i started a fight! (just kidding)
it is very nice to have TWO distinguished coders helping me with my little problem! i will study comments re quotes very carefully, as i know from experince how important those little jobbies can be! --------------- Added [DATE]1225368751[/DATE] at [TIME]1225368751[/TIME] --------------- with regard to "cleaning" $pagetitle. i am dropping this piece into an existing script, in which $pagetitle is preset... can i not assume that this is var is clean? this will not be introduced as an $input... or from a form etc... --------------- Added [DATE]1225370809[/DATE] at [TIME]1225370809[/TIME] --------------- Quote:
--------------- Added [DATE]1225371729[/DATE] at [TIME]1225371729[/TIME] --------------- could i ask another question please? this code (immediately above) doesnt have an "if" condition in it, as i previously had.... does this matter? what would happen it the query fails (no match in the db)? |
#16
|
||||
|
||||
Quote:
Quote:
PHP Code:
|
#17
|
|||
|
|||
thanx for reply (and amendment). could u comment on "cleaning" $pagetitle. am i correct in my assumption?
|
#18
|
|||
|
|||
|
#19
|
|||
|
|||
Quote:
regards --------------- Added [DATE]1226095204[/DATE] at [TIME]1226095204[/TIME] --------------- while i am here, would u like to comment on the following? this is the reciprocal link back to "page" from the forum Code:
//jfk $home_pageid = $forumTitle; $page_link = '<a href="/index.php?pageid=' . $home_pageid . '">' . $home_pageid . ' Page</a>'; //end jfk |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|