-
Posts
6,906 -
Joined
-
Last visited
-
Days Won
99
Everything posted by ginerjm
-
Only if one was well-versed in array syntaxes. OP is simply using the old way of doing things and one which I personally continue to use to be more clear to the un-initiated.
-
Your execute is missing both a ) and a ; PS - when you show us an error message with a line number please re-show that actual line of code to make it easier for us to debug for you.
-
And what have you done so far? Using what? This forum is all about helping people doing what they want to do, but first they have to write some code and then ask for help when it doesn't do what they want.
-
Do not use $_REQUEST. Use the appropriate array name to collect your input. You cannot echo a boolean value. Use a string instead.
-
searching thru a file or a table is irrelevant to the type of input method used. Stay with the POST for collecting your input data from the form. Are you in the early phases of a class that is teaching you how to program? That would be the only reason to be 'told' to use a text file rather than a db.
-
Here is your lastest code with some notes. But you REALLY SHOULD USE MAC_GYVER'S CODE. PDO is so much easier to use. // TURN ON ERROR CHECKING error_reporting(E_ALL); ini_set('display_errors', '1'); $host_name = 'xxxxxx'; $database = 'xxxx'; $user_name = 'xxxx'; $password = 'xxxx'; $link = new mysqli($host_name, $user_name, $password, $database); if ($link->connect_error) die('Failed to connect to MySQL: '. $link->connect_error); else echo 'Connection to MySQL server successfully established.'; // check if a form has been submitted if ($_SERVER["REQUEST_METHOD"]== "POST" { $name = $POST['name']; // WHAT IF THE FORM WASN'T SUBMITTED? // SINCE YOU ARE ONLY INSERTING ONE VALUE PERHAPS YOU S/B NAMING IT IN YOUR QUERY $sql = $mysqli->prepare("INSERT INTO senior_dat VALUES (?)"); $label = 'PHP'; $sql->bind_param("is",$label); // READ THE MANUAL ON THIS SO YOU CAN USE IT CORRECTLY. OR CHANGE TO THE NON-DEPRECATED FUNCTION. // AND ADD THE SEMI. $sql->execute // HOW CAN YOU ISSUE THIS MESSAGE WHEN YOU AREN'T CHECKING IF THE EXECUTE RAN? echo "<h3> DATA saved OK"</h3>; } else echo "You have an input error";
-
Your last is full of errors which you are not seeing since you didn't include the error reporting code.
-
Here is a cleaned-up version of your php: // Turn on error checking error_reporting(E_ALL); ini_set('display_errors', '1'); // check if a form has been submitted if ($_SERVER["REQUEST_METHOD"]== "POST" { $id = $_POST['id']; $name = $_POST['name']; $dob = $_POST['dob']; $addr = $_POST['addr']; $phone= $_POST['phone']; $mob = $_POST['mob']; $email =$_POST['email']; $bmfa_no = $_POST['bmfa_no']; $caa_no = $_POST['caa_no']; $rewd = $_POST['rewd']; $fam = $_POST['fam']; $ctry = $_POST['ctry']; $ctry_bmfa = $_POST['ctry_bmfa']; $bdf = $_POST['bdf']; $pay_opt = $_POST['pay_opt']; $pay = $_POST['pay']; $date = $_POST['date']; $sign = $_POST['sign']; $sql = "INSERT INTO senior_dat VALUES ($id, $name, $dob, $addr, $phone, $mob, $email, $bmfa_no, $caa_no, $rewd, $fam, $ctry, $ctry_bmfa, $bdf, $pay_opt, $pay, $date, $sign"); if(mysqli_query($conn, $sql)) echo "<h3>Form saved OK</h3>"; // YOU HAD AN ERROR HERE else echo "You have an input error"; // YOU HAD AN ERROR HERE } Corrected the ending lines of echo statements. Changed your use of $_REQUEST to be $_POST. It's a post form so USE post values. As for the comment about the query being wrong, other than the misplaced ')', I can't say since I don't know your table layout. Also - you s/b doing some kind of validation on all of that input and, as suggested also, you s/b using a prepared statement instead of just trying to use user input to update your db. I didn't even look at your enormously complex html code.
-
Obviously this data needs to be normalized in order to build a database. You have all different data arrangements in a single sheet and probably multiple of those sheets in your workbook. Sounds like more of a manual effort to break this down into several csv files that you can then easily import into a properly structured set of table in your new db.
-
problem with hacker, i need a way to encrypt my gmail or something
ginerjm replied to alexandre's topic in Miscellaneous
Happy to Help. -
problem with hacker, i need a way to encrypt my gmail or something
ginerjm replied to alexandre's topic in Miscellaneous
I have no idea what AV packages you are talking about. Get a well-respected one such as Norton or McAfee and use it. I have used Norton for the last 10 years or so. People have their faves but this has worked very well for me. I don't know how long you have been using a device on the internet but to not have any antivirus is quite the mistake. Get one, install it and run a full scan immediately. -
If you need to find the record with the value of PENDING equaling 1, why do you need a limit? And is PENDING an integer or a text value? You make it appear to be a text one. In your query you have a field called BIN. Yet in your reference to the values retrieved from the query result you seem to be looking for a constant named BIN. Which is it? And again - is BIN an integer or is it a string? So many questions. Here is a sample of how I would write your query to do some error checking. You need to address my questions tho. if (!$db_connection = mysqli_connect($host, $user, $password, $database)) { echo "Could not make db connection"; exit(); } $sql = "SELECT BIN FROM listofbins WHERE PENDING='1' LIMIT 1"; if (!$result = mysqli_query($db_connection,$sql)) { echo "Error running query: $sql<br>"; exit(); } $owew = mysqli_fetch_array($result, MYSQLI_ASSOC); if ($owew['BIN]' > '100') { echo "Pending BIN over the number 100: ". $owew['BIN']; } exit();
-
problem with hacker, i need a way to encrypt my gmail or something
ginerjm replied to alexandre's topic in Miscellaneous
If you had an A/V you would know if you had something on your pc. And if you don't, GET ONE. -
Could you use some punctuation when you write English. It is very difficult to read what appears to be a run-on sentence when you post. It might also help all of us who you are asking for help to understand you better.
-
problem with hacker, i need a way to encrypt my gmail or something
ginerjm replied to alexandre's topic in Miscellaneous
Do you have an A/V on your primary device so that you can begin to protect yourself? -
Ok - yes I did. Re-copied the json and it now runs for me. So now the question from the op is "what is a state return". What are you looking for OP? If the return of the value of 'online' is desired I have managed to get this back: Config group id 2 is True Config group id 3 is False Config group id 9 is True And this is the code I used: $decoded = json_decode($json_code, true); foreach($decoded as $k=>$arr) { $result = $arr['online'] == '1' ? 'True' :'False'; echo "Config group id {$arr['config_group_id']} is $result<br>"; }
-
OK - I did remove the [] but now I've added them to the json variable and this is the output I have to show: Step 1. A print_r of my json variable is: [ { "config_group_id":2, "device_count":2, "devices": [ "11:22:00:00:00:01", "11:22:00:00:00:02" ], "name":"Bob", "pause":false, "profile_id":2, "timespent": { "has_quota":false, "quota":0, "total_spent": { "normal":91, "reward":0 } }, "online_device_count":1, "online":true }, { "config_group_id":3, "device_count":2, "devices": [ "11:22:00:00:00:03", "11:22:00:00:00:04" ], "name":"Alex", "pause":false, "profile_id":3, "timespent": { "has_quota":false, "quota":0, "total_spent": { "normal":0, "reward":0 } }, "online_device_count":0, "online":false }, { "config_group_id":9, "device_count":3, "devices": [ "11:22:00:00:00:05", "11:22:00:00:00:06", "11:22:00:00:00:07" ], "name":"$lan$", "pause":false, "profile_id":4, "timespent": { "has_quota":false, "quota":0, "total_spent": { "normal":638, "reward":0 } }, { "online_device_count":2, "online":true } } ] ********************* Step 2. Print_r after the json_decode call shows: ********************* Step 3. Var dump of the decode result variable: NULL
-
I very rarely use Json and do not profess any knowledge there. But when I put your json into a small php script and ran the json_decode on it, I get a null response which manual says indicates an error in the json itself.
-
The 'last..' dates - Are you looking for records that are related to the current date (today?) or are they related to the last date you have on file for each unique 'symbol'?
-
Might need a wordpress forum for this question. Or someone here who uses it a lot
-
A rather unnecessary function if that is all you need to happen. You can easily type that one echo line when you need instead of making a function to do it for you. BTW - you are defaulting the argument to an empty array. Don't you want to check if the arg is actually empty and not do the echo in the function?
-
Unsupported operand types: int + string in after ( php 8 update)
ginerjm replied to Zacks's topic in PHP Coding Help
Maybe the OP will fill us in..... -
Unsupported operand types: int + string in after ( php 8 update)
ginerjm replied to Zacks's topic in PHP Coding Help
Something new to us not-yet-on-8 users. As for get_field, just what is that? Is that V8 as well? -
Unsupported operand types: int + string in after ( php 8 update)
ginerjm replied to Zacks's topic in PHP Coding Help
Your error message points to something type-related but your code doesn't seem to be doing anything involving types. Do you want to revise your post, or perhaps do a bit more describing and maybe even show us the error line the is being referenced in the whole message? Unless the error is tied to the last line. And what is this get_field function? Something in your script that you are not showing us?