close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Driving directions to either of two addresses

Thread began 3/01/2010 4:50 am by gwh362692 | Last modified 3/15/2010 4:46 pm by gwh362692 | 1915 views | 14 replies

gwh362692

Thanks for the reply,

I have a database table called 'locations' which consists of 7 rows as follows:

locationID
store
street
suburb
state
postcode
country

I've created the form that the user fills out. As you suggested, this form also contains a select menu which is being populated with the two store names from my locations table.

I also manually inserted a hidden field in the form as follows but I don't know whether I was supposed to do this via a dialogue box?:

<input type="hidden" name="locationID" value="<?php
echo $row_rstLocations['locationID']; ?>"/>

The following is the sql used for the first query to populate the select menu:

mysql_select_db($database_locations, $locations);
$query_rstLocations = "SELECT locationID, store FROM locations";
$rstLocations = mysql_query($query_rstLocations, $locations) or die(mysql_error());
$row_rstLocations = mysql_fetch_assoc($rstLocations);
$totalRows_rstLocations = mysql_num_rows($rstLocations);

After that I created another recordset with the following sql:

SELECT *
FROM locations
WHERE locationID = $row_rstLocations['locationID']

But I got the following error:

"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '['locationID'] at line 1"

Can you tell me what I might be doing wrong?

In addition to the above method, I tried assigning the selected destination to a variable as follows:

$location = $_POST['locationID'];

I then tried the following sql syntax:

SELECT *
FROM locations
WHERE locationID = $location

But I got another sql syntax error:

"Unknown column '$location' in WHERE clause"

Any help much appreciated.

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...