Instead of doing never end copy past between 2 joomla 2.5 website (I want to copy past their modul and articles)
Phpmyadmin :
How can I copy past a single or multiple row (article, module) from one jrm_content to jasso_content (they have both exactly the same colons type)
I know how to select rows and to import them, but after...? (I changed the id are different exept for some the Asset ID is it a problem?
Thanks a lot!
What's wrong with queries like this?
INSERT INTO tableNew
(col1,col2,col3,col4,col5)
(
SELECT
col1,col2,col3,col4,col5
FROM tableOld
)
select from tablename where table name.primary key = table name.foreign key
<?php
$sname=$_POST['srname'];
$link=mysql_connect("localhost","root","") or die("Cannot Connect to the database!");
mysql_select_db("human_resource",$link) or die ("Cannot select the database!");
$query="SELECT * FROM employee WHERE fname='$sname'";
$resource=mysql_query($query,$link);
echo "
<table align=\"center\" border=\"1\">
<tr>
<td><b>FName</b></td> <td><b>lname</b></td><td><b></b></td><td><b>Department</b></td></tr> ";
while($result=mysql_fetch_array($resource))
{
echo "<tr><td>".$result[1]."</td><td>".$result[2]."</td><td>".$result[3]."</td></tr>";
}
echo "</table>";
?>
Related
Table A
id
fullname
branch_code
Table B
id
branch_code
branch_name
I want to show list Table A with their branch name
here is the relation in table A
public function Branch () {
return $this->belongsTo('App\Model\Branch','branch_code','branch_code');
}
here is the controller
$TableA= TableA::orderBy('created_at','ASC')->get();
here is my blade
#foreach($TableAas $data)
<tr>
<td>{{ $i }}</td>
<td>{{$data->fullname}}</td>
<td>{{$data->Branch->branch_name}}</td>
</tr>
#endforeach
actually it works. but when i debug, i saw many duplicate queries like this
select top 1 * from [users] where [users].[branch_code] = '1001'
select top 1 * from [users] where [users].[branch_code] = '1002'
39.46ms
view::index:267
is there any way to make the query more simple and fast?
thank u
use with to load relation
$TableA= TableA::with('Branch')->orderBy('created_at','ASC')->get();
check EagerLoading problem and N+1 problem
select
lbi.book_issue_id|| '---'|| (
select staff_name
from lms_staff_detail
where staff_id = (
select lb.entity_owner_fk
from lms_borrower lb
where lb.borrower_id = lbi.borrower_id
)
) as display_value,
lbi.book_issue_id as return_value
from lms_book_issue lbi
where lbi.borrower_type = :P11_BOOK_RETURN_FORM
and book_rt_status = 1
and borrower_type = 'FACULTY'
im making a select list to display the id in the select list.
i didnt get any error in the code, but when i run it, the select list didnt show up the value or the data.
*to be honest i got this code from copy-paste so i didnt understand this code at all, but the one i copied working fine.
**i got all the table the same as the one i copied
anyone can help me?
If query itself runs OK and returns data, then I presume that you didn't put P11_BOOK_RETURN_FORM into Select List item's Parent item(s) (or Items to submit) property (under "Cascading list of values" group of properties).
I want to get multiple row data from table in controller .
like i have a likes table
columns are id and value
i want to get like this statement . select * from likes where id is this and value is that .
i don't really understand your question, but in order to " select * from likes where id is this and value is that ", try
App\Likes::where('id', this)
->where('value', that)
->get();
hope that helps. read more https://laravel.com/docs/5.5/queries#where-clauses
I want to create a CSV so I can migrate all my products images and categories from one domain on an opencart site to a new domain on my wordpress site, can anyone tell me how to do this task please -many thanks?
You can use the export/import tool
Please use the following SQL queries. for full script refer my tutorial.
https://www.pearlbells.co.uk/export-opencart-product-csv/
$sql = "SELECT p.product_id as Id, model, p.sku, upc, quantity,stock_status_id,image,manufacturer_id,shipping,"
. "price,weight,weight_class_id,length_class_id,subtract,minimum,status,name,tag,"
. "meta_title,meta_description,meta_keyword, pd.description as description"
. " FROM oc_product p LEFT JOIN oc_product_description pd ON (p.product_id = pd.product_id)"
. " WHERE pd.language_id = '1' GROUP BY p.product_id ORDER BY pd.name ASC";
$result = $conn->query($sql);
For Categories :
$sql = 'SELECT category_id,name,description,meta_title,meta_keyword,meta_description FROM oc_category_description ORDER BY name ASC ';
I am new to codeigniter. In my project I am getting some data from database and then showing them using codeigniter table->generate method. But I want to add an autoincrement column (like 1,2,3..) to show the row number in an additional column at the left of the table. Also, beside the number there will be checkbox to mark the row. Can anybody give me idea how can I do it in codeigniter?
You could add a count to your SQL query so that it is returned along with your results:
SET #n=0; SELECT #n := #n+1, * FROM example_table
Alternatively you could add the count to each result in PHP:
$count = 1;
foreach($results as $key => &$result){
array_push($result, $count);
$count++;
}
echo $this->table->generate($results);