i'm trying to create a table with some button, a, glyphicon, span etc... but it is dynamic and goes inside php text. The table and the dynamic variables are showed but when I add everythings die. This is my code:
$output .= '<tr> <td>
<span class="glyphicon glyphicon-pencil"></span>
<span class="glyphicon glyphicon-remove"></span>
</td> <td>'.$product["Title"].'</td>
<td>'.money($product["Price"]).'</td>
<td>'.$category.'</td>
<td>'.$row1["mobile"].'</td></tr> ';' }
Related
I'm a beginner in mySQL database and html/css development,
I have a database which contain an "association" table and a "FinancialMaterial_assistance" table that contains every single association register, the received assistance, each with it's own id.
So my question is: how to filter and show in my list view every association with it's only own registration? (without showing registration of other association)
In my current listview , every association could see all the received assistance, without filtering or privacy and confidentiality of every one of them.
Thank you for help I will be grateful if you create or give my PHP code or condition. This is my code:
<?php
if(isset($_GET['search'])==false){
$sql="select * from don ORDER BY idSub ASC ";
$result=mysqli_query($con,$sql);
if($result){
$num = 1;
while($ass = mysqli_fetch_array($result)){
$idSub=$ass['idSub'];
$date=$ass['date'];
$nomDon=$ass['nomDon'];
$description=$ass['description'];
$quantite=$ass['quantite'];
$source=$ass['source'];
echo '
<tr>
<th scope="row">'.$num++.'</th>
<td>'.$date.'</td>
<td>'.$nomDon.'</td>
<td>'.$description.'</td>
<td>'.$quantite.'</td>
<td>'.$source.'</td>
<td><button class="btn btn-primary">
<i class="fa fa-pencil" aria-hidden="true"></i>
Edit
</button>
</td>
<td> <button class="btn" >
<i class="fa fa-trash-o" aria-hidden="true" red-color></i>
Delete
</button>
</td>
</tr>
';
} }
?>
by the way I didn't link tables yet
how to get data from table and pass it in controller in json format and get those data in view using angularjs
I want to get data from json encoded variable from controller and show it to view page using angularjs
view page using angularjs
<div class="card" ng-app = "myApp">
<table class="table table-hover" ng-controller = "menuController">
<thead>
<tr>
<th>Name</th>
<th>Parent menu</th>
<th>Order</th>
<th>Status</th>
<th class="text-center">Actions</th>
</tr>
</thead>
<tbody>
<tr ng-repeat = "x in values">
<td>{{x.name}}</td>
<td>{{x.parent_name}}</td>
<td>{{x.orders}}</td>
<td>{{x.status}}</td>
<td class="text-right">
<button type="button" class="btn btn-icon-toggle"
data-toggle="tooltip" data-placement="top"
data-original-title="Edit row">
<i class="fa fa-pencil"></i>
</button>
<button type="button" class="btn btn-icon-toggle"
data-toggle="tooltip" data-placement="top"
data-original-title="Copy row">
<i class="fa fa-copy"></i>
</button>
<button type="button" class="btn btn-icon-toggle"
data-toggle="tooltip" data-placement="top"
data-original-title="Delete row">
<i class="fa fa-trash-o"></i>
</button>
</td>
</tr>
</tbody>
</table>
</div>
var app = angular.module('myApp');
app.controller('menuController',function ($scope,$http) {
$scope.values = ["Milk", "Bread", "Cheese"];
});
PHP controller code
public function getmenu(){
$records=Menu::all();
return json_encode($records);
}
route code
Route::group(['prefix'=>'admin'],function(){
Route::get('/form','HomeController#form');
});
ErrorException (E_ERROR)
Use of undefined constant x - assumed 'x' (this will throw an Error in a future version of PHP) (View:form.blade.php)
I think it might be because you are serving your view which contains the angular code with Laravel, and in the file form.blade.php you use the angular syntax, which is the same as the blade one.
To solve that, you can try to remove blade word from the view filename, so it would become form.php or (alternative way instead of modifying the filename) each time you have to print something with the JavaScript framework instead of blade, use: #{{ variableToPrint }}.
So for example, part of your loop would become:
<tr ng-repeat="x in values">
<td>#{{x.name}}</td>
<td>#{{x.parent_name}}</td>
<td>#{x.orders}}</td>
<td>#{{x.status}}</td>
<!-- ... -->
You get the error as blade uses the same syntax to evaluate and print values, so if you write: {{ x.name }} blade finds a string literal x which gets interpreted as a constant.
If you prefix the # sign, blade will recognize that as an instruction not to be parsed, but that needs to be left as it is, it would just remove the #, leaving you with the correct code for you JavaScript loop
I already get all the data from the database and displayed it on my vue component. But, how can I display specific data on the table?
Like if the results from the database contains a user type of 'SuperAdmin'
I wanted to filter it like don't display if you find data related 'SuperAdmin'
https://imgur.com/kwTziOG - Here is my output.
I have searched this kind of problem and nothings pops-up.
Say for example.
['Paul','paul#new.com',['Admin']
['Paul', 'paul#new.com', ['SuperAdmin']
I just want to display the first array. Since it doesn't have a user type of SuperAdmin.
<tr v-for="user in users.data" :key="user.id">
<td>{{user.id}}</td>
<td>{{user.name}}</td>
<td>{{user.email}}</td>
<td>{{user.type}}</td>
<td>{{user.created_at |myDate}}</td>
<td>
<a href="#" #click="editModal(user)">
<i class="fa fa-edit"></i>
</a>
/
<a href="#" #click="deleteUser(user.id)">
<i class="fa fa-trash red"></i>
</a>
</td>
</tr>
I just displayed all the data being fetch in the database. Just wanted it to filter it somehow.
I have not used Vue in alittle while but if I remember correctly you can just use 'v-if' and it will conditionally render the data. Below is an example of how this could be done.
Possible Solution
<tr v-for="user in users.data" :key="user.id">
<div v-if="user.type == 'SuperAdmin'">
<td>{{user.id}}</td>
<td>{{user.name}}</td>
<td>{{user.email}}</td>
<td>{{user.type}}</td>
<td>{{user.created_at |myDate}}</td>
<td>
<a href="#" #click="editModal(user)">
<i class="fa fa-edit"></i>
</a>
<a href="#" #click="deleteUser(user.id)">
<i class="fa fa-trash red"></i>
</a>
</td>
</div>
</tr>
Hope this answered your question, good luck!
I have the following <td> tag with <a> tag in it that contains a php variable in href. I only can browse upto uploads folder. Does anyone know why? It supposed to browse until uploads\$_POST['searchInput'] . But it is not doing that.
<td class="viewEditTd"><button class = "btn btn-info viewEditButton"><a href="file://///172.xx.xx.xxx\TEMP\xxx\uploads\"<?php echo $_POST['searchInput']; ?>"\" target="_blank"><span class="
glyphicon glyphicon-folder-open" aria-hidden="true"></span> View File</a></button></td>
I am able to solve the issue with the help of Stack overflow forum member. This is how it solved. My issue was as below
<td class="viewEditTd"><button class = "btn btn-info viewEditButton"><a href="file://///172.xx.xx.xxx\TEMP\xxx\uploads\"<?php echo $_POST['searchInput']; ?>"\" target="_blank"><span class="
glyphicon glyphicon-folder-open" aria-hidden="true"></span> View File</a></button></td>
It was solved by removing the two double quotes around the php tags. Working answer is
<td class="viewEditTd"><button class = "btn btn-info viewEditButton"><a href="file://///172.xx.xx.xxx\TEMP\xxx\uploads\<?php echo $_POST['searchInput']; ?>" target="_blank"><span class="
glyphicon glyphicon-folder-open" aria-hidden="true"></span> View File</a></button></td>
I'm developing a small project in which I use a loop to display all the contents of a database table in an HTML table. For each row I need a clickable button that, if pressed , can "remember" the ID of the table's element to witch it corresponds. I've some problem with the href of the link. That's my code:
<td>
<i class="small material-icons right">mode_edit</i>
</td>
I've also tried this:
<td>
<i class="small material-icons right">mode_edit</i>
</td>
Can anyone help me please? Thanks!
You're not setting any $_GET variable name in your href attribute.
Try replacing
<i class="small material-icons right">mode_edit</i>
By
<i class="small material-icons right">mode_edit</i>
Basically, I've added id between the ?=. And removed the space in your $row[' ID ']
modifica.php?id=
Instead of
modifica.php?=
I've removed the space in the index of the $row variable because $row[' ID '] is not the same as $row['ID'].
You should probably remove the spaces within the square brackets and add a name to the GET variable, it would look like this:
<td>
<i class="small material-icons right">mode_edit</i>
</td>
instead of writing
$row[ ' ID ']
use
$row['ID']
you have spaces before and after ID text, fix that please