I'm sorry for my bad english, I have a little problem but i don't understand how to solve it.
When I do SQL update, I have one question mark ? which appears in the field
Here is the code
public function FooterUpdate($footer_text, $client_id) {
$connection = new Connection;
$db = $connection->openConnection();
$req = $db->prepare("UPDATE jcmsi_parametre SET footer_text = :footer_text WHERE client_id = :client_id");
$req->bindValue(':footer_text', $footer_text);
$req->bindValue(':client_id', $client_id);
$req->execute();}
The text before insert
<p><em class="fa fa-arrow-right"></em>Contact</p>
The text after insert
<p><em class="fa fa-arrow-right"></em><a href="contact.php" >Contact?</a></p>
After the insert query, I have the word Contact with the question mark ?.
I try echo $footer_text just before update and the text is ok, but not in sql
If you have an idea
Thank you
Didier
Related
Hello I have tried every forum and resource i have and can still not find the answer to my question.
I am making a booking management system. One of the features is the admin can search someones email and get their details from the database. So i put a line edit so i can get the QString from the email and then i tried to parse it into a SQL query. Thought this would be easy but QT said no. so i am at a complete loss.
Any help will be much appreciated.
The code:
QString email = ui->lineEdit_custsearch->text();
QSqlQuery qry;
QString dets = "SELECT firstname FROM customer WHERE email=="+email+"";
if (qry.exec(dets))
{
for (int i = 0;qry.next();i++)
{
ui->lineEdit_first->setText(qry.value(0).toString());
}
}
In SQL you only need to use a single '=', sign, might be worth giving that a try?
SELECT firstname FROM customer WHERE email="+email+"
Just a suggestion, to make it more readable, it might be worth using string interpolation too so something like the below:
string email = '';
QString dets = $"SELECT firstname FROM customer WHERE email='{email}'";
Im trying to create a specific IF statement on the clientareaproductdetails.tpl file in WHMCS - bottom line i'm trying to display some text on a page depending on the product the customer is looking at.
So this is what I tried (which does not work)
{if $id == '17'} something {else} nothing {/if}
So if the product ID = 17 then display 'something' otherwise display 'nothing.
Any ideas if/how this is possible?
Thanks in advance.
H
If by product id, you mean the package id, then it explains why your code didn't work. $id variable is for service id.
To achieve what you want, Add a hook file (say: custom_product_message.php) to includes/hooks/ folder.
Then add the following code:
<?php
add_hook('ClientAreaProductDetailsOutput', 1, function($service) {
if (!is_null($service)) {
if ($service['service']->packageId == 17) {
return "something";
} else {
return 'nothing';
}
}
return '';
});
The idea is to use ClientAreaProductDetailsOutput hook to display a text in the clientarea productdetails page.
I try to show my category uid or name as a class="category.uid" at my FLUID template.
If I try <f:debug>{data}</f:debug> I'll see there are an output like: categories => '1' (1 chars)
But how can I write the category-uid or -name into my FLUID/HTML, similar like this:
<div id="container" class="{data.nav_title}">
<!-- I need the categories -->
<div id="container" class="{categories.uid}">
THanks for your help.
EDIT: some screenshots
The info is in table sys_categorytitle, uid, pid ..
`{data}
The same problem is discussed here (see 11:30 - 12:31).
So there is no viewhelper for this. You have to register a ContentController with Flux.
I have used a variant of the solution here: How can I get the category object in Fluid of Typo3 Content Element Pictures?
TypoScript
lib.categories = CONTENT
lib.categories {
table = sys_category
select {
pidInList = root
selectFields = sys_category.uid
join = sys_category_record_mm on sys_category_record_mm.uid_local = sys_category.uid
where.field = recordUid
where.wrap = sys_category_record_mm.uid_foreign=|
}
renderObj = COA
renderObj {
1 = TEXT
1 {
field = uid
stdWrap.noTrimWrap = | cat-||
}
}
}
Fluid Template
<f:cObject typoscriptObjectPath="lib.categories" data="{recordUid: data.uid}" />
Sorry for the answer - i do not have enough reputation to comment.
What is {data}?
Is it something you get from your controller like?
$data = $this->configurationManager->getContentObject()->data;
$this->view->assign('data', $data);
If so, then you will need to do some extra processing in your controller since $data is an associated array and not an object / model with injection of relations.
I've problem with DataGrid in Dojo 1.6. I create DataGrid on HtmlStore and I want to put in cells in last column links to some actions. I read on documentation that option escapeHtmlInData="false" can do that, but it doesn't work.I know that is dangerous (XSS attacks), but solution with formatter is not pretty for me. So I don't know why escapeHtmlinData doesn't work. Maybe it's fault of HtmlStore? Maybe someone had a similar problem? I can paste my piece of code but I use Django and dojango.
For others:
dojo.extend(dojox.data.HtmlStore,{
getValues: function(item,attribute){
this._assertIsItem(item);
var index = this._assertIsAttribute(attribute);
if(index>-1){
var text;
if(item.cells){
if({%for value in noEscapeData%}attribute=="{{value}}"{%if not forloop.last %} || {%endif%}{%endfor%}){
text = item.cells[index].innerHTML;
}else{
text = dojox.xml.parser.textContent(item.cells[index]);
}
}else{//return Value for lists
text = dojox.xml.parser.textContent(item);
}
return [this.trimWhitespace?dojo.trim(text):text];
}
return []; //Array
},
});
where noEscapeData is array with column name where is not escape data
For example:
$lang['Select Project'] = 'Select Project OK';
$lang['Project'] = 'Project';
I want to find only the instances of the word 'Project' not contained within the square brackets.
I'm using ColdFusion studio's extended replace utility to do a global replace.
Any suggestions?
Code Sample Follows:
<?php
$lang['Project Message Board'] = 'Project Message Board';
$lang['Project'] = 'Project';
$lang['Post Message'] = 'Post Message';
$lang['To'] = 'To';
$lang['Everyone'] = 'Everyone';
$lang['From'] = 'From';
$lang['Private Messsage'] = 'Private Messsage';
$lang['Note: Only private message to programmer'] = '[ Note: Please enter programmers id for private message with comma separate operator ]';
$lang['Select Project'] = 'Select Project';
$lang['message_validation'] = 'Message';
$lang['You must be logged in as a programmer to post messages on the Project Message Board'] = 'You must be logged in as a programmer to post messages on the Project Message Board';
$lang['Your Message Has Been Posted Successfully'] = 'Your message has been posted successfully';
$lang['You must be logged to post messages on the Project Message Board'] = 'You must be logged to post messages on the Project Message Board';
$lang['You must be post project to invite programmers'] = 'You must be post project to invite programmers';
$lang['You must be logged to invite programmers'] = 'You must be logged to invite programmers';
$lang['There is no open project to Post Mail'] = 'There is no open project to Post Mail';
$lang['You are currently logged in as']='You are currently logged in as';
$lang['Tip']='Tip: You can post programming code by placing it within [code] and [/code] tags.';
$lang['Submit']='Submit';
$lang['Preview']='Preview';
$lang['Hide']='Hide';
$lang['Show']='Show';
$lang['You are currently logged in as']='You are currently logged in as';
A regexp for 'Project' to the right of an equals sign would be:
/=.*Project/
a regexp that also does what you ask for, 'Project' that has no equals sign to its right would be:
/Project[^=]*$/
or a match of your example lines comes to:
/^\$lang['[^']+']\s+=\s+'Project';$/
By placing 'Project' in brackets () you can use that match in a replacement, adding the flag /g finds all occurences in the line.
Edit: Below didn't work because look-behind assertions have to be fixed-length. I am guessing that you want to do this because you want to do a global replace of "Project" with something else. In that case, borrowing rsp's idea of matching a 'Project' that is not followed by an equals sign, this should work:
/Project(?![^=]*\=)/
Here is some example code:
<?php
$str1 = "\$lang['Select Project'] = 'Select Project OK';";
$str2 = "\$lang['Project'] = 'Project';";
$str3 = "\$lang['No Project'] = 'Not Found';";
$str4 = "\$lang['Many Project'] = 'Select Project owner or Project name';";
$regex = '/Project(?![^=]*\=)/';
echo "<pre>\n";
//prints: $lang['Select Project'] = 'Select Assignment OK';
echo preg_replace($regex, 'Assignment', $str1) . "\n";
//prints: $lang['Project'] = 'Assignment';
echo preg_replace($regex, 'Assignment', $str2) . "\n";
//prints: $lang['No Project'] = 'Not Found';
echo preg_replace($regex, 'Assignment', $str3) . "\n";
//prints: $lang['Many Project'] = 'Select Assignment owner or Assignment name';
echo preg_replace($regex, 'Assignment', $str4) . "\n";
This should work:
/(?<=\=.*)Project/
That will match only the word "Project" if it appears after an equals sign. This means you could use it in a substitution too, if you want to replace "Project" on the right-hand-side with something else.
Thx for help. Not sure what is unclear? I just want to find all instances of the word 'Project' but only instances to the right of the equals sign (i.e. not included in square brackets). Hope that helps.
This actually looks like a tricky problem. Consider
[blah blah [yakkity] Project blah] Project [blah blah] [ Project
This is a parsing problem, and I don't know of any way to do it with one regex (but would be glad to learn one!). I'd probably do it procedurally, eliminating the pairs of brackets that did not contain other pairs until there were none left, then matching "Project".
While it's not clear what instances you want to find exactly, this will do:
^.+? = (.+?);
But you might consider using simple string manipulation of your language of choice.
edit
^.+?=.+?(Project).+?;$
will only match lines that have string Project after the equal sign.
[^\[]'[^'\[\]]+'[^\]] seems to accomplish what you want!
This one: [^\[]'[^'\[\]]*Project[^'\[\]]*' will find all strings, not inside of the file that are contained in quotes, and contain the word project.
Another edit: [^\[]'(?<ProjectString>[^'\[\]]*Project[^'\[\]]*)'[^\]]
This one matches the string, and returns it as the group "ProjectString". Any regex library should be able to pull that out sufficiently.