-
Posts
24,605 -
Joined
-
Last visited
-
Days Won
830
Everything posted by Barand
-
Just telling us that something "doesn't work" doesn't work.
-
if (form entry is not blank) insert record else don't endif
-
-
The clue was in "ORDER BY"
-
Notice: Trying to get property of non-object in
Barand replied to PythonHelp's topic in PHP Coding Help
The bit that tells you what the function returns, perhaps. -
Can't believe that query produces anything. When you say "grouped by" do you mean "ordered by"? There is a huge difference in SQL between the two.
-
Notice: Trying to get property of non-object in
Barand replied to PythonHelp's topic in PHP Coding Help
It's time to re-read the manual regarding mysqli_fetch_row() -
Notice: Trying to get property of non-object in
Barand replied to PythonHelp's topic in PHP Coding Help
Have you ever considered looking at the manual? https://www.php.net/manual/en/class.mysqli-result.php -
Notice: Trying to get property of non-object in
Barand replied to PythonHelp's topic in PHP Coding Help
"attendance" is a table identifier and should not, therefore, be inside quotes. Quotes are for string literals. -
Notice: Trying to get property of non-object in
Barand replied to PythonHelp's topic in PHP Coding Help
Put this line just before you connect to the mysqli server... mysqli_report(MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT); -
You hope in vain. What have you tried?
-
For $_POST['Att_date'] to exist you need a form input field with that name. The only one I see is 'Presence' Hard to tell with your complete lack of indentation, but it looks like you start a new form for every table row but only have one end-of-form tag at the end.
-
Why are you trying to get your data from print_r() output in the first place?
-
Identifiers names should contain [a-z][A-Z][0-9]_ characters. Hyphens are not valid. user-name is interpreted as user minus name
-
Are you calling session_start() on each of those pages?
-
Use a LEFT JOIN SELECT cat_title , CASE WHEN COUNT(post_id) = 0 THEN 'No posts' ELSE COUNT(post_id) END as total FROM categories c LEFT JOIN posts p ON c.cat_id = p.post_cat_id GROUP BY c.cat_title; I would also recommend using using valid column names.
-
Using parse_ini_file to parse an ini file with array-type entries?
Barand replied to KenHorse's topic in PHP Coding Help
When it comes to it, no part of php uses () format for arrays. try [Timers] Timer[1]=50 Timer[2]=30 Timer[3]=20 with $timers = parse_ini_file('mytimers.ini', 1); echo '<pre>', print_r($timers, 1), '</pre>'; giving Array ( [Timers] => Array ( [Timer] => Array ( [1] => 50 [2] => 30 [3] => 20 ) ) ) -
I would go for a slightly different model where the monthly charge is set for the duration of the lease. Charges can then be generated rather than having to enter them yourself. +--------------+ | unit | +--------------+ | unit_id |----+ | number | | +--------------+ | notes | | +--------------+ | payment | +--------------+ | | tenancy | +--------------+ | +--------------+ | ID | | | tenancy_ID |---------<| tenancy_ID | +--<| unit ID | | date | +---<| tenant_id | | amount | | | charge_p_m | | pay_type | (rental, deposit, contra, refund) | | start date | | notes | | | end date | +--------------+ | +--------------+ | | +--------------+ | | tenant | | +--------------+ | | tenant_id |---+ | name | | prev_address | | notes | +--------------+
-
When I connect (once at the top of the script, not for every query) I set the option to throw exceptions so I don't have to check for them every time. This brings me back to the two lines.
-
So while your writing try { $mydb = new DBWrapper(); // get the data and do what you want with it... $data = $mydb->readData('SELECT * FROM users where ID = :id', $userid); ... } catch (DBWrapperException $ex) { die($ex->getMessage()); } I write $data = $mydb->prepare("SELECT * FROM users WHERE ID = :id"); $data->execute(['id'=>$userid]); Not sure I'm totally sold on the benefits.
-
Have you turned on your error reporting, because this line should give a syntax error... $sql=("SELECT * FROM $tbl_name WHERE Form_Group ='$Form_Group' AND Att_Date = '$Att_Date'";; ^ And does the date format in $Att_Date match that in the DB table (which should be yyyy-mm-dd)
-
Both options have the same value
-
What is that supposed to tell us? What is doing that it shouldn't? What is it not doing that it should? (And note that whatever group you select (A or B) it will always be "Class A" with that HTML code.)