Jump to content


  • Posts

  • Joined

  • Last visited

Profile Information

  • Gender
  • Location

spertuit's Achievements


Member (2/5)



  1. Thanks a million, I thought I had tried this, but must have missed it somehow. I appreciate the help!
  2. So I have a left join "SELECT * FROM `dailyMasterLogs` AS logs LEFT JOIN `vessels` AS vessel ON ( logs.logVesselID = vessel.vesselName) ORDER BY $field $order" This works, but I need to add in a where clause on the logVesselID. I want to select all from the dailymasterlogs where logvesselid = foo as logs, but thats not working. Any help on this?
  3. Wow, must be too early this morning var cell2 = row.insertCell(1); var element2 = document.createElement("input"); element2.type = "checkbox"; element2.name="breakfast" + rowCount + "[]"; element2.value = "breakfast"; cell2.appendChild(element2); rowCount does the trick
  4. This should be pretty easy but I can get this to work right. I am dynamically adding rows to a table and I want to append the number of the current row to the variable, these variables are arrays. (ex. variable1[], variable2[]) Example Code function addRow(tableID) { var table = document.getElementById(tableID); var rowCount = table.rows.length; var row = table.insertRow(rowCount); var currentRow = $(this).closest('tr'); var cell1 = row.insertCell(0); cell1.style.textAlign = 'left'; cell1.innerHTML = "<a onClick=\"deleteRow('dataTable', this.parentNode.parentNode.rowIndex)\" align=\"left\"> Remove this Guest</a>"; var cell2 = row.insertCell(1); var element2 = document.createElement("input"); element2.type = "checkbox"; element2.name="breakfast" + currentRow + "[]"; cell2.appendChild(element2); var cell3 = row.insertCell(2); var element2 = document.createElement("input"); element2.type = "checkbox"; element2.name="breakfast" + row + "[]"; cell3.appendChild(element2); So, I've tried using currentRow and row, still not working. Anyone have ideas?
  5. Nevermind, the problem was in the second part of my script. This seems fine.
  6. Can anyone see why my results would return more than 20 rows? $query = "SELECT * FROM mailer "; $limit = "ORDER BY id LIMIT 20 "; $result = mysql_query($query.$limit); if (!$result) { $message = 'Invalid query: ' . mysql_error() . "\n"; $message .= 'Whole query: ' . $query; die($message); } $address = 0; while ($row = mysql_fetch_assoc($result)) { $id=$row["id"]; $email=$row["email"]; $companyID=$row["companyID"]; }
  7. spertuit

    MySQL Join

    Can anyone give me a hand turning this into a join statement? $query1 = sprintf("SELECT * FROM companies WHERE status = 1"); $result1 = mysql_query($query1); while ($row1 = mysql_fetch_assoc($result1)) { $C1=$row1["companyName"]; $C3=$row1["id"]; $C4=$row1["businessType"]; $query="SELECT * FROM companyAdmins WHERE companyID = '$C3'"; $result=mysql_query($query); $num=mysql_numrows($result); $email=mysql_result($result,0,"email"); echo '<p>' . $C1 . ' @ ' . $email . '</p>'; } Im trying to select companyName,id, and business type from the companies table where the status is one and I'm also trying to select the email from the companyAdmins table where the companyID is equal to the id from the companies table. I want to basically get companyName.companies, id.companies, businessType.companies, and email.companyAdmins I have this file written and now I'm trying to go back and refactor the code and make everything cleaner.
  8. Creating a batching system w/ajax, good suggestion. I think the user can wait for awhile and at least they will get immediate results if the process completes. Ill see what I can come up with.
  9. I also tried setting variable equal to argv[1] and it said argv was undefined
  10. Lot of good questions, this seem liked the best way. i have a web portal where companies can log in and enter their employees. There is a process where the employees are created a placard and the placards are than zipped and emailed to the company admin The problem I have is the script that mails the zipped placards to the company admin takes too long to run.(Its over 1,000 admins) The browser gets half done and than a 500 error I thought the best way around this is to create a batch script that runs in the background and maybe it can execute my mail script. Any suggestions?
  11. Any ideas why argv would not be defined when trying to call the arguement passed from the batch file?
  12. I seem to have it working, but now I receive "Call to undefined function mysql_connect()", but this is only when the script is called from the batch file. If i call the script form the browser it works fine.
  13. So right now I'm trying In my first php script: <?php $par= "3"; $test=`c:\test.bat $par`; echo "<pre>$test</pre>"; ?> Than my test.bat: @echo OFF "C:\Program Files (x86)\PHP\v5.4\php-cgi.exe" C:\inetpub\wwwroot\Lafourche\parish Test.php?event=%1
  14. From a web page I need to call a .bat file and have that execute a php script. I need to pass a parameter from php to other php file. So it looks like my first php script would be something like this: system("cmd /c C:test.bat"); My bat file would be something like this: @echo OFF "C:\Program Files (x86)\PHP\v5.4\php-cgi.exe" C:\test.php%* But how can I pass a parameter, like I would call "file.php?event=3"?
  15. If they were textboxes I would use this function: public function createMeal($id,$table){ try{ //write query $breakfast = $_POST['breakfast']; $lunch = $_POST['lunch']; $dinner = $_POST['dinner']; $midnight = $_POST['midnight']; $lodging = $_POST['lodging']; $guestName = $_POST['guestName']; $repName = $_POST['repName']; $repTitle = $_POST['repTitle']; $masterLogID = $id; $this->deleteMealLog($id,'meals'); foreach($guestName as $a => $b) { $query = "INSERT INTO trips SET breakfast = ?, lunch = ?, dinner = ?, midnight = ?,lodging = ?,guestName = ?,repName = ?,repTitle = ?,masterLogID = ?"; $stmt = $this->conn->prepare($query); $stmt->bindParam(1,$breakfast[$a]); $stmt->bindParam(2,$lunch[$a]); $stmt->bindParam(3,$dinner[$a]); $stmt->bindParam(4,$midnight[$a]); $stmt->bindParam(5,$lodging[$a]); $stmt->bindParam(6,$guestName[$a]); $stmt->bindParam(7,$repName[$a]); $stmt->bindParam(8,$repTitle[$a]); $stmt->bindParam(9,$id); // Execute the query $stmt->execute(); } echo "Record was saved."; }catch(PDOException $exception){ //to handle error echo "Error: " . $exception->getMessage(); } }
  • 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.