|
Thanks for replying ZurdoDev.
I was thinking it had to be something in the prepared statement that I have done wrong but can't figure it out. I ran a query to create the table and columns so assume that must be correct?
|
|
|
|
|
Somewhere you should be able to get the details of the error. I don't do much php but if you aren't seeing the error when you run it then maybe look in the logs.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
and180y wrote:
$sql = "INSERT INTO users (email, username, password) VALUES (?, ?)";
...
mysqli_stmt_bind_param($stmt, "ss", $param_email, $param_username $param_password); Two obvious problems:
You're inserting into three columns, but you've only specified two values:
$sql = "INSERT INTO users (email, username, password) VALUES (?, ?, ?)"; You've only specified types for two parameters, and you're missing a comma between the last two parameters:
mysqli_stmt_bind_param($stmt, "sss", $param_email, $param_username, $param_password);
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks for replying Richard.
I've fixed those errors but still having the same issue, it loaded the form once but now just a white page with the error.
|
|
|
|
|
I have played around starting again from the basic code and adding in what I need and checking for errors, all is fine till I put the code below in.
}
if(empty(trim($_POST["email"]))){
$email_err = "Please enter your email.";
} elseif(strlen(trim($_POST["email"])) < 6){
$email_err = "email must have at least 6 characters.";
} else{
$email = trim($_POST["email"]);
}
|
|
|
|
|
if(empty(trim($_POST["email"]))){
If the email variable is blank then calling trim on it will fail. You should change it to:
if(empty($_POST["email"])){
|
|
|
|
|
Working perfect now. Thanks Richard.
|
|
|
|
|
|
Richard, is there an error log generated somewhere for the DB? I get an intermittent fault (loads of folk saying the can't register but I can see some are able to) This is the error that shows on the form so not of much use. lol "Something went wrong. Please try again later".
|
|
|
|
|
Sorry, I don't know offhand. Check the MySQL documentation. I see that you are posting that message in your code. So you need to check why the call to mysqli_stmt_execute failed.
|
|
|
|
|
Thanks Richard,
I edited as you said the other night but wonder if my issue is somewhere in here?
if(empty($_POST["email"])){
$email_err = "Please enter your email.";
} elseif(strlen(trim($_POST["email"])) < 6){
$email_err = "email must have at least 6 characters.";
} else{
$email = trim($_POST["email"]);
}
}
|
|
|
|
|
Thanks Richard, progress made.
There is no error as such, if you try to register with the same email twice (yes I thought that as well) it throws the error I mentioned but isn't telling them the email is already registered. It does for username but the email was the bit I added in.
|
|
|
|
|
Did you not realise that you first need to check whether the email is already registered?
|
|
|
|
|
Hi Richard, thanks.
Everyday is a school day dealing with the humans I do.
|
|
|
|
|
Hi all,
I've done a small database and PHP based web page to be able to track my working hours easily.
Last week a customer asked me how many time in total each month I had spend in one project and I had to get all the times, filter by month manually and sum it all to give him an answer... a matter of 10 minutes, but I want to automate this kind of things...
My question is:
I will have a table that will be able to be grouped by day, week, month, year or not grouped, but then, I have to get the sum of all hours that I worked in my office, the sum of the hours that I worked out of my office, the sum of the hours travelling...
I can only think of doing something like
SELECT sumA,
sumB,
sumC
FROM
(
SELECT sumA,
type,
"0" as sumB,
"0" as sumC
From table1
WHERE type = A
UNION ALL
SELECT sumB,
type,
"0" as sumA,
"0" as sumC
From table1
WHERE type = B
UNION ALL
SELECT sumC,
type,
"0" as sumA,
"0" as sumB
From table1
WHERE type = C
)
AS VIEW1
Is this the way to do it?
I want to show the data in columns:
Hours at the office | hours out of the office | hours travelling
_____________________________________________________________________________________________________
JANUARY | | |
_____________________________________________________________________________________________________
FEBRUARY | | |
_____________________________________________________________________________________________________
MARCH | | |
_____________________________________________________________________________________________________
APRIL | | |
_____________________________________________________________________________________________________
...
And I would like to solve this in the database part, not creating different tables and then working in the PHP area...
Sorry for this way too much generic question, I hope I made it clear enough for you to enlighten me.
Thank you in advance!
|
|
|
|
|
Joan M wrote: And I would like to solve this in the database part, not creating different tables and then working in the PHP area Wrong tools for the jobs, database for servicing your data query and PHP for the presentation.
You could store your queries in a table, relate them to a query/stored proc and expose a title in a combo box for the user to select. Display would need to be an auto generated table to support different result sets.
The problem with this is that you may need to support different filtering parameters and you end up with an entire framework to support the reporting when it is faster and simpler to build a result page and query for each report request.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
hmmmm...
I meant this: I have all the data in the database, create a query and get the results that I show then in the web page using PHP.
I have all the "framework" done already, I can tune the queries easily filtering data, ordering and grouping at will...
But, maybe it would be much easier to create a "view" in PHPMyAdmin (I still don't know if this can be achieved but I'll look for it) and then the queries would be much easier.
After having the view, I would not have to create endless joins to get the data mixed correctly.
|
|
|
|
|
What database are you using?
If it is MS-SQL, then there is a command call PIVOT which will do exactly what you want to do.
|
|
|
|
|
MariaDB in this case, but thanks I'll take a look at PIVOT and see if there is something similar.
|
|
|
|
|
First of all: "Sorry for my english!" I recently have created a calibration database via Ms Access DBMS. Here is the model:
https://i.stack.imgur.com/Z2uBf.jpg[^]
Each tool has "name abzarLa" field that is actually "Tool's English Name" that comes from ToolList Table. Here is sample values of "ToolList" Table.
https://i.stack.imgur.com/cPwSk.jpg[^]
now it's time to explain my problem: each Tool based on its "name abzarLa" relates to its specific "Data Table" which contains Calibration data results with specific fields. (One To Many relationship => each tools has multiple row in "Data Table") Here is data table that uses for insert "Pressure gauge" results:
https://i.stack.imgur.com/ZEQ7e.jpg
[^]
And here is data table that uses for insert "Oven", "incubaor", "cold Incubator" results:
https://i.stack.imgur.com/4uzOp.jpg[^]
Ok, So we have a Tools table and multiple "Data Tables". How can I design "Data Tables" and create relationship between "Tools" table and "Data Tables" base on "name abzarLa" field?
One Design is:
https://i.stack.imgur.com/6bhdu.jpg[^]
but I want each tool only relates with its specific [Data Table]
|
|
|
|
|
Relationships are defined between tables, not records. Your parent table will need a relationship to all relevant tables. Your query can then join to those tables depending on the data in the parent record.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Bonjour,
Sous visuel studio 2012, je développe une application web .net. J'ai besoin de connecter à une base des données oracle 9i. Je suis en train de chercher un driver pour l'ajouter comme référence dans l'application afin d'interroger la base. Le problème que je n'ai pas trouvé sur le net un driver oracle 9i
Où se trouve ce driver ? Comment l'installer et l'utiliser ?
Merci d'avance pour toute aide.
|
|
|
|
|
En Anglais, si'l vous plait.
|
|
|
|
|
|
I have the next error :
ORA-03111: Break received on communication channel
|
|
|
|