How to add custom code to user registration?
-
While I’ve added custom fields to a user’s registration on a site of mine, I want to use some custom code to login to a SQL database and check the given ID with the IDs in the database. I’ve already got code to do so,
<?php include_once('dbconnect.php'); //if(isset($_POST['search'])){ $q = $_POST['q']; $q = $_GET['query']; session_start(); session_start(); session_start(); $query = mysqli_query($conn,"SELECT * FROM <code>Persons</code> WHERE <code>id</code> LIKE '%$q%'"); //Replace table_name with your table name and <code>thing_to_search</code> with the column you want to search $count = mysqli_num_rows($query); if($count != "1"){ $output = '<h2>No result found!</h2>'; }else{ while($row = mysqli_fetch_array($query)){ $s = $row['name']; // Replace column_to_display with the column you want the results from $output .= '<h2> Found: '.$s.'</h2><br>'; } } $_SESSION['name'] = $s; $_SESSION['id'] = $q; $_SESSION['fromMain'] = "true"; echo $_SESSION['fromMain']; //} ?>
How exactly would I connect the above PHP code to the registration of a potential user? Additionally, would there need to be any changes to the code to make it work?
WP: 5.1.1
BP: 4.2.0
Site: http://worldcubers.com/
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.