Jump to content

snowymasta

Members
  • Posts

    13
  • Joined

  • Last visited

Everything posted by snowymasta

  1. Thank you for your advise on this really appreciated, The session is being created at a login script I have and then passes that business ID through the pages.
  2. Hi Mac_gyver it shows this string(6) "300101" The DB structure is mig_bidvarchar(255)utf8_general_ciNoNone
  3. you mean like the below? mysqli_report(MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT); $conn = new mysqli($servername, $username, $password, $dbname) or die("Connect failed: %s\n". $conn -> error); $result = $conn->query("SELECT * FROM MK_migration_details WHERE mig_bid = '".$_SESSION['bid']."'");
  4. Ok that worked and it does exactly what it should, so assume that means the error is elsewhere! Whole Script below <?php require_once("db_connection.php"); $conn = new mysqli($servername, $username, $password, $dbname) or die("Connect failed: %s\n". $conn -> error); $result = $conn->query("SELECT * FROM MK_migration_details WHERE mig_bid='".$_SESSION['bid']."'"); $data = array(); while($row = $result->fetch_assoc()) { $data[] = $row; } echo json_encode($data); ?>
  5. Hi Guys, need a little help and drawn a blank. The code that is not working is below $result = $conn->query("SELECT * FROM MK_migration_details WHERE mig_bid='".$_SESSION['bid']."'"); I can confirm the $_SESSION['bid'] is working as echo's out on another part of the page. and the above $result works when i manually type the search criteria like below. $result = $conn->query("SELECT * FROM MK_migration_details WHERE mig_bid='300101'"); Basically no result turn up on the page. Any ideas or advise how I can diagnose?
  6. Hi Guys, Been trying to make it that when I insert into Mysql at the moment it inserts like dd-mm-yy, however cause I'm in the UK i need it to do it in the UK way of dd-mm-yy I checked out some topics and found the STR_DATE_DATE however I've tried to use it in my mysql but cannot get it to work. Can someone help $query="INSERT INTO job_scheduled (startdate, enddate, job_title, job_reference, job_description, job_postcode, job_city, customername, customer_email, status) VALUES ('".STR_TO_DATE($_SESSION["startdate"],'%d-%m-%y')."', '".$_SESSION["enddate"]."', '".$_SESSION["job_title"]."', '".$_SESSION["job_reference"]."', '".$_SESSION["job_description"]."', '".$_SESSION["job_postcode"]."', '".$_SESSION["job_city"]."', '".$_SESSION["customername"]."', '".$_SESSION["customer_email"]."', 'Provisional')";
  7. Hey Guys, I'm really struggling to find whats wrong with this code. The form before submit has several checkboxes as part of an array which is below <?php $conn = new mysqli($servername, $username, $password, $dbname); $sql = "SELECT * FROM `engineers`"; $result = $conn->query($sql); while($row = mysqli_fetch_assoc($result)) { $endid = $row["endid"]; $resource_name = $row["resource_name"]; $resource_email = $row["resource_email"]; $picture = $row["picture"]; echo "<label>".$resource_name."</label><input type='checkbox' class='form-control' name='engineers[]' value=''.$endid.''><br>"; } ?> The next page then goes to this and I get the error "Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /homepages/39/d837976904/htdocs/Scheduler/add_job3.php:10 Stack trace: #0 {main} thrown in /homepages/39/d837976904/htdocs/Scheduler/add_job3.php on line 10" <?php // Initialize the session session_start(); $process = $_GET["process"]; include "Includes/config.php"; include "Includes/db.php"; mysql_connect($servername, $username, $password) or die(mysql_error()); mysql_select_db($dbname) or die(mysql_error()); $checkBox = implode(',', $_POST['engineers']); if(isset($_POST['submit'])) { $query1="INSERT INTO job_activity (endid) VALUES ('" . $checkBox . "')"; mysql_query($query1) or die (mysql_error() ); echo "Complete"; } ?> Can anyone help with the code please
  8. Hi guys, I'm starting to get back into coding for a hobby and wondering is there a better way of doing these php and mysql calls? they all work but not sure if it was the efficent way or is there others that everyone else uses? //connection for user details lookup $sql0 = "SELECT uid, fullname, emailaddress, created_at FROM MK_users WHERE uid={$_SESSION['id']}"; $result0 = $conn->query($sql0); //connection for user against role acceess $sql2 = "SELECT role_uid, role_bid, role_access, access_created_at FROM MK_role_access WHERE role_uid={$_SESSION['id']}"; $result2 = $conn->query($sql2); while($row2 = $result2->fetch_assoc()) { $_SESSION['role_bid'] = $row2["role_bid"]; } //connection for role access against business lookup $sql3 = "SELECT businessname, account_type, website, main_address, logo FROM MK_baccounts WHERE bid={$_SESSION['role_bid']}"; $result3 = $conn->query($sql3); while($row3 = $result3->fetch_assoc()) { $_SESSION['businessname'] = $row3["businessname"]; }
  9. All sorted, when checking I saw that it was echoing out the addpostcode all on the same line, so added a breaker and put into the loop and working now!
  10. Hi Barand, Understand what your saying so what would you do? as the AddPostcode function is a javascript function?
  11. Hey Requinix, thank you for your reply, I thought that too but when I put it in it breaks and the map shows nothing at all. Is there a way I can trouble shoot that when I put it into the loop?
  12. Hi there, So the below code is working for 1 entry, however there is 2 entries in the database which are different postcodes and I cannot get to show in Google Maps. When I do it without Mysql and just do it direct it works, but really want to do it from MYSQL - both postcodes are valid and tested as well. <?php $sql4 = "SELECT * FROM MK_migration_details"; $result4 = $conn->query($sql4); ?> function initialize() { geocoder = new google.maps.Geocoder(); var latlng = new google.maps.LatLng(40.768505,-111.853244); var myOptions = { mapTypeControl: false, fullscreenControlOptions: false, zoom: 8, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP } map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); <?php while($row4 = $result4->fetch_assoc()) { $mig_postcode = $row4["postcode"]; } echo 'addPostCode("'.$mig_postcode.'")'; ?> } I know the issue lies with the PHP / Mysql Loop and the Javascript element 'addpostcode' when I put into the loop does not work, but works for a single address outside the loop. Really appreciate your help guys! Thanks you
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.