All posts in Backend Web Development
can we set cookies and have sweet alert redirect at the same time?
- Post By Coll 23
- 4 years ago
Hi Manfred, As per my register.php screenshot, how can we set cookies and have sweet alert redirect at the same time?
How can i create a proper message text area with input tag to store php value?
- Post By Coll 23
- 4 years ago
Isset function on echoing out alerts
- Post By Coll 23
- 4 years ago
Hi all,
Redirect navbar links to another page via php
- Post By Coll 23
- 4 years ago
Hi admins,
Config error at my output page
- Post By Mike Hunt Is Bald
- 4 years ago
There is an error message when i do not fill in the compulsory fields.
PHP : Redirect user back to LoggedIn page after logging in
- Post By Ng WJ
- 4 years ago
I have problem coding for SESSION approach using in index.php (login page)
Is there a difference when deleting cookies using the PHP setcookie() Function by using "0" or "false" as Boolean values instead of using an empty string (like this " ")?
- Post By Arun Raj
- 4 years ago
Hello everyone!
But my question is, is there any other differences between the first and the other two methods? Or is it just a matter of personal choice/company culture?
How to set Gender Male to show the word "Male" when I echo it from radio button?
- Post By Mike Hunt Is Bald
- 4 years ago
Hello my code is
Multiple Files Upload
- Post By Li Sen TAN
- 4 years ago
undefined array key and variable
- Post By Coll 23
- 4 years ago
include('core/config.php');
include('core/db.php');
include('core/functions.php');
isNotLoggedIn(); //redirect to login page
$userID = $_COOKIE["userID"];
// Query user info from DB
$userQuery = DB::query("SELECT * FROM users WHERE userID = %i", $userID);
foreach($userQuery as $userResult){
$userEmail = $userResult["userEmail"];
$userPermission = $userResult["userPermission"];
}
// Setting permission text
if($userPermission == 1){
$userPermissionText = "Admin";
}else if($userPermission == 0){
$userPermissionText = "User";
}
Any idea why is this error popping up?
Django Admin interface- Recent object title and object name doesn't work
- Post By Coll 23
- 4 years ago
I have tried this method:
1) python manage.py makemigrations >>No changes detected
2) python manage.py migrate>>
Operations to perform:
Apply all migrations: admin, auth, contenttypes, menu, sessions
Running migrations:
No migrations to apply.
3) CTRL + SHIFT + R to hard reset http://127.0.0.1:8000/admin/
4) Adding a new menu via http://127.0.0.1:8000/admin/menu/menu/add/
#models.py page
from django.db import models
class Menu(models.Model):
productName = models.CharField(max_length=255)
price = models.FloatField()
image_url = models.CharField(max_length=2083)
category = models.CharField(max_length=255)
def _str_ (self):
return self.product_name
#admin.py page
from django.contrib import admin
from .models import Menu
class MenuAdmin(admin.ModelAdmin):
list_display =('productName', 'price','image_url','category')
admin.site.register(Menu, MenuAdmin)
How to change Display Name of an Object in Django Admin interface?
- Post By Arun Raj
- 4 years ago
Whenever an instance of model is created in Django, it displays the object as ModelName Object(1).
How do we make changes to our code so that it changes the display name to its own name?
How to use objects.filters in Django?
- Post By Mike Hunt Is Bald
- 4 years ago
Hello. For Assignment 1 last question,
Create respective categories pages "/menu/{category_name}" to display all menu items from the database according to their categories
Categories to use:
Starters
Mains
Beverages
Desserts
I have the page up and tested with Http response and I have an idea of using object.filter() to do the separation of item by category.
I have a problem with the code as i tried it multiple way of putting it as below
def Starters(request):
starter = Menu.objects.filters(Menu_menu_category=Starters)
return render(request, 'index.html', {'Menu': starter})
and also
def Starters(request):
starter = Menu.objects.filters(category=Starters)
return render(request, 'index.html', {'Menu': starter})
How do make that function to pick up my data from the table column?
forEach-Loop
- Post By Coll 23
- 4 years ago
//When i print out the code below, it give ms only 1 result . Not sure why.//
$bikes = array("Honda"=>"exMotion", "Honda"=>"Adv150", "Honda"=>"NC750");
foreach($bikes as $bike => $model) {
echo "$bike = $model
";
}