Jump to content

cuprasteve

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

cuprasteve's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi all, hoping you can help, at the moment I have this that searchs the db for a string $words = split(" ", $s); $count = count(explode(" ", $s)); $c='0'; while ($c < $count) { $or = $or . "OR " . $where . " LIKE '%" . $words[$c] . "%' "; $c++; } $sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_approval, p.pic_file_name, p.pic_thumbnail, c.cat_id, c.cat_title, c.cat_user_id FROM " . ALBUM_TABLE . ' AS p,' . ALBUM_CAT_TABLE . " AS c WHERE p.pic_approval = 1 AND " . $where . " LIKE '%" . $s . "%' $or AND p.pic_cat_id = c.cat_id AND c.cat_view_level <> '3' ORDER BY p.pic_time DESC"; 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
  2. hi, no worres iv sorted it, thanks very much for your help, used addslahses in the end
  3. 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
  4. 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?
  5. 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
  6. new problem, anyone know how to get it to read a variable set inside a Function from the previous page?
  7. nevermind its working now, it was the positioning of the $var in the included page :) thanks for all your excellent help
  8. 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
  9. 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
  10. well im doing the include to the previous page which has $globtest = "test"; then on the new page i output and nothing appears
  11. even better if someone knows how to make it some form of global variable that can be read anywhere? is that poss?
  12. [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?
  13. 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?
  14. 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
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.