Please check this image ###### value showing que mark. If I upload this column value on database this value save with ??????? like.
I am using Spreadsheet_Excel_Reader in php
$data = new Spreadsheet_Excel_Reader("/var/www/office/office/public_html/aumfiles1/$file",true);
$folioNumber = addslashes(trim($data->val($j,3)));
??????????
SELECT rUnits FROM test_trans1 WHERE folioNumber='??????????' and productCode='test' and arn_id='66' and data_type='KARVY'
update test_trans1 set rUnits = '1458.747' WHERE folioNumber='??????????' and productCode='test' and arn_id='66' and data_type='KARVY'
??????????
Related
I' creating solr document via solarium plugin in php.
But the all document is stored text_general data type except id field. text_general is the default datatype in solr system.
My doubt is why id field is only to stored string type as default.
And If any possible to add document with string type using solarium plugin.
My code part is here,
public function updateQuery() {
$update = $this->client2->createUpdate();
// create a new document for the data
$doc1 = $update->createDocument();
// $doc1->id = 123;
$doc1->name = 'value123';
$doc1->price = 364;
// and a second one
$doc2 = $update->createDocument();
// $doc2->id = 124;
$doc2->name = 'value124';
$doc2->price = 340;
// add the documents and a commit command to the update query
$update->addDocuments(array($doc1, $doc2));
$update->addCommit();
// this executes the query and returns the result
$result = $this->client2->update($update);
echo '<b>Update query executed</b><br/>';
echo 'Query status: ' . $result->getStatus(). '<br/>';
echo 'Query time: ' . $result->getQueryTime();
}
The result document for the above code is here,
{
"responseHeader":{
"status":0,
"QTime":2,
"params":{
"q":"*:*",
"_":"1562736411330"}},
"response":{"numFound":2,"start":0,"docs":[
{
"name":["value123"],
"price":[364],
"id":"873dfec0-4f9b-4d16-9579-a4d5be8fee85",
"_version_":1638647891775979520},
{
"name":["value124"],
"price":[340],
"id":"7228e92d-5ee6-4a09-bf12-78e24bdfa52a",
"_version_":1638647892102086656}]
}}
This depends on the field type defined in the schema for your Solr installation. It does not have anything to do with how you're sending data through Solarium.
In the schemaless mode, the id field is always set as a string, since a unique field can't be tokenized (well, it can, but it'll give weird, non-obvious errors).
In your case i'd suggest defining the price field as an integer/long field (if it's integers all the way) and the name field as a string field. Be aware that string fields only generate hits on exact matches, so in your case you'd have to search for value124 with exact casing to get a hit.
You can also adjust the multiValued property of the field when you define the fields explicitly. That way you get only the string back in the JSON structure instead of an array containing the string.
I've exported reviews from mysql db in a csv format, and I've included created_at field. Now, when I open CSV file, date is in following format: 2014-02-04 13:31:43. So, I now want to import those reviews into different website, and everything works except for created_at date, for which I'm using following code:
// $_row['created_at'] = '2014-02-04 13:31:43';
// $_review is the object I created with
// $_review = Mage::getModel('review/review');
$_created_at = Mage::helper('core')->formatDate($_row['created_at'], 'medium', false);
$_review->setCreatedAt($_created_at);
but that doesn't set created_at properly. What's the correct way of achieving this?
Try this ...
$createdtime = new Zend_Date(strtotime($_row['created_at']));
$_created_at = Mage::getModel('core/date')->date('M d, Y', $createdtime);
$_review->setCreatedAt($_created_at);
I have a csv file.When it opens with character set 'UTF-8',it contains some values like
Bedre Psykiatri - Landsforeningen for p?ɬ•r?ɬ?rende
Central de Atendimento T?جø¬?cnico
Centro de Extens?جø¬?o Universit?جø¬?ria
Centro Universit?جø¬?rio Feevale
Now,I have php script , which reads the above csv file.
Let me know ,how can i check whether the strings getting from the csv file is a type of above pattern ?
you can do like this
<?php
$illegal = "#$%^&*()+=-[]';,./{}|:<>?~";
echo (false === strpbrk($YourCsvVarible, $illegal)) ? 'Allowed' : "Disallowed";
?>
Note :
strpbrk(string,charlist) it will return false when string not contain character which you passed in 2ed argument and see i have passed all character in $illegal = "#$%^&*()+=-[]';,./{}|:<>?~"; if you need more http://php.net/manual/en/function.strpbrk.php
Okay I am using a framework so I can pull database rows like: $username->thenthenameoftherow
But the row I want it to bet a variable because the variable is defined via a post method, I run that variable through an explode to get the first part, the text before the _
Yet when I run: and get currency like:
$coin = $_POST['coin'];
//currency they want to user
$currency = explode('_', $coin);
$username->$currency[1]
I can't set a hardcoded row for that, it has to be a userdefined viariable
I get the error:
Notice: Undefined property: stdClass::$usd in C:\xampp\htdocs\mvc\application\controllers\dashboard.php on line 193
Using mini mvc framework
Okay, for an exampple the post to set the $coin is BTC_USD I then explode it to remove the _ and get the 2nd part of the string which is USD I then want to get the USD table from my database by running the user query but I get that error.
Your code is basically:
$_tmp = $username->$currency;
$result = $_tmp[1];
Did you mean:
$_tmp = $currency[1];
$result = $username->$_tmp;
? Because if so, you want:
$result = $username->{$currency[1]};
do you mean
$username->currency[1]
without $ before currency
I use PHPExcel package in order to import data from .xls files to my database. From time to time the file is updated so I have to import it again. Before the import itself, I check if database already contains any of data included in .xls file.
In most cases, it works - data already included in DB is omitted, but still there are some values that are duplicated.
Here's what I do:
1. Query to DB: SELECT * FROM Table1, fetching the result to an array.
2. PHPExcel usage, get row value to a variable, check if the value already exists in the array
3. If yes - skip, if no - add to DB.
But there's a value "The name (xxx yyy zzz)" that IS included in the array (I used if ($array[0] == "The name (xxx yyy zzz)") and it returned true), but still PHP function array_search couldn't find it.
I used trim and still nothing. var_dump of variable, the actual value and the index value was the same. similar_text($array[0], "The name (xxx yyy zzz)") returned 2.
Please help, I ran out of ideas.
You would be better off using MySQL to do this:
ALTER IGNORE TABLE your-table ADD UNIQUE INDEX idx ( uniqueField, orFields );
This will remove all duplicated where the field or fields are the same. Drop the index once you are done:
ALTER TABLE your-table DROP INDEX idx
2 known issues:
1
I've once had a problem that is a bit similar. The problem ended up being that the imported data was read with an incorrect encoding. It lead to the following:
echo $str1; // output: foo
echo $str2; // output: foo
echo $str1 == $str2 ? "The same" : "Not the same"; // output: Not the same
I was only to understand it after I did the following:
for($i = 0; $i < strlen($str1); $i++) echo ord($str1[$i])." "; // 102 111 111
for($i = 0; $i < strlen($str2); $i++) echo ord($str2[$i])." "; // 102 0 111 0 111 0
I am guessing that you are running into something similar.
2
Another possibility is as suggested in the comments, that you have HTML in your string. To get that out in the open, do the following:
echo htmlspecialchars($str1); // foo
echo htmlspecialchars($str2); // <span>foo</span>
And/or view the source of your HTML page in the browser.