Jump to content

Drewser33

Members
  • Posts

    67
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Drewser33's Achievements

Member

Member (2/5)

0

Reputation

  1. Yes, VARIABLE NAME - LOCAL_INFILE, VARIABLE_VALUE - ON
  2. I tried doing a chmod 777 on that directory, but the problem still exists.
  3. Mysql version 5.5 Linux OS - Debian LOAD DATA LOCAL INFILE '/var/tmp/import.csv' INTO TABLE r_data FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 ROWS (first_name,last_name,a_number,a_id) Error: The used command is not allowed with this MySQL version I have tried this from the mysql command line, phpmyadmin, and a php script, all with the same error. I have changed the local_infile GLOBAL VARIABLE to ON and restarted the mysql service to no avail. There are a lot of ideas on this out there, but I can't seem to put it all together. I was able to run the version of LOAD DATA INFILE, if I placed the same CSV in the root mysql directory, so I know that the CSV information is valid. Thanks for any help.
  4. What I am trying to do is to submit as POST values to database_write.php, from within the while statement. What is happening is I am getting the second row of data every time I change the primary button. Currently database_write.php is just doing print_r($_POST), And my array is always the same, no matter which select box I choose from. How can I get the values to be associated with the row I am currently changing? Any help would be great, thanks. What I have so far: <table class="table table-bordered table-hover"> <thead> <th>Room Number</th> <th>Primary Caregiver</th> <th>Seconday Caregiver</th> </thead> <tbody class="list"> <?php $sql = 'SELECT alarm_device_id, alarm_description, alarm_device_type, notes FROM alarm_device where notes in (\'MSU\') ORDER BY alarm_description'; $retval = mysql_query( $sql, $con ); if(! $retval ) { die('Could not get data: ' . mysql_error()); } $x=0; while($row = mysql_fetch_array($retval, MYSQL_ASSOC)) { $id = $row['alarm_device_id']; $alarm_description = $row['alarm_description']; echo '<form id="msu_form">'; echo "<tr><td>{$row['alarm_description']}</td>"; echo "<td>"; $query2 = "SELECT alert_device_id,alert_description FROM alert_device WHERE notes = 'MSU'"; $result2 = mysql_query($query2) or die("Error in alarm_device select:" . mysql_error()); $count2 = mysql_num_rows($result2); if($count2 > 0) { //echo '<select name='.$x.'>'; echo '<select id="Primary" name="primary" onchange="doAjaxPost(this)">'; while($row2 = mysql_fetch_array($result2)) { echo "<option value=".$row2['alert_device_id'].">".$row2['alert_description']."</option>"; } echo "</select>"; }else { echo "Please update alert device to this area"; } echo "</td>"; echo "<td>"; $query3 = "SELECT alert_device_id,alert_description FROM alert_device WHERE notes = 'MSU2'"; $result3 = mysql_query($query3) or die("Error in alarm_device select:" . mysql_error()); $count3 = mysql_num_rows($result3); if($count3 > 0) { echo '<select id="Secondary" name="secondary">'; while($row3 = mysql_fetch_array($result3)) { echo "<option value=".$row3['alert_device_id'].">".$row3['alert_description']."</option>"; } echo "</select>"; }else { echo "Please update alert device to this area"; } echo "</td>"; $aid = $id + $x; //echo $aid; //$ad = $alarm_description + $x; echo '<input type="hidden" id="ID" name="ID" value="'.$id.'"/>'; //echo '<input type="hidden" id="desc" name="desc" value="'.$ad.'"/>'; //echo '<td>'."<input type='submit' name='btnupdate' value='UPDATE' /></td>"; //echo '<td><input type="button" value="Ajax Request" onClick="doAjaxPost()"></td>'; echo '</form>'; $x = $x+1; } ?> <script> function doAjaxPost() { // get the form values var primary = $('#Primary').val(); var secondary = $('#Secondary').val(); var hidden = $('#ID').val(); //var desc = $(sel).parent().nextAll('#desc').val(); $.ajax({ type: "POST", url: "functions/database_write.php", data: $('#msu_form').serialize(), //data: "Primary="+primary+"&Hidden="+hidden+"&Secondary="+secondary, success: function(resp){ //we have the response alert("'" + resp + "'"); }, error: function(e){ alert('Error: ' + e); } }); } </script> </tr> </tbody> </table>
  5. Is there any way to have a field that will update any time its row is updated? My situation is that I will have multiple devices writing to a database, and in one case the time that is being kept track of is important. And the devices writing to the database are a bit difficult to keep accurate times on, so instead of writing the time from the devices themselves, I was hoping I could just have a field update itself. I know it can be done on INSERT, but I do not want to do an INSERT every time. Thanks!
  6. echo '<option value='.$row['ID'].'>'.$row['LastName'].', '. $row['FirstName'].'</option>'; This is part of a select box, so no, I did not have the []. I will use a checkbox instead, that will likely be a better type of input instead, and I will use the [] as you mention. Thank you. I will build the checkbox quickly and check it out.
  7. I get : string(2) "27"
  8. foreach($_POST['customerID'] as $value) Warning: Invalid argument supplied for foreach() I have used _GET as well, to confirm that there are values for this variable. What am I missing? Thanks
  9. This should be simple, but I can't seem to get it right. I am using a query to select values, it returns a list of 7 results. I would like to use a foreach for those results. Below is how I understand it (at this point just trying to view the results) but I am getting nothing. I am new to arrays and the foreach. $query = "SELECT a FROM table WHERE b IS NULL"; $result = mysql_query($query) or die (mysql_error()); $row = mysql_fetch_array($result); foreach($row['a'] as $value) { echo $value.'<br>'; } Thanks
  10. Is there a reason why IE doesn't just use the word Copy in a URL. It turned it into a copyright symbol? Firefox did not do this. Just wondering if anyone has any idea why.
  11. Table fields are DeviceID and GuardID. Existing in this table are a large number of rows with the same GuardID (49) and I would like to run an insert query to insert the same amount of rows with the same DeviceID's that will have a GuardID of 843. This is what what makes sense to us but it is not working. INSERT INTO DeviceGuard SELECT DeviceID FROM DeviceGuard WHERE GuardID = 49 , 843 Thanks
  12. Thanks Keith!! That query worked perfect.
  13. I am trying to write an update query with a null value. But I continue to get this error: "Incorrect date value: '' for column 'Date_Eng_replied' at row 1" The DB is set to allow Null Values for this field. I have tried defining the variable as Null in a few ways: $replydate = $_GET['replydate']; if($replydate == '') { unset($replydate); } AND $replydate = $_GET['replydate']; if($replydate == '') { $replydate = NULL; } AND $replydate = $_GET['replydate']; if($replydate == '') { $replydate = 'NULL'; } Query if needed $query4 = "UPDATE tblopen_issue_remarks SET Fix = '$fix', Date_Eng_replied = '$replydate', Status = '$status' WHERE ID = '$threadid'"; mysql_query($query4) or die(mysql_error()); None of which will write the Null into the DB
×
×
  • 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.