-
Posts
24,563 -
Joined
-
Last visited
-
Days Won
822
Everything posted by Barand
-
The minimal number of globals is 0. (And sorry to see your TAB key has broken. :) ) But that aside, If it is form1, $z is not defined. If it isn't form1, $a is not defined. $x is never used. Bit of a mess really.
-
PS... and have you got "display_startup_errors" set ON.
-
Are you sure you are checking the php.ini file that is actually being used? phpinfo() which tell you the correct one.
-
These are what prompted my remarks Example 1 $stmt = $con->prepare("SELECT participationid, FROM donationclashdetails WHERE usernames, totaldonated = $_SESSION['name'], ?") $stmt->bind_param('isi', $_SESSION['id'], $_SESSION['name'], $_POST['participation']); $stmt->bind_result($participationid, $usernames, $totaldonated,); Query: Syntax errors totaldonated = name (really???) Params binding: 3 parameters but only 1 "?" placeholder (wrongly placed) in the query Result binding: 3 results bound but only 1 column selected Example 2 $stmt = $con->prepare("SELECT userbalance, totaleventjoined, userlevel, userexperience, totaldonationdc, totalpifcoingained FROM accounts WHERE username = $_SESSION['name']") $stmt->bind_param('i', $_SESSION['id']); Query: Syntax error plus WHERE clause is using a name Params binding: parameter is an id (int) with no placeholders in the query
-
Yes. The usual reason is that your query failed. Implement error checking. The easiest way is to add this line mysqli_report(MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT); just before your call mysql_connect() and make sure you have PHP's error reporting and display errors or log errors turned on
-
The first thing to try is change $con = mysqli_connect($DATABASE_HOST, $DATABASE_USER, $DATABASE_PASS, $DATABASE_NAME); to mysqli_report(MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT); $con = mysqli_connect($DATABASE_HOST, $DATABASE_USER, $DATABASE_PASS, $DATABASE_NAME); so errors in your queries get reported
-
If you are still using that monitor that you bought in 1990, stick with websafe colours.
-
His boat club registration form has two sections You Your boat So, in theory, after validating and preparing two insert queries, you can $member_insert->execute($_POST['member']); $boat_insert->execute($_POST['boat']);
-
It will be in $_POST['boat']['policy_number'];
-
Yes. But if the first element, $myarray[0], is an array, print_r() is going to say array. Why would you expect different?
-
My two example are just two ways of passing the result of first function as an argument to the second function
-
function first() { $A = [1,2,3,4,5]; return $A; } function second($arr) { return array_sum($arr); } $myarray = first(); echo second( $myarray ); //-> 15 // or echo second( first() ); //-> 15
-
Damn! Too slow, again.
-
Your definition is conditional. It only gets defined if the "else" path is followed. Define it as an empty string before the if().
-
Why don't you just create a webpage with a background image?
-
You should be using prepared statements. They have the added benefit that you then dont have to worry about data values like "O'Reilly" or "The Bull's Head"
-
53 years designing and developing business systems and applications, 37 years databases and SQL, 21 years PHP https://dev.mysql.com/doc/refman/5.7/en/functions.html
-
STOP making all the columns varchar. dates should be type DATE Numeric fields should be numeric types (int, float, decimal etc) Sorting and comparing will fail with wrong types EG mysql> create temporary table test (numcol int, charcol varchar(10)); Query OK, 0 rows affected (0.92 sec) mysql> insert into test (numcol, charcol) values (1, '1'), (5, '5'), (100, '100'); Query OK, 3 rows affected (0.05 sec) mysql> select * from test order by numcol; +--------+---------+ | numcol | charcol | +--------+---------+ | 1 | 1 | | 5 | 5 | | 100 | 100 | +--------+---------+ mysql> select * from test order by charcol; +--------+---------+ | numcol | charcol | +--------+---------+ | 1 | 1 | | 100 | 100 | | 5 | 5 | +--------+---------+ mysql> SELECT 100 > 5, '100' > '5'; +---------+-------------+ | 100 > 5 | '100' > '5' | +---------+-------------+ | 1 | 0 | 1 = true +---------+-------------+ 3 rows in set (0.00 sec)
-
Why have you turned auto_commit off? When you connect to the server, are you telling mysqli to report errors? EG... mysqli_report(MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT); // turn on error reporting $db = mysqli_connect(HOST,USERNAME,PASSWORD,$database); $db->set_charset('utf8');