Jump to content

Archived

This topic is now archived and is closed to further replies.

Codeman0013

Is it possible?

Recommended Posts

Hey is it possible to run a query and not allow the others to run until the ones above it have been executed like on page load i only want one thing to load and as the user submits then run the next on and so on here is my code if its possible ot change it i would appreciate any tips..

[code]mysql_select_db($database_conn_dj, $conn_dj);
$query_rs_industry = "SELECT industry_id, industry_name FROM tbl_industry ORDER BY industry_name ASC";
$rs_industry = mysql_query($query_rs_industry, $conn_dj) or die(mysql_error());
$row_rs_industry = mysql_fetch_assoc($rs_industry);
$totalRows_rs_industry = mysql_num_rows($rs_industry);

mysql_select_db($database_conn_dj, $conn_dj);
$query_rs_productcategory = "SELECT productCat_id, productCat_name, industry_id FROM tbl_productcat WHERE industry_id = '$_GET[industry_id]' ORDER BY productCat_name";
$rs_productcategory = mysql_query($query_rs_productcategory, $conn_dj) or die(mysql_error());
$row_rs_productcategory = mysql_fetch_assoc($rs_productcategory);
$totalRows_rs_productcategory = mysql_num_rows($rs_productcategory);

mysql_select_db($database_conn_dj, $conn_dj);
$query_rs_product = "SELECT products_id, products_name, productCat_id FROM tbl_products WHERE productCat_id = '$_GET[productCat_id]' ORDER BY products_name";
$rs_product = mysql_query($query_rs_product, $conn_dj) or die(mysql_error());
$row_rs_product = mysql_fetch_assoc($rs_product);
$totalRows_rs_product = mysql_num_rows($rs_product);

mysql_select_db($database_conn_dj, $conn_dj);
$query_rs_outsidena = "SELECT * FROM intl_countries ORDER BY intl_countries.name";
$rs_outsidena = mysql_query($query_rs_outsidena, $conn_dj) or die(mysql_error());
$row_rs_outsidena = mysql_fetch_assoc($rs_outsidena);
$totalRows_rs_outsidena = mysql_num_rows($rs_outsidena);[/code]

Share this post


Link to post
Share on other sites
Ajax seems like your only hope. Though that is too advanced for you if you can't figure it out your self. And I don't know ajax too well. sorry

Share this post


Link to post
Share on other sites
Well, depending on how large these tables are, you might be able to preload this and do it client-side...

Share this post


Link to post
Share on other sites
If you don't mind having the page reload every time the user submits something or picks a new value, then you can do it with php and a little bit of javascript.  You just need to have a few hidden form fields on your page, and when the user submits one button, the javascript sets the form field value to some flag key value, then submits the form with page.submit().  Your php code looks for the flag value, then runs the query you want, and spits out the result page with the new results of the query.

If you do mind the page reloading, then you'll have to go with AJAX, I think.

Share this post


Link to post
Share on other sites

×

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.