cuprasteve
-
Posts
14 -
Joined
-
Last visited
Never
Posts posted by cuprasteve
-
-
hi, no worres iv sorted it, thanks very much for your help, used addslahses in the end
-
hi, thanks muchly for the help, when you say addslashes whats the usage of that? can you show me an example using my line of code that i posted
thanks in advance -
Ok this is probably a very easy fix for this, but I cant find it and iv tried loads of different combinations of things.
The problem is with this insert line
[code]VALUES (".$board_config['delete_post_forum'].", '".sprintf($lang['Deleted_post_from_topic'], $topic_test)."', ".$post_data['poster_id'].", ".time().", 0, 0, ".TOPIC_UNLOCKED.", 0, ".POST_NORMAL.", $post_id, $post_id, 0, '$userna')";[/code]
$topic_test contains a post title for instance "Hi im new" which works fine, but if that title contains a ' for instance "You're day today" then it messes up the string and i get an error when it tries to insert in the database, any ideas?
im assuming i have to encapsulate $topic_test in some form of quote combination? -
hmm iv messed around with what i think will work from your examples but cant seem to get anywhere, let me show you.
The top of the function is as follows
[quote]function album_display_admin_index($cur = ALBUM_ROOT_CATEGORY, $level = 0, $max_level = -1, $column_offset=1)
{
global $db, $template, $phpEx, $lang, $images, $album_data, $userdata, $user_id, $cat_id, $var;
$var = "Dfg";
static $username = '';
// display 'the' level
$AH_this = isset($album_data['keys'][$cur]) ? $album_data['keys'][$cur] : ALBUM_ROOT_CATEGORY; //-1;
if (defined('IN_ADMIN'))
{
$admin_url = "admin_album_cat." .$phpEx;
$is_root = false;
}
else
{
$admin_url = "album_personal_cat_admin." .$phpEx;
$is_root = (($AH_this == ALBUM_ROOT_CATEGORY || $AH_this == 0)) ? true : false;
}
// root level
if ($AH_this == ALBUM_ROOT_CATEGORY)
{
$level = ALBUM_ROOT_CATEGORY;[/quote]
you can see a few lines down where I have tried to make $var= something.
below the function I have
echo $var
But i get nothing. As you can see iv added it to the Global list -
new problem, anyone know how to get it to read a variable set inside a Function from the previous page?
-
nevermind its working now, it was the positioning of the $var in the included page :) thanks for all your excellent help
-
the array is working fine as if i set $testvar in the same page then it pulls through the value to my template, but not if i try and set the variable in a page that is being included, so it seems, i havent mispelled anything
-
I have this code in a page called album_common
[code]if (!isset($album_root_path) || empty($album_root_path))
{
$album_root_path = $phpbb_root_path . 'album_mod/';
}
include($album_root_path . 'album_functions.' . $phpEx);
include($album_root_path . 'album_hierarchy_functions.' . $phpEx);
include($album_root_path . 'clown_album_functions.' . $phpEx);[/code]
and then further down
[code]$template->assign_vars(array(
'GLOBTEST'=> $testvar,
)
);[/code]
then in album_hierarchy_functions.php which you can see it including in that previous bit of code i Have $testvar="test";
But GLOBTEST in my template outputs nothing, if i stick $testvar="test"; in the same page it works fine -
well im doing the include to the previous page which has
$globtest = "test";
then on the new page i output and nothing appears -
even better if someone knows how to make it some form of global variable that can be read anywhere? is that poss?
-
[quote author=Orio link=topic=106371.msg425299#msg425299 date=1157025692]
page2.php will know that $myvariable=1.
You can test it:
page1.php will contain:
[code]<?php
$var="test";
?>[/code]
page2.php will be:
[code]<?php
include("page1.php");
echo $var;
?>[/code]
Orio.
[/quote]
that didnt seem to work for me, any ideas? -
is there a way of doing it without the include? like make it accessible just for that variable and now have to try and access the whole page?
-
Hi
If I have a PHP page called page1.php thats sets a variable, ie
$myvariable=1;
and i have a PHP page call page2.php that has an include(page1.php);
will it be able to know the value of the variable that is created in the other page?
If not is there a way i can get it to do this?
thanks
steve
[SOLVED] Help with my php search query
in PHP Coding Help
Posted
Hi all, hoping you can help, at the moment I have this that searchs the db for a string
All this works fine apart from if i search for "green seat arosa" it brings up all the stuff with seat | green | arosa in the tags. I need it to bring up results with all words entered into the search, but that can be anywhere in the tags field stored in the DB