You should use $_POST, not $_GET. Here's my code:
<?php
require("phpsqlajax_dbinfo.php");
// Gets data from URL parameters
$name = $_POST['name'];
$lat = $_POST['lat'];
$lng = $_POST['lng'];
$type = $_POST['type'];
// Opens a connection to a MySQL server
$connection=mysql_connect (localhost, $username, $password);
if (!$connection) {
die('Not connected : ' . mysql_error());
}
// Set the active MySQL database
$db_selected = mysql_select_db($database, $connection);
if (!$db_selected) {
die ('Can\'t use db : ' . mysql_error());
}
// Insert new row with user data
$query = sprintf("INSERT INTO markersFlash " .
" (id, name, address, lat, lng, type ) " .
" VALUES (NULL, '%s', '%s', '%s', '%s', '%s');",
mysql_real_escape_string($name),
mysql_real_escape_string($address),
mysql_real_escape_string($lat),
mysql_real_escape_string($lng),
mysql_real_escape_string($type));
$result = mysql_query($query);
if (!$result) {
die('Invalid query: ' . mysql_error());
}
?>
- pamela
On Wed, May 6, 2009 at 4:38 AM, Ranglo <[email protected]> wrote:
>
> Hi,
>
> I have been playing with the InfoWindow Database Saver and am having
> no luck with the php side of things. The following code keeps
> returning the error "Undifined index for lines 4 to 7". Have I missed
> anything obvious, or can anyone provide the script which may work?
>
> Thanks
>
> <?php
>
> // Gets data from URL parameters
> $name = $_GET['name'];
> $lat = $_GET['lat'];
> $lng = $_GET['lng'];
> $type = $_GET['type'];
>
> // Opens a connection to a MySQL server
> mysql_connect("localhost","root");
>
> // Set the active MySQL database
> $db_selected = mysql_select_db("EIAWEBGIS");
> if (!$db_selected) {
> die ('Can\'t use db : ' . mysql_error());
> }
>
> // Insert new row with user data
> $query = sprintf("INSERT INTO markers " .
> " (id, name, lat, lng, type ) " .
> " VALUES (NULL, '%s', '%s', '%s', '%s');",
> mysql_real_escape_string($name),
> mysql_real_escape_string($lat),
> mysql_real_escape_string($lng),
> mysql_real_escape_string($type));
>
> $result = mysql_query($query);
>
> if (!$result) {
> die('Invalid query: ' . mysql_error());
> }
>
> ?>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API For Flash" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-maps-api-for-flash?hl=en
-~----------~----~----~----~------~----~------~--~---