Need a little help here. I dont even know if this is right I think it is but It is my first attempt at table joins I have been reading but i just dont get it yet any help would be great thanks
PHP Code:
// open connection to database
$connection = mysql_connect($hostname, $user, $pass) or die ("Unable to connect!");
// get site survey details
// use a join to get data from different tables
$query = "SELECT survey.cir_id, survey.cust_name, survey.cust_contact, survey.cust_phone, survey.ext, phonelist.phonelist, survey.altphnum, survey.cust_address, power.power, survey.dist_power, powerstrip.powerstrip, equptmount.equptmount, space.space, survey.concerns, ilecextend.ilecextend, focalextend.focalextend, survey.addinfo, survey.tech_name, survey.tech_phone, survey.lec_foc, survey.focal_foc, city.city, survey.survey_date from survey, phonelist, power, powerstrip, equptmount, space, ilecextend, focalextend, city WHERE phonelist.id = survey.f_altphone AND power.id = survey.f_power AND powerstrip.id = survey.f_powerstrip AND equptmount.id = survey.f_eqptmount AND space.id = survey.f_space AND ilecextend.id = survey.f_ilecextend AND focalextend.id = survey.f_focalextend AND city.id = survey.f_city AND survey.cir_id = '$cir_id'";
$result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error());
echo " <p>$query</p>";
echo "<br>";
//echo " <p>$result</p>";
// error check
if (mysql_num_rows($result) <= 0)
{
header("Location:error.php");
exit;
}
else
{
I am trying to achieve a html form with the input but the problem is that in one db some of the field have just another number which is referred to anothe table. In shot i am trying to pull the info from the db in multiple tables and then put it into a html form that is what i am trying to do If you want send me an email and i will zip all the scripts and send them to you so you can see for yourself what i am trying to do thanks for the help
But what is it for? Is it a car database, user database, user forum??
How are you tying all the tables together?
(i.e. based on what unique id system)
Do you really need to split it up into all those tables?
If so why?
(can we forget about the code and just talk in English about what you are trying to do)
__________________
Author of <a href=http://www.hotscripts.com/Detailed/18290.html target=_blank>ezSQL</a> (makes life soooo easy when working with databases)