Jump to content

chillininvt

Members
  • Posts

    22
  • Joined

  • Last visited

    Never

Everything posted by chillininvt

  1. I figured out what the problem was I was not making my handle server response a reference to the object but rather assigning the value of the function to anther variable and just exectuting it. Anyhow I am new to javascript but I can see that the solution to my problem I will need to set up a global variable or reference another value. I need to send a variable to the handleserverresponse function but I cannot do this if accessing it by reference. Because I have to make reference to the functcion like this xmlHttp.onreadystatechange = handleServerProfileEdit; What I need to do essentially is give the function a variable handleServerProfileEdit(data); Like this but if you simply add the variable like that it display an unknown runtime error it will have the ability to read the variable within the function but when referencing the Document Object Module ie is throwing me some errors. So how would I be able to declare another variable within the new object. Can I create another function within this function to grab the value of the variable that I need. Essentiall what happens is when a button is clicked it send a yes and a know then adds a value to an input. So long as I can get the value of this variable within my handle server response function than it will work fine. I do not want this variable available to anyother functions other than the 2 functions that need to use it.
  2. I am developing an ajax application and it works great only there way no way to inform my users that processing was actually taking place. I decided that if I had the javascript write to a div element then we can ask the user if they are submitting the correct data by checking the value of the input accessing it using the value of the id. Anyhow here are 2 functions where the error is occuring in internet explorer. function ajaxprofilecheck(data){ inputcon = escape(document.getElementById(data).value); document.getElementById('profilestatusview').innerHTML = 'Do you want to change '+data+' to '+inputcon+' ?<br><input name="check" type="submit" id="check" value="yes" onClick="testandgo(\'yes\');"><input name="formdata" type="hidden" id="formdata" value="'+data+'" ><input name="querycheck" type="submit" id="querycheck" value="no" onClick="testandgo(\'no\');">'; } function testandgo(tru){ if(tru == "no"){ document.getElementById('profilestatusview').innerHTML = 'No Data was updated.'; }else{ var data = document.getElementById('formdata').value; ajaxprofilecleard(data); document.getElementById('profilestatusview').innerHTML = 'Your Profile Was Updated.'; } } You see what it does is when a user clicks on a button it will invoke. ajaxprofilecheck() function. What this does is write into div the data that they wish to input and also passing back, the value of data into a hidden input in the page. Then When you click on the submit button from the status window it will invoke the test and go function. If the test and go function is set to yes then it will make the ajax request. Which this script works like a charm in firefox as my statusview method of verifying the data is great. It keeps the page moving quickly and users on the page longer. The only problem is in ie when you click on yes make the ajax request I get an unknown runtime error. I have the same script making other ajax request with different variables so I dont believe the error is in the ajax code or the back end php script. I think for some reson ie may not be able to grab the value of formdata from the element. This element is written in with javascript. Fire for appears to access this value just fine.
  3. If php is ran like a CGI you need to specify the path to php in the top of the file similarly to the way you would a perl script #!/path/to/php so that the script knows where to find the php engine.
  4. Check in your httpd.conf for the path to the php.ini file or any alias ini files that could be used.
  5. In windows I believe that you can leave the path to the ini file blank.
  6. Could you elaborate on this I am confused as to what you are running and what process are supposedly running. Do you have traffic issues? Please explain more?
  7. This appears to be a problem with access rights to scripts. Is the web user that the php script is running under have the appropriate permissions set to access this script.
  8. The user name and password you supplied is invalid.
  9. I would be interested in trouble shooting this problem. My first question is do you have php installed on your server. Is it installed as a module or is ran like a CGI in which case you would need to tell the script where the php interpreter is.
  10. I am trying to get my script working to back up a mysql database. Everything works fine only the output results in a blank file. <?php $recipient = ""; $message = '<p><a href="http://www..com/CMSdb.sql">Click here for you database backup Of the CMS</a></p> <p><a href="http://www..com/LIVEdb.sql">Click here for you database backup Of the Live Site </a> </p>'; $from = ""; exec("chmod 777 CMSdb.sql"); exec("chmod 777 LIVEdb.sql"); exec("mysqldump --opt -u user-p pass dvb_cms > CMSdb.sql"); exec("mysqldump --opt -u user -p pass dvb_live > LIVEdb.sql"); mail($recipient, 'DATABASE BACKUP', $message, 'From:'.$from.''); exec("chmod 775 CMSdb.sql"); exec("chmod 775 LIVEdb.sql"); echo "<h1>Your Database Has Been Backedup </h1>"; ?>
  11. Ok I solved my own problem. Looks like the column id that that I was trying to check in the WHERE clause didnt exist and the column was actually PageID !!! DUH!!!!
  12. I tried that but this will not do anything with that. I dont get it. The code looks perfect. $pageID = mysql_insert_id(); echo "".$pageID.""; $page = "generalpage.php?page=".$pageID.""; $sql = "UPDATE PageLocations SET location = '" .$page. "' WHERE id = '" . $pageID . "';"; if (mysql_query($sql)) { echo "Success"; } else { echo "Query failed<br />" . mysql_error() . "<br />$sql"; }
  13. No that didnt work. Everything else works it will run all of the insert statements. The problem is that when I put the entry into the PageLocations table I need to grab the insert id then store that value back down into the same row of data in another column see This value here $page = "generalpage.php?page=".$pageID.""; needs to go into the Pagelocations table after its created. You cannot put it in before had because the value of page id connot be determined until the row its self is created. Essentially. What I need it to do is grab the insert id number and store in the the column locations Which house a value in this format generalpage.php?page=300 The page number is the equivelent to the value of the auto_increment column on the same row.
  14. I dont know why this this update query wont execute. All the rest of the script works fine. When you get to the update query it will not execute. First one with the solution to the problem $10 paypal. if( isset($_POST['btnSubmit']) ) { $department_id = $_GET['department_id']; if( $department_id == "" ) { // ADD NEW Addition By Chillininvt@Yahoo.com // Insert New Department into cityhalldepartment table. mysql_query("INSERT INTO CityHallDepartment (department_name) VALUES ('" . $_POST['department_name'] . "');"); $departmentname = $_POST['department_name']; //If there is a value for department name in the post array do if($departmentname != NULL){ //Grab The insert id from the last query $departmentid = mysql_insert_id(); //Grab the insert id of the last query // Insert Values to Pagelocations Table mysql_query("INSERT INTO PageLocations (parentID, title, display, displayNavCMS, department_id) VALUES ('2', '$departmentname', '1', '1', '$departmentid');"); if(mysql_errno() != 0) { echo "INSERT INTO PageLocations<BR><BR>"; echo $sqlTemp . "<BR>"; echo "<BR><BR>" . mysql_errno() . ": " . mysql_error() . "<BR>\n"; exit; } $pageID = mysql_insert_id(); $page = "generalpage.php?page=".$pageID.""; mysql_query("UPDATE PageLocations SET location = '" .$page. "' WHERE id = '" . $pageID . "';"); //Insert values into the PageGeneric table mysql_query("INSERT INTO PageGeneric (pid, bannerID, title, subtitle, content, metadesc, layoutID) VALUES ('$pageID', '19', '$departmentname', 'This is Subtitle', 'Comming Soon', '$departmentname', '3');"); //error check if(mysql_errno() != 0) { echo "INSERT INTO PageGeneric<BR><BR>"; echo $sqlTemp . "<BR>"; echo "<BR><BR>" . mysql_errno() . ": " . mysql_error() . "<BR>\n"; exit; }
  15. Ok I have a table that when you add a new department it will add the name to the table and assign the row and id based on an auto_increment column. From there you need to get the value of the last insert id. SO what I did was use the msql_insert_id() function. and assigned it to a variable. I then used that variable in my next query because this vaule is a forigen key in another table. Here is my code it should be exectued if you where to post this page with the value of $department_id = "" then the section of script in question will execture. Essentially need it to grab this id number and then place it into 2 more insert statements that should execute immediately after the first insert statement. Then only insert id that I would need is the one produced in the first insert statement what an auto increment value is assigned to the same table as the department_name Code: <?php // validates on the pageID of the Calendar page require( "../utils/auth.php" ); $auth = mysql_fetch_array(mysql_query("SELECT pageID FROM PageLocations WHERE location = 'contact.php'")); $pID = $auth['pageID']; require( "../access/access_via_passed_pageID.php" ); // to flag that a user has visited the page toolset (but not necessarily changed anything) include("../inc/after_user_verify.php"); // CITY DIRECTORY PAGES UPDATE DIRECTLY TO THE LIVE DATABASE and skip the three-tier system require( "../inc/conn_live.php" ); require_once( "../utils/string_utils.php" ); if( isset($_POST['btnSubmit']) ) { $department_id = $_GET['department_id']; if( $department_id == "" ) { // ADD NEW mysql_query("INSERT INTO CityHallDepartment (department_name) VALUES ('" . $_POST['department_name'] . "');"); echo "This is the department id".$departmentid.""; $departmentname = $_POST['department_name']; if($departmentname != NULL){ $departmentid = mysql_insert_id(); mysql_query("INSERT INTO PageGeneric (pid, bannerid, title, content, metadesc, layoutID) VALUES ('0', '$departmentname', 'Comming Soon', '$departmentname', '3');"); echo"The script executed into while loop"; $page = "generalpage.php?page=".$departmentid.""; mysql_query("INSERT INTO PageLocations (parentID, location, title, display, displayNavCMS, departmentID) VALUES ('0', '$page', '$departmentname', '1', '1', '0', $departmentid);"); }else{ echo"The script when to the else sections"; } } else { // UPDATE EXISTING mysql_query("UPDATE CityHallDepartment SET department_name = '" . $_POST['department_name'] . "' WHERE id = '" . $department_id . "'"); if( isset($_POST['main_contact']) ) { // clear the current main contact flag ... mysql_query("UPDATE CityHallDirectory SET department_head = 0 WHERE department_id = '" . $department_id . "'"); // ... then set the new main contact flag mysql_query("UPDATE CityHallDirectory SET department_head = 1 WHERE department_id = '" . $department_id . "' AND id = '" . $_POST['main_contact'] . "'"); } } header("Location: contact.php"); exit; } else { if( isset($_POST['department_id']) ) { // EDIT $department_id = $_POST['department_id']; } else { // ADD $department_id = ""; } $r_dept = mysql_query("SELECT * FROM CityHallDepartment WHERE id = '" . $department_id . "'"); $m_dept = mysql_fetch_array( $r_dept ); $department_name = $m_dept['department_name']; } if ( isset($_POST['btnDelete']) ) { $department_id = $_GET['department_id']; mysql_query("DELETE FROM CityHallDepartment WHERE id = '" . $department_id . "'"); header("Location: contact.php"); exit; } if ( isset($_POST['btnCancel']) ) { header("Location: contact.php"); exit; } ?>
  16. Thats what I did if you look at the code. The thing is why is it only exectuting one sql statement and not the other 2
  17. I am looking at this section of the code. if (isset($_GET['id']) && is_numeric($_GET['id'])) { $errors = array(); if ($submit) { $user = $name; $query = "SELECT friendID FROM friends WHERE friendID = '{$r['userid']}'"; $result = @mysql_query($query); $num = @mysql_num_rows($result); if ($num> 0) { echo '<font color="red">You have already added '. $r['knickname'] .' as your friend.</font>'; $errors[] = "1"; } else { My question is when you select $query = "SELECT friendID FROM friends WHERE friendID = '{$r['userid']}'"; It doesnt seem logical to look in a table called friedID to check if this user has been added to there profile. The users table prolly has a column called on the users table that links to the friends table. Let me see the structure of the tables. And I will let you know its prolly really simple.
  18. Ok I have a table that when you add a new department it will add the name to the table and assign the row and id based on an auto_increment column. From there you need to get the value of the last insert id. SO what I did was use the msql_insert_is() function. and assigned it to a variable. I then used that variable in my next query because this vaule is a forigen key in another table. Here is my code it should be exectued if you where to post this page with the value of $department_id = "" then the section of script in question will execture. Essentially need it to grab this id number and then place it into 2 more insert statements that should execute immediately after the first insert statement. Then only insert id that I would need is the one produced in the first insert statement what an auto increment value is assigned to the same table as the department_name Code: <?php // validates on the pageID of the Calendar page require( "../utils/auth.php" ); $auth = mysql_fetch_array(mysql_query("SELECT pageID FROM PageLocations WHERE location = 'contact.php'")); $pID = $auth['pageID']; require( "../access/access_via_passed_pageID.php" ); // to flag that a user has visited the page toolset (but not necessarily changed anything) include("../inc/after_user_verify.php"); // CITY DIRECTORY PAGES UPDATE DIRECTLY TO THE LIVE DATABASE and skip the three-tier system require( "../inc/conn_live.php" ); require_once( "../utils/string_utils.php" ); if( isset($_POST['btnSubmit']) ) { $department_id = $_GET['department_id']; if( $department_id == "" ) { // ADD NEW mysql_query("INSERT INTO CityHallDepartment (department_name) VALUES ('" . $_POST['department_name'] . "');"); echo "This is the department id".$departmentid.""; $departmentname = $_POST['department_name']; if($departmentname != NULL){ $departmentid = mysql_insert_id(); mysql_query("INSERT INTO PageGeneric (pid, bannerid, title, content, metadesc, layoutID) VALUES ('0', '$departmentname', 'Comming Soon', '$departmentname', '3');"); echo"The script executed into while loop"; $page = "generalpage.php?page=".$departmentid.""; mysql_query("INSERT INTO PageLocations (parentID, location, title, display, displayNavCMS, departmentID) VALUES ('0', '$page', '$departmentname', '1', '1', '0', $departmentid);"); }else{ echo"The script when to the else sections"; } } else { // UPDATE EXISTING mysql_query("UPDATE CityHallDepartment SET department_name = '" . $_POST['department_name'] . "' WHERE id = '" . $department_id . "'"); if( isset($_POST['main_contact']) ) { // clear the current main contact flag ... mysql_query("UPDATE CityHallDirectory SET department_head = 0 WHERE department_id = '" . $department_id . "'"); // ... then set the new main contact flag mysql_query("UPDATE CityHallDirectory SET department_head = 1 WHERE department_id = '" . $department_id . "' AND id = '" . $_POST['main_contact'] . "'"); } } header("Location: contact.php"); exit; } else { if( isset($_POST['department_id']) ) { // EDIT $department_id = $_POST['department_id']; } else { // ADD $department_id = ""; } $r_dept = mysql_query("SELECT * FROM CityHallDepartment WHERE id = '" . $department_id . "'"); $m_dept = mysql_fetch_array( $r_dept ); $department_name = $m_dept['department_name']; } if ( isset($_POST['btnDelete']) ) { $department_id = $_GET['department_id']; mysql_query("DELETE FROM CityHallDepartment WHERE id = '" . $department_id . "'"); header("Location: contact.php"); exit; } if ( isset($_POST['btnCancel']) ) { header("Location: contact.php"); exit; } ?>
  19. When it gets to this section of code. It will only execute the first insert statement. The other two queries are not executing. I even tried pulling it out of the if($departmentname != NULL){ conditional statement it they still will not exectue. What I would like to do is run a query so that when a column is created in the first table I can also create 2 more columns in two other tables. I cannot seem to get this for the life of me and it seems so simple that its embarrassing having to ask this question up here. All I need to do essentially is execute one query after the other. Mabe you have a code snippet of a php script that exectues multiple queries one after the other and try to make it work with this script. if( $department_id == "" ) { // ADD NEW mysql_query("INSERT INTO CityHallDepartment (department_name) VALUES ('" . $_POST['department_name'] . "');"); echo "This is the department id".$departmentid.""; $departmentname = $_POST['department_name']; if($departmentname != NULL){ $departmentid = mysql_insert_id(); mysql_query("INSERT INTO PageGeneric (pid, bannerid, title, content, metadesc, layoutID) VALUES ('0', '$departmentname', 'Comming Soon', '$departmentname', '3');"); echo"The script executed into while loop"; $page = "generalpage.php?page=".$departmentid.""; mysql_query("INSERT INTO PageLocations (parentID, location, title, display, displayNavCMS, departmentID) VALUES ('0', '$page', '$departmentname', '1', '1', '0', $departmentid);"); }else{ echo"The script when to the else sections"; } } else {
  20. Ok I have a table that when you add a new department it will add the name to the table and assign the row and id based on an auto_increment column. From there you need to get the value of the last insert id. SO what I did was use the msql_insert_is() function. and assigned it to a variable. I then used that variable in my next query because this vaule is a forigen key in another table. Here is my code it should be exectued if you where to post this page with the value of $department_id = "" then the section of script in question will execture. Essentially need it to grab this id number and then place it into 2 more insert statements that should execute immediately after the first insert statement. Then only insert id that I would need is the one produced in the first insert statement what an auto increment value is assigned to the same table as the department_name <?php // validates on the pageID of the Calendar page require( "../utils/auth.php" ); $auth = mysql_fetch_array(mysql_query("SELECT pageID FROM PageLocations WHERE location = 'contact.php'")); $pID = $auth['pageID']; require( "../access/access_via_passed_pageID.php" ); // to flag that a user has visited the page toolset (but not necessarily changed anything) include("../inc/after_user_verify.php"); // CITY DIRECTORY PAGES UPDATE DIRECTLY TO THE LIVE DATABASE and skip the three-tier system require( "../inc/conn_live.php" ); require_once( "../utils/string_utils.php" ); if( isset($_POST['btnSubmit']) ) { $department_id = $_GET['department_id']; if( $department_id == "" ) { // ADD NEW mysql_query("INSERT INTO CityHallDepartment (department_name) VALUES ('" . $_POST['department_name'] . "');"); echo "This is the department id".$departmentid.""; $departmentname = $_POST['department_name']; if($departmentname != NULL){ $departmentid = mysql_insert_id(); mysql_query("INSERT INTO PageGeneric (pid, bannerid, title, content, metadesc, layoutID) VALUES ('0', '$departmentname', 'Comming Soon', '$departmentname', '3');"); echo"The script executed into while loop"; $page = "generalpage.php?page=".$departmentid.""; mysql_query("INSERT INTO PageLocations (parentID, location, title, display, displayNavCMS, departmentID) VALUES ('0', '$page', '$departmentname', '1', '1', '0', $departmentid);"); }else{ echo"The script when to the else sections"; } } else { // UPDATE EXISTING mysql_query("UPDATE CityHallDepartment SET department_name = '" . $_POST['department_name'] . "' WHERE id = '" . $department_id . "'"); if( isset($_POST['main_contact']) ) { // clear the current main contact flag ... mysql_query("UPDATE CityHallDirectory SET department_head = 0 WHERE department_id = '" . $department_id . "'"); // ... then set the new main contact flag mysql_query("UPDATE CityHallDirectory SET department_head = 1 WHERE department_id = '" . $department_id . "' AND id = '" . $_POST['main_contact'] . "'"); } } header("Location: contact.php"); exit; } else { if( isset($_POST['department_id']) ) { // EDIT $department_id = $_POST['department_id']; } else { // ADD $department_id = ""; } $r_dept = mysql_query("SELECT * FROM CityHallDepartment WHERE id = '" . $department_id . "'"); $m_dept = mysql_fetch_array( $r_dept ); $department_name = $m_dept['department_name']; } if ( isset($_POST['btnDelete']) ) { $department_id = $_GET['department_id']; mysql_query("DELETE FROM CityHallDepartment WHERE id = '" . $department_id . "'"); header("Location: contact.php"); exit; } if ( isset($_POST['btnCancel']) ) { header("Location: contact.php"); exit; } ?>
  21. Ok the problem is this i need to run 3 queries. The first query will insert a record into the database. It will have an auto increment id vaule when it is inserted. This vaule is what we are going to call the $departmentid I need to grab this value then store it into a variable so I can update 2 other tables with this vaule. Here is the code. The section of code that I am refering to is contained within the coditional if( $department_id == "" ) { What I need to do essentially is insert the record retrieve the insert id vaule the store data in 2 more tabes each of which will contain the insert id number. This script appears that it would do the job so long as $departmentid == "" and something gets assigned to $departmentid . Could someone tell me wy this script will only exectue the first line of sql code. Even if I take out the if conditional to test for the value of $departmentid it will still only execute one line of sql. I need to be able to exectue a sequece of sql statements when this code block is executed any ideas. I will send a tip via paypal for any advice that works. <?php // validates on the pageID of the Calendar page require( "../utils/auth.php" ); $auth = mysql_fetch_array(mysql_query("SELECT pageID FROM PageLocations WHERE location = 'contact.php'")); $pID = $auth['pageID']; require( "../access/access_via_passed_pageID.php" ); // to flag that a user has visited the page toolset (but not necessarily changed anything) include("../inc/after_user_verify.php"); // CITY DIRECTORY PAGES UPDATE DIRECTLY TO THE LIVE DATABASE and skip the three-tier system require( "../inc/conn_live.php" ); require_once( "../utils/string_utils.php" ); if( isset($_POST['btnSubmit']) ) { $department_id = $_GET['department_id']; if( $department_id == "" ) { // ADD NEW mysql_query("INSERT INTO CityHallDepartment (department_name) VALUES ('" . $_POST['department_name'] . "');"); echo "This is the department id".$departmentid.""; $departmentname = $_POST['department_name']; if($departmentname != NULL){ $departmentid = mysql_insert_id(); mysql_query("INSERT INTO PageGeneric (pid, bannerid, title, content, metadesc, layoutID) VALUES ('0', '$departmentname', 'Comming Soon', '$departmentname', '3');"); echo"The script executed into while loop"; $page = "generalpage.php?page=".$departmentid.""; mysql_query("INSERT INTO PageLocations (parentID, location, title, display, displayNavCMS, departmentID) VALUES ('0', '$page', '$departmentname', '1', '1', '0', $departmentid);"); }else{ echo"The script when to the else sections"; } } else { // UPDATE EXISTING mysql_query("UPDATE CityHallDepartment SET department_name = '" . $_POST['department_name'] . "' WHERE id = '" . $department_id . "'"); if( isset($_POST['main_contact']) ) { // clear the current main contact flag ... mysql_query("UPDATE CityHallDirectory SET department_head = 0 WHERE department_id = '" . $department_id . "'"); // ... then set the new main contact flag mysql_query("UPDATE CityHallDirectory SET department_head = 1 WHERE department_id = '" . $department_id . "' AND id = '" . $_POST['main_contact'] . "'"); } } header("Location: contact.php"); exit; } else { if( isset($_POST['department_id']) ) { // EDIT $department_id = $_POST['department_id']; } else { // ADD $department_id = ""; } $r_dept = mysql_query("SELECT * FROM CityHallDepartment WHERE id = '" . $department_id . "'"); $m_dept = mysql_fetch_array( $r_dept ); $department_name = $m_dept['department_name']; } if ( isset($_POST['btnDelete']) ) { $department_id = $_GET['department_id']; mysql_query("DELETE FROM CityHallDepartment WHERE id = '" . $department_id . "'"); header("Location: contact.php"); exit; } if ( isset($_POST['btnCancel']) ) { header("Location: contact.php"); exit; } ?>
  22. Ok I am having and issue getting this code working. It seems rather simple but I cannot figure out why only one sql statement is exectuing and the insert statements the other 2 are not exectuting and updating the other 2 tables. I need to do this. I need to update one table, then from that I need to retrieve the mysql_insert_id or just get the id of the last record in the tabe. There is an auto increment column that gets assigned a unique id each time a record is inserted. I need this id number then I need it to place data into 2 other tables that will use this value as a reference. here is the code. if( isset($_POST['btnSubmit']) ) { $department_id = $_GET['department_id']; if( $department_id == "" ) { // ADD NEW mysql_query("INSERT INTO CityHallDepartment (department_name) VALUES ('" . $_POST['department_name'] . "')"); echo "This is the department id".$departmentid.""; $departmentname = $_POST['department_name']; if($departmentname != NULL){ $departmentid = mysql_insert_id(); mysql_query("INSERT INTO PageGeneric (pid, bannerid, title, content, metadesc, layoutID) VALUES ('0', '$departmentname', 'Comming Soon', '$departmentname', '3')"); echo"The script executed into while loop"; $page = "generalpage.php?page=".$departmentid.""; mysql_query("INSERT INTO PageLocations (parentID, location, title, display, displayNavCMS, departmentID) VALUES ('0', '$page', '$departmentname', '1', '1', '0', $departmentid)"); }else{
×
×
  • Create New...

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.