Jump to content

bigdspbandj

Members
  • Posts

    36
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

bigdspbandj's Achievements

Member

Member (2/5)

0

Reputation

  1. Hey all. I am trying to copy a file from my webserver to a remote server via FTP. It's a zip file that works fine (when I download directly from the web server). The file shows up in the correct location on the remote server, but the file size is 0 and it can't be opened. I get the following error: Here is the code: function uploadFiles($ftp_info, $file_path, $file) { $zip_file = fopen($file_path.$file, 'r'); $ftp_connection = ftp_ssl_connect($ftp_info['host']); $login_result = ftp_login($ftp_connection, $ftp_info['username'], $ftp_info['password']); $ftp_pasv = ftp_pasv($ftp_connection, true); $upload = ftp_fput($ftp_connection, '/Walz/ToWalz/'.$file, $zip_file, FTP_BINARY); ftp_close($ftp_connection); fclose($zip_file); return $upload; }
  2. What is the correct syntax when part of my method call is a variable? DatabaseObject_$VARIABLE_ResidentData::LoginFailure The class name is dependent on who is accessing the application. The class is DatabaseObject_VARIABLENAME_ResidentData. The method exists, and it works when I replaced the variable name and hardcode the actual class name.
  3. I understand how ajax sends a request to a server side script and how it gets a response. A lot of my scripts are usually "process" scripts and follow this flow: user_interface.php (form leads to process script) process_data.php (script that processes form into database...) user_interface.php (back to user_interface via header() in proccess_data.php) I do this to keep file sizes down. Anyway how would I go about getting ajax to handle that kind of a script? Do I need to rewrite my scripts to be included as apposed to separate files that redirect? I am also trying to keep graceful degradation in mind.
  4. I just wasn't using the function in the correct spot. I used it after "then" in both cases.
  5. I am having trouble formating the date fielsds (date_time, or date_submitted and date_mailed). $sql = "SELECT *, max(case when job_status.status_label='Submitted' then job_status.date_time else null end) as date_submitted, max(case when job_status.status_label='Mailed' then job_status.date_time else null end) as date_mailed FROM jobs INNER JOIN job_status ON job_status.job_id = jobs.id WHERE job_status.status_label = 'Submitted' OR job_status.status_label = 'Mailed' group by jobs.id";
  6. It wouldn't let me modify the original post so here is the table again. Example: t1: iddescription 1apples 2oranges t2: idt1_idlabeldate 131added2008-01-23 141modified2008-01-23 132added2008-01-24 142modified2008-01-24 The result I would like to see is as follows: iddescriptiondate_addeddate_modified 1apples2008-01-232008-01-23 2oranges2008-01-242008-01-24
  7. Is there a query (joins, or nested query) that can merge multiple results into a single row? There are multiple records from t2 that match up with t1 via t1's primary key. Example: t1: iddescription 1apples 2oranges t2: idt1_idlabeldate 131added2008-01-23 141modified2008-01-23 132added2008-01-24 142modified2008-01-24 The only solutions I can think of are creating a temp table or to mess around with the loop to concat. a string with the data, but I am not sure which is best or of there is a more elegant solution. Thanks!
  8. Is there a query (joins, or nested query) that can merge multiple results into a single row? t1 ----- id blah t2 ----- id t1.id blah There are multiple records from t2 that match up with t1 via t1's primary key. Thanks!
  9. Hey, Cooldude That worked like a charm. Thanks! Would the implode method work on a select query as well?
  10. Running in to this error when trying to do a delete query: 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 '' at line 1 The query is executed, but the error prevents the code from being read any further. The id is set as an int. $delExceptionConn = dbConnect(); $exceptionPgs = $_POST['exceptionPages']; $check = false; $i = 0; while ($i <= count($exceptionPgs)) { $exceptionID = $exceptionPgs[$i]; $delExceptionSql = "DELETE FROM ct_print_setup WHERE id = $exceptionID"; mysql_query($delExceptionSql) or die(mysql_error()); ++$i; $check = true; } if (!$check) { echo 'Delete was unsuccesful'; } else { header('location: '.$config_basedir.'work-order.php?id='.$job_id.'&exceptionDeleted=1'); }
  11. I still get the same error. Also I thought single quotes weren't required when the value is numeric.
  12. I can't seem to find out what's wrong with the syntax: query: $prnSetupSql = "UPDATE ct_jobs SET print_setup = '$printSetup' WHERE id = $job_id"; $prnSetupQuery = mysql_query($prnSetupSql) or die(mysql_error()); error I am getting: 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 'all)' at line 1 I am the value is a string so I put it in the single quotes. For convenience I have posted all of the code below. Please Help. <?php session_start(); //include files and set general variables include 'includes/config.inc.php'; include 'includes/functions.inc.php'; // check for $_GET. If $_GET Check for type // check for $_GET job_id. if invalid redirect to base dir. if (isset($_GET['job_id']) && is_numeric($_GET['job_id'])) { $job_id = $_GET['job_id']; } else { echo 'we have trouble!!!'; } if (isset($_GET['type'])) { // if type 1 if ($_GET['type'] == 1) { $prnSetupConn = dbConnect(); // setup $_POST as variables $printSetup = $_POST['printSetup']; $stockID = $_POST['stock']; // update ct_jobs with print_setup $prnSetupSql = "UPDATE ct_jobs SET print_setup = '$printSetup' WHERE id = $job_id"; $prnSetupQuery = mysql_query($prnSetupSql) or die(mysql_error()); // check ct_print_setup for type 1 record $prnCheckSql = "SELECT id, job_id, type FROM ct_print_setup WHERE type = 1 AND job_id = $job_id"; $prnCheckQuery = mysql_query($prnCheckSql) or die('123123'); $prnCheckNumRows = mysql_num_rows($prnCheckQuery); // if type 1 record exists for job update with data else add new data if ($prnCheckNumRows > 0) { $prnRows = mysql_fetch_assoc($prnCheckQuery); $prnID = $prnRows['id']; $mainPrnSql = "UPDATE ct_print_setup SET stock_id = $stockID WHERE id = $prnID"; $mainPrnSql = mysql_query($mainPrnSql) or die('test'); if (isset($mainPrnQuery)) { header('location: '.$config_basedir.'work-order.php?id='.$job_id.'&prnUpdated=1'); } } else { $mainPrnSql = "INSERT INTO ct_print_setup (job_id, stock_id, type, pg_range) VALUES ($job_id, $stockID, 1, all)"; $mainPrnQuery = mysql_query($mainPrnSql) or die(mysql_error()); // redirect to work order page with $_GET "added" success message if (isset($mainPrnQuery)) { header('location: '.$config_basedir.'work-order.php?id='.$job_id.'&prnAdded=1'); } } // if type 1 record does not exists insert data in to ct_print_setup // redirect to work order page with $_GET "updated" success message } // if type 2 // insert records into ct_print setup // redirect to work order page with $_GET "exception added" success message } ?>
  13. I am trying to add the results of a query (specifically a particular field's value) to a new array. The result is either an empty array or the last row in the query result instead of all the rows. Here is my code: // query job_status table for current job_id $status_sql = "SELECT * FROM ct_job_status WHERE job_id = $job_id"; $status_result = mysql_query($status_sql); $status_count = mysql_num_rows($status_result); // loop results to build a $completed_status array $completed = array(); while ($status_rows = mysql_fetch_assoc($status_result)) { $completed[] = $status_rows['status_label']; } echo '<pre>'; print $completed; echo '</pre>'; Any help would be greatly appreciated. Thanks!
  14. I am trying to write a function that builds list of different query results, but the mysql_fetch_assoc function isn't working properly within my function. If anyone cares to take a gander and let us know what I may be missing. my function // Build list for over/index page function overview_list($category, $query_result, $query_numrows, $heading) { echo '<h3>'.$heading.'</h3>'; echo '<p class="list_description">'.$description.'</p>'; if ($query_numrows == 0) { switch ($category) { case 'proof': echo '<p>There are currently no jobs waiting to be proofed. <a href="submit_job.php">Click here to submit a new job!</a></p>'; break; case 'approval': echo '<p>There are currently no jobs for you to approve.</p>'; break; case 'mailing': echo '<p>There are currently no jobs scheduled for mailing today</p>'; break; } } else { echo '<ul>'; while ($$category_rows = mysql_fetch_assoc($query_result)) { echo '<li>'; echo '<h4 class="job_description"><span class="job_label">'.$$category_rows['association_name'].'</span><span class="tracking_num">'.$category.'_rows["tracking_num"]</span></h4>'; echo '<ul class="job_details">'; echo '<li class="qty">'.$$category_rows['pieces_cnt'].'</li>'; echo '<li class="date_submitted">'.$category.'_rows["date_submitted"]</li>'; echo '<li class="desired_maildate">'.$category.'_rows["desired_maildate"]</li>'; echo '<li class="date_mailed">'.$category.'_rows["date_mailed"]</li>'; echo '</ul>'; echo '</li>'; } echo '</ul>'; } } the query $proof_sql = "SELECT d_jobs.*, job_label AS 'association_name', d_status.*, date_format(d_jobs.desired_maildate, '%m-%d-%y') AS desired_maildate, date_format(d_status.date, '%m-%d-%y') AS status_date, d_jobs.id AS job_id FROM d_jobs, d_status WHERE d_jobs.login_id = 5 AND d_jobs.current_status = 'Submitted' AND d_status.job_id = d_jobs.id AND d_status.label = 'Submitted' ORDER BY d_status.date"; $proof_result = mysql_query($proof_sql) or die('Sorry, but we could not establish a connection with our database. Please try again later.'); $proof_numrows = mysql_num_rows($proof_result); overview_list('proof', $proof_result, $proof_numrows, 'Jobs Awaiting Soft Proof From Optimal');
×
×
  • 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.