Hi,,
My problem is that i have two table city and location.In city table i have 3 field city_id(Primary key),city_name,city_status where city_status is true or false.In location table i have 3 field also loc_id(Primary key),city_id,loc_city.i done a code in which city_name comes into drop down list from city table.my problem starts here when i select one of this value and want to insert into location table...then this show error..is there any code available related to my problem plz send my id......
muneer_alam
0
Newbie Poster
Recommended Answers
Jump to Postpost your code .i need to look through
:)
Jump to Post$query = "INSERT INTO location (loc_id, city_id,loc_city) VALUES('$l_id',(SELECT city_id FROM city WHERE city_id = '$city_id'),'$location')";
Why dont you try simple select query to get the city_id and then insert into location table,
That should work ok? ;)
I also want to see your error mysql prints;
Jump to Postyou must set password for your mysql connection.
example:
$host="localhost"; $user="root"; $pass="SeKr1t"; mysql_connect($host,$user,$pass); // You need a password set ok?
thats all ;)
Jump to Postplease get this for me.
1. what is your database engine or type. eg ms sql, mysql, oracle, etc.
2. did you received any errors of any kind.??
a.if yes, post the error
b. if no, make sure you have data in the database for your query.…
Jump to Postpopulate at least some few data in your tables that you query.
if they are empty, you will get no data out.
Do what i told you and post all errors if any.
All 19 Replies
richieking
44
Master Poster
muneer_alam
0
Newbie Poster
muneer_alam
0
Newbie Poster
richieking
44
Master Poster
muneer_alam
0
Newbie Poster
richieking
44
Master Poster
muneer_alam
0
Newbie Poster
richieking
44
Master Poster
muneer_alam
0
Newbie Poster
richieking
44
Master Poster
muneer_alam
0
Newbie Poster
richieking
44
Master Poster
muneer_alam
0
Newbie Poster
richieking
44
Master Poster
muneer_alam
0
Newbie Poster
richieking
44
Master Poster
muneer_alam
0
Newbie Poster
richieking
44
Master Poster
xerilagang
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.