Tagged Questions
2
votes
1answer
55 views
Storing Hierarchical Data in a Database
in a extension tho this post Pages system PHP/SQL
I've created this class/script to handle Multi-dimensional Menus wich data it's stored in a DB... I need some feedback and new ideas... (all of this ...
0
votes
1answer
45 views
Is this a safe way of using HTTP query parameters to build a SQL query?
Is it? And maybe theres a better way to do this?
$allowed = array("name_desc", "name_asc", "level_desc", "level_asc", "vocation_desc", "vocation_asc");
$order = isset($_GET['order']) ? $_GET['order'] ...
3
votes
1answer
59 views
Performance on PHP sql queries
I'm barely learning PHP and MYSQL so I don't know much about performance, I've wrote this script to fetch and format content from my DB, it also counts how many result are and separate them in to ...
4
votes
2answers
52 views
SQL - query syntax
I need advise whether my database structure is correct and what is the appropriate query syntax that can be used.
Table1
...
4
votes
1answer
68 views
Code Reiview for an PHP PDO Queries? is there a better way to do it?
so this is my code for a equipping an item in my game dev't:
try {
$db = getConnection();
$db->beginTransaction();
$sql_chara_gold = $db->query("SELECT chara_gold ...
-1
votes
2answers
118 views
Is my PHP code free of SQL injection vulnerabilities?
Could you have a quick look over my code to see if its safe from SQL injection etc.. and suggest any amendments?
<html>
<head><title>Retrieve Your Login Code</title>
...
0
votes
2answers
89 views
php script to retrieve enum values from sql table
I have an sql table with multiple fields and 4 of them are enums. I wrote a script that runs thought the table and retrieve the enums and put them in a 2 dimension array.
Unfortunately this script is ...
0
votes
2answers
49 views
Delete matching ID and insert new data
Delete all matching ID
Insert new data
function add_date($id,$date) {
mysql_query("DELETE FROM wp_opening_date WHERE Id='$id'");
$dates = explode(",",$date);
foreach ($dates as $date) {
...
2
votes
1answer
94 views
How can I improve this PHP code which builds an SQL query?
How can I write this PHP code better? It puts together an SQL query string from user input. The task is to return search results based on one or more text fields. The user can determine if partial ...
-1
votes
1answer
77 views
Connects to database but cannot get table [closed]
I use this php code to connect to my databse and retrieve the table food. I am able to connect to the database but no retrieve the table. I get this as a result: Host information: site.ipagemysql.com ...
5
votes
1answer
412 views
PHP Login Authentication with BCrypt
So I have a php authentication script and everything works fine. But I'm very unsure about the way I programmed it (i hardcoded some stuff) and I was hoping stack could look through this and point out ...
4
votes
1answer
187 views
Please review my PDO Database wrapper
The subject is this small project - PHP/MySQL Database wrapper
The three main goals of this projects are:
Easy way to map database columns to object properties
Simple solution to insert or update ...
3
votes
1answer
580 views
Codeigniter active record - prepared statement assistance
I understand that I should use prepared statements to prevent sql injection. Unfortunately, having read the php docs on the matter I am none the wiser. Here is one of my simple active record sql ...
1
vote
1answer
116 views
How can I improve the performance of this?
So, let me explain.
This is a function that checks that when users register into the site, they only create one single account per email. The little twist is that all emails in the DB are hashed with ...
3
votes
2answers
178 views
Best practices to protect a database from bad data
I'm just getting into SQL injection and data sanitization and seeking some advice on my script to get started. I have made this simple program which allows the user to enter their name into a form and ...