Jump to content

timmah1

Members
  • Posts

    1,170
  • Joined

  • Last visited

Everything posted by timmah1

  1. Alright, I noticed mixing the 2, that was a screw up. I fixed that, but still get nothing. So your only solution is using PDO? I don't want to use PDO, But thank you for your suggestion. Now, would anybody else be able to help me out?
  2. I followed a tutorial on doing a contact form, works great. But, I want the information to be submitted in to my database to access later. The posted values are put into an array $fieldss = array('name' => 'First Name', 'surname' => 'Last Name', 'phone' => 'Phone', 'email' => 'Email', 'venue' => 'Venue', 'vname' => 'Contact', 'vaddress1' => 'Address', 'vaddress2' => 'Addresss', 'vcity' => 'City', 'vstate' => 'State', 'vzip' => 'Zip', 'vphone' => 'Phone', 'eventdate' => 'Event Date', 'eventtime' => 'Event Time', 'eventname' => 'Event Name', 'message' => 'Message'); Then the values are sent to my email. How can I take these values, and put them into my database? I've tried numerous different things, searched, and followed tutorials, but nothing is working. Here is the code I tried, but nothing gets inserted except my date fieild, but this is the first time something was inserted into the database if(is_array($fieldss)){ foreach ($_POST as $keys => $row) { $book_first = mysql_real_escape_string($fieldss[$row][0]); $book_last = mysql_real_escape_string($fieldss[$row][1]); $book_email = mysql_real_escape_string($fieldss[$row][2]); $query ="INSERT INTO booking (book_first, book_last, book_email) VALUES ( '". $book_first."','".$book_last."','".$book_email."' )"; mysqli_query($conn, $query); } if ($conn->query($query) === TRUE) { $okMessage = 'Form successfully submitted.<br>'; } else { $errorMessage = 'There was an error while submitting. '; } } Can somebody help me out here? Thank you in advance
  3. Thank you for your help, but I'm getting different errors now that I've never seen before Uncaught RangeError: Maximum call stack size exceeded And I have no idea how to fix that. Even reading about it, i'm totally clueless Thank you for your help, it is really appreciated!
  4. I've never heard of this or seen this before, but "inspecting" the code, I'm getting this now Uncaught RangeError: Maximum call stack size exceeded What is that?
  5. Like this: [{"lat":"","lng":"","name":"Lobster Louie's Truck","address":"300 Pine, San Francisco, CA 94104","place":"300 Pine","hours":"8:00am - 10:00am","location":"Located at the corner of pine and 3rd."},{"lat":"","lng":"","name":"Lobster Louie's Truck","address":"Terry Francois Blvd, San Francisco, CA","place":"The Yard at Mission Rock","hours":"11:00am - 3:00pm","location":"Located at the Yard"}] But the map isn't populating, so I guess I was just assuming that the php code is at fault
  6. Maybe I'm doing this entire thing wrong. The code I'm using is this: var markersData = [ <?php $sql = "SELECT * FROM events"; $result = $conn->query($sql); while($row = $result->fetch_assoc()) { $events[] = array( 'lat' => $row['event_lat'], 'lng' => $row['event_lng'], 'name' => $row['event_name'], 'address' => $row['event_address'], 'place' => $row['event_place'], 'hours' => $row['event_hours'], 'location' => $row['event_location'] ); } echo json_encode($events); ?> ];Is this not the proper way to do this?I'm using php on the javascript file
  7. So, essentially it would be this: $sql = "SELECT * FROM events"; $result = $conn->query($sql); while($row = $result->fetch_assoc()) { $events[] = array( 'lat' => $row['event_lat'], 'lng' => $row['event_lng'], 'name' => $row['event_name'], 'address' => $row['event_address'], 'place' => $row['event_place'], 'hours' => $row['event_hours'], 'location' => $row['event_location'] ); } echo json_encode($events); to output like so { lat: 40.6386333, lng: -8.745, name: "xxxx", address: "xxxx", place: "xxxxx", hours: "xxxxx", location: "xxxx" }, { lat: 40.59955, lng: -8.7498167, name: "xxxx", address: "xxxx", place: "xxxxx", hours: "xxxxx", location: "xxxx" }, { lat: 40.6247167, lng: -8.7129167, name: "xxxx", address: "xxxx", place: "xxxxx", hours: "xxxxx", location: "xxxx" }
  8. This is something small that I'm forgetting, but I'm lost now. I need to get the information from the db to display as follows: var markersData = [ { lat: 40.6386333, lng: -8.745, name: "xxxx", address: "xxxx", place: "xxxxx", hours: "xxxxx", location: "xxxx" }, { lat: 40.59955, lng: -8.7498167, name: "xxxx", address: "xxxx", place: "xxxxx", hours: "xxxxx", location: "xxxx" }, { lat: 40.6247167, lng: -8.7129167, name: "xxxx", address: "xxxx", place: "xxxxx", hours: "xxxxx", location: "xxxx" } ]; Now, my query is this: $sql = "SELECT * FROM events"; $result = $conn->query($sql); while($row = $result->fetch_assoc()) { $events[] = array( 'lat' => $row['event_lat'], 'lng' => $row['event_lng'], 'name' => $row['event_name'], 'address' => $row['event_address'], 'place' => $row['event_place'], 'hours' => $row['event_hours'], 'location' => $row['event_location'] ); echo '<pre>'.print_r($events); } Which prints out this: Array ( [0] => Array ( [lat] => [lng] => [name] => Lobster Louie's Truck [address] => 300 Pine, San Francisco, CA 94104 [place] => 300 Pine [hours] => 8:00am - 10:00am [location] => Located at the corner of pine and 3rd. ) ) Array ( [0] => Array ( [lat] => [lng] => [name] => Lobster Louie's Truck [address] => 300 Pine, San Francisco, CA 94104 [place] => 300 Pine [hours] => 8:00am - 10:00am [location] => Located at the corner of pine and 3rd. ) [1] => Array ( [lat] => [lng] => [name] => Lobster Louie's Truck [address] => Terry Francois Blvd, San Francisco, CA [place] => The Yard at Mission Rock [hours] => 11:00am - 3:00pm [location] => Located at the Yard ) ) I do not understand why it's showing 3, when there is only 2 in the database, but regardless, it's not working anyhow. Can somebody please see what's wrong so that it formats correctly? Thanks
×
×
  • 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.