PHP - Stuck, On Populating Multiple Lists
Ok, so i got this website project dropped in my lap, and I'm stuck not really having done much php coding ever. I have a database which is linked already, and it was working when pulling data from a specific table. The problem arose when I was asked to make it work with other tables. I have a table with the table names in it, and the drop down field to select the table populates. The next field is a multiple select field that is supposed to populate report dates from the previously selected table, and then finally the last multiple select field is supposed to populate with names that match the dates selected from the previous field. The last one I can live without, as the existing code takes into account if the name selected doesn't exist in the table with the selected date, but at the moment the date field just comes up blank. Any help would be greatly appreciated.
Similar Tutorialshello. i have an issue where the data stored with an image is not saving to a mysql table. the image data is ok, just not the selections from the dropdown lists. here is the code <?php include ('connect.php'); // Insert any new image into database if(isset($_POST['xsubmit']) && $_FILES['imagefile']['name'] != "") { $fileName = $_FILES['imagefile']['name']; $fileSize = $_FILES['imagefile']['size']; $fileType = $_FILES['imagefile']['type']; $content = addslashes (file_get_contents($_FILES['imagefile']['tmp_name'])); $jeweltype = $_POST['jeweltype']; $jewelsize = $_POST['jewelsize_in']; $jewelcolour = $_POST['jewelcolour_in']; $jewelmaterial = $_POST['jewelmaterial_in']; $jewelgender = $_POST['jewelgender_in']; if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); } // Checking file size if ($fileSize < 150000) { mysql_query ("INSERT into jewel_images (name,size,type,content,jeweltype,jewelsize,jewelcolour,jewelmaterial,jewelgender) " . "values ('$fileName','$fileSize','$fileType','$content','$jeweltype','$jewelsize','$jewelcolour','$jewelmaterial','$jewelgender')"); } else { $err = "The Image file to too large!"; } } // Find out about latest image $gotten = mysql_query("select * from jewel_images order by row_id desc"); $row = mysql_fetch_assoc($gotten); $bytes = $row['content']; // If this is the image request, send out the image if ($_REQUEST['pic'] == 1) { header("Content-type: $row[type];"); print $bytes; } ?> <html> <head> <title>Upload an image to a database</title> </head> <body> <font color="#FF3333"><?php echo $err ?></font> <table> <form name="Upload" enctype="multipart/form-data" method="post"> <tr> <td>Upload <input type="file" name="imagefile"><br /> Jewelery Type: <select> <?php $sql="SELECT jeweltype FROM jeweltypes"; $result =mysql_query($sql); while ($data=mysql_fetch_assoc($result)){ ?> <option value ="jeweltype" ><?php echo $data['jeweltype'] ?></option> <?php } ?> </select> <br /> Jewelery Size: <select> <?php $sql="SELECT jewelsize FROM jewelsizes"; $result =mysql_query($sql); while ($data=mysql_fetch_assoc($result)){ ?> <option value ="jewelsize" ><?php echo $data['jewelsize'] ?></option> <?php } ?> </select> <br /> Jewelery Colour: <select> <?php $sql="SELECT jewelcolour FROM jewelcolours"; $result =mysql_query($sql); while ($data=mysql_fetch_assoc($result)){ ?> <option value ="jewelcolour_in" ><?php echo $data['jewelcolour'] ?></option> <?php } ?> </select> <br /> Jewelery Material: <select> <?php $sql="SELECT jewelmaterial FROM jewelmaterials"; $result =mysql_query($sql); while ($data=mysql_fetch_assoc($result)){ ?> <option value ="jewelmaterial_in" ><?php echo $data['jewelmaterial'] ?></option> <?php } ?> </select> <br /> Jewelery Gender: <select> <?php $sql="SELECT jewelgender FROM jewelgenders"; $result =mysql_query($sql); while ($data=mysql_fetch_assoc($result)){ ?> <option value ="jewelgender_in" ><?php echo $data['jewelgender'] ?></option> <?php } ?> </select> <br /> <input type="submit" name="xsubmit" value="Upload"> </td> </tr> <tr> <td>Latest Image</td> </tr> <tr> <td><img src="?pic=1"></td> </tr> </form> </table> </body> </html> ============================================== here is the query =============================================== <html> <head><title>Your Page Title</title></head> <body> <?php $database="josh_jewel"; mysql_connect ("localhost", "xxxxxxxxx", "yyyyyyyyyyyy"); @mysql_select_db($database) or die( "Unable to select database"); $result = mysql_query( "SELECT jewelcolour FROM jewel_images" ) or die("SELECT Error: ".mysql_error()); $num_rows = mysql_num_rows($result); print "There are $num_rows records.<P>"; print "<table width=400 border=1>\n"; while ($get_info = mysql_fetch_row($result)){ print "<tr>\n"; foreach ($get_info as $field) print "\t<td><font face=arial size=1/>$field</font></td>\n"; print "</tr>\n"; } print "</table>\n"; ?> </body> </html> Ok, so I've spent quite a bit of time piecing together this solution from a variety of sources. As such, I may have something in my code below that doesn't make sense or isn't neccessary. Please let me know if that is the case. I'm creating an administrative form that users will you to add/remove items from a MySQL table that lists open positions for a facility. The foreach loop generates all of the possible job specialties from a table called 'specialty_list'. This table is joined to a second table ('open_positions') that lists any positions that have been selected previously. Where I'm stuck is getting the checkbox to be checked if the facility_ID from the open_positions table matches the $id passed in the URL via ?facility_id=''. Here's where I am so far: $query = "SELECT specialty_list.specialty_displayname , specialty_shortname , open_positions.position , facility_ID FROM specialty_list LEFT OUTER JOIN open_positions ON open_positions.position = specialty_list.specialty_shortname ORDER BY specialty_list.specialty_shortname"; $results = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_assoc($results)) { $positions[$row['specialty_shortname']] = $row['specialty_displayname']; } echo "<form method='POST' action='checkbox.php'>"; foreach($positions as $specialty_shortname => $specialty_displayname) { $facility_ID = $row['facility_ID']; $checked = $facility_ID == $row['facility_ID'] ? ' checked' : ''; echo "<input type='checkbox' name='position[]' value=\"{$specialty_shortname}\"{$checked}> {$specialty_displayname}</input><br/>"; } echo "<input type='hidden' name='facility_ID' value='$id'>"; echo "<input type='submit' value='Submit Checkboxes!'>"; echo "</form>"; Any ideas how to get this working? I feel like I'm very close, but I just can't get it. I also tried starting from scratch with a WHILE statement instead of a FOREACH, but haven't tweaked it enough to prevent duplicate checkboxes. With that in mind, here it is, just in case that's a better direction: $query = "SELECT specialty_list.specialty_displayname , specialty_shortname , open_positions.position , facility_ID FROM specialty_list LEFT OUTER JOIN open_positions ON open_positions.position = specialty_list.specialty_shortname ORDER BY specialty_list.specialty_shortname"; $results = mysql_query($query) or die(mysql_error()); echo "<form method='POST' action='checkbox.php'>"; while($row=mysql_fetch_assoc($results)) { $facility_ID = $row['facility_ID']; $specialty_shortname = $row['specialty_shortname']; $specialty_displayname = $row['specialty_displayname']; if ($facililty_ID==$id) { $checked=' checked'; } echo "<input type='checkbox' name='position[]' value=\"$specialty_shortname\"$checked> $specialty_displayname</input><br/>"; } echo "<input type='hidden' name='facility_ID' value='$id'>"; echo "<input type='submit' value='Submit Checkboxes!'>"; echo "</form>"; Folks, I am trying to learn PHP and I have spent the morning trying to sort out something seemingly simple but it is not working for me. I want to write a statement which says: if session variable "one" is empty or if session variable "two" is not equal to "svValue" then do this: if ((empty ($_SESSION["One"])) || if ($_SESSION["Two"] != "svValue ) { do this; } Could you point out the mistake(s) in my syntax? Thanks! John Hi, I need help to create a list like this with data from a database im having trouble doing so i have a table called company with 5 fields (installer, assessor, provider, trainer, other) if for example installer in the filed list = 1 then add to list else dont and see if assessor needs added if = 1 add then close list and see if provider = 1 if it does'tn then ask next. <ul> <li>Item 1</li> <li>Item 2</li> </ul> <ul> <li>Item 3</li> <li>Item 4</li> </ul> Hello Friends!.... here is the big idea. I am trying to make a form in which there will be 2 drop down lists which will be populating directly from MySQL DB .... Actually i am developing a student management system as my first PHP project... here i want to have 2 drop down lists first is roll number and second is student name. i want that when some one select the roll number in the first drop down the student name against it is automatically populated in the next drop down. please help me friends i am new to php and dont know soo much.! any help PLZZZZZZZZZZ Hi I have tried the mysql forum but have had no joy with an answer to my problem so wondered if php would be better. I want my users to be able to select from 5 different drop down lists where they can chose any combination from 1 up to all 5, I have attached the front end. These lists are being populated from mysql tables. Code for the drop down lists is as follows Code: [Select] <form action="horse-events-devon.php?url_countyid=<?php echo urlencode ($url_countyid ['url_countyid']) ; ?>&go" method="POST"> <table id="searchtable"> <tr> <th>Find By Discipline</th> <th>Find By Venue</th> <th>Find By Championship</th> <th>Find By Organiser</th> <th>Equine Association</th> <th>Submit Your Selections</th> </tr> <tr> <td><select name="dis_id"> <?php $upcomingdis = upcomingdis($url_countyid); $upcoming_dis_bycounty = mysql_fetch_assoc ($upcomingdis); ?> <?php do { ?> <option value="<?php echo $upcoming_dis_bycounty ['dis_id']; ?>" > <?php echo $upcoming_dis_bycounty ['dis_description']; ?></option> <?php } while ($upcoming_dis_bycounty = mysql_fetch_assoc ($upcomingdis)); ?></select></td> <td><select name="ven_id"> <?php $upvenbycounty_set = upcoming_venevents_bycounty($url_countyid); $upcoming_ven_bycounty = mysql_fetch_assoc ($upvenbycounty_set); ?> <?php do { ?> <option value="<?php echo $upcoming_ven_bycounty ['ven_id']; ?>" > <?php echo $upcoming_ven_bycounty ['ven_name']; ?></option> <?php } while ($upcoming_ven_bycounty = mysql_fetch_assoc ($upvenbycounty_set)); ?></select></td> <td><select name="champ_id"> <?php $championship_set = findchampionships(); $champlist = mysql_fetch_assoc ($championship_set); ?> <?php do { ?> <option value="<?php echo $champlist ['champ_id']; ?>" > <?php echo $champlist ['champ_description']; ?></option> <?php } while ($champlist = mysql_fetch_assoc ($championship_set)); ?></select></td> <td> <select name="org_id"> <?php $uporgbycounty_set = upcoming_organevents_bycounty($url_countyid); $upcoming_org_bycounty = mysql_fetch_assoc ($uporgbycounty_set); ?> <?php do { ?> <option value="<?php echo $upcoming_org_bycounty ['org_id']; ?>" ><?php echo $upcoming_org_bycounty ['org_name']; ?></option> <?php } while ($upcoming_org_bycounty = mysql_fetch_assoc ($uporgbycounty_set)); ?></select> </td> <td><select name="ass_id"> <?php $upassbycounty_set = upcoming_assevents_bycounty($url_countyid); $upcoming_assbycounty = mysql_fetch_assoc ($upassbycounty_set); ?> <?php do { ?> <option value="<?php echo $upcoming_assbycounty ['ass_id']; ?>" > <?php echo $upcoming_assbycounty ['ass_description']; ?></option> <?php } while ($upcoming_assbycounty = mysql_fetch_assoc ($upassbycounty_set)); ?></select></td> <td><input name="submit" type="submit" /><input name="countyid" type="hidden" value="<?php echo $url_countyid ['url_countyid']; ?>" /></td> </tr> </table> </form> My search processing is as follows Code: [Select] <?php if (isset($_POST['submit'])){ if (isset($_GET['go'])){ $countyid = $_POST['countyid']; $ven_id = $_POST['ven_id']; $dis_id = $_POST['dis_id']; $champ_id = $_POST['champ_id']; $org_id = $_POST['org_id']; $event_id = $row['event_id']; $sql = "SELECT DATE_FORMAT (events.startdate, '%a, %d, %b') AS stdate, events.event_id, events.title, events.ven_id, events.org_id, venue.county_id, venue.ven_id, eventdisciplines.event_id, eventdisciplines.dis_id, county.county_id, discipline.dis_id \n" . "FROM events \n" . "LEFT OUTER JOIN eventdisciplines \n" . "ON events.event_id = eventdisciplines.event_id \n" . "LEFT OUTER JOIN discipline \n" . "ON eventdisciplines.dis_id = discipline.dis_id \n" . "LEFT OUTER JOIN venue \n" . "ON events.ven_id = venue.ven_id \n" . "LEFT OUTER JOIN county \n" . "ON venue.county_id = county.county_id \n" . "WHERE events.ven_id = ({$ven_id} OR events.org_id = {$org_id})\n" . "AND events.startdate > NOW()\n" . "AND venue.county_id = {$countyid} \n" . "ORDER BY startdate ASC"; $result = mysql_query ($sql, $connection); ?> How am I best to do this please? my OR within the mysql does not work, should I not be doing this with php in the search processing? someones help would really be appreciated, just to point me in the right direction. [attachment deleted by admin] Hi all ! Could anyone point me in the correct direction of how to go about excluding results from a drown down menu, Basically i'm calling everyone who's a contact to the user in the code below, id like to remove contacts who already have a bank account with the user, So basically its something along the lines of if the player_id is already in the table bank_accounts as PlayersID, then its excluded, Hope this makes sense and any help would be great, Thanks Code: [Select] <select name="contact1" class="maintablepstats" id="contact1"> <option value=""></option> <?php $sql = "SELECT player_id, contact_id, name, is_active FROM contacts as c JOIN players as p ON c.contact_id = p.id WHERE c.player_id = $playerID AND is_active = 1 ORDER BY name ASC"; $que = mysql_query($sql) or die(mysql_error()); while($list = mysql_fetch_array($que)) { ?> <option value="<?php echo $list['contact_id'] ?>"><?php echo $list['name'] ?></option> <?php } ?> </select> <?php $con=mysql_connect("localhost","root",""); if(!$con) { die('could not connect' .mysql_error()); } mysql_select_db("hrc_fault",$con); $query = "SELECT * " . "FROM fault_book"; $result = mysql_query($query, $con) or die(mysql_error()); $num_movies = mysql_num_rows($result); $registered_comp=<<<EOD <h2><center>Registered Fault HRC</center></h2> <table width="70%" border="1" cellpadding="2" cellspacing="2" align="center"> <tr> <th>Job Cd No</th> <th>Date</th> <th>Section</th> <th>Item Description</th> <th>Item Sl.No</th> <th>Fault</th> </tr> EOD; $fault_details = ''; while ($row = mysql_fetch_array($result)) { $jc_no = $row['jc_no']; $date = $row['date']; $section = $row['section']; $itm_des = $row['itm_des']; $itm_slno = $row['itm_slno']; $fault_brf = $row['fault_brf']; $fault_details .=<<<RAM <tr> <td>$jc_no</td> <td>$date</td> <td>$section</td> <td>$itm_des</td> <td>$itm_slno</td> <td>$fault_brf</td> </tr> RAM; } $movie_footer ="</table>"; $movie =<<<MOVIE $jc_no $date $section $itm_des $itm_slno $fault_brf MOVIE; echo "There are $num_movies complains in our database"; echo $movie; ?> I m using above code but it only display the last record please debug the code I'm trying to retrieve data from my DB and have it populate the dropdown values inside a form: echo "<option value='0.00' " . ($array['roastturkey'] == '0.00' ? 'selected="selected"' : '') . ">0</option>";echo "<option value='1.00' " . ($array['roastturkey'] == '1.00' ? 'selected="selected"' : '') . ">1</option>";echo "<option value='2.00'> " . ($array['roastturkey'] == '2.00' ? 'selected="selected"' : '') . ">2</option>";echo "<option value='3.00'> " . ($array['roastturkey'] == '3.00' ? 'selected="selected"' : '') . ">3</option>";echo "<option value='4.00'> " . ($array['roastturkey'] == '4.00' ? 'selected="selected"' : '') . ">4</option>";echo "<option value='5.00'> " . ($array['roastturkey'] == '5.00' ? 'selected="selected"' : '') . ">5</option>";echo "<option value='6.00'> " . ($array['roastturkey'] == '6.00' ? 'selected="selected"' : '') . ">6</option>";echo "<option value='7.00'> " . ($array['roastturkey'] == '7.00' ? 'selected="selected"' : '') . ">7</option>";echo "<option value='8.00'> " . ($array['roastturkey'] == '8.00' ? 'selected="selected"' : '') . ">8</option>";echo "<option value='9.00'> " . ($array['roastturkey'] == '9.00' ? 'selected="selected"' : '') . ">9</option>";echo "<option value='10.00'> " . ($array['roastturkey'] == '10.00' ? 'selected="selected I'm using this code, but cannot get the data that's inside the DB to populate the dropdown value. I want it to get the info from the database so that the option that is saved in the database will be new default when the page is loaded. If I don't change it to the previous info it will update the database with the default option rather then the actual option. hi, I have a form that has 2 lists, first one has the months from Jan to Dec which i am done with, for the second list i want to have years from current year for other say 5 years. Example, we are in 2020 so i should have the list populate 2020,2021,2022,2023,2024 and next year it should show 2021-2025, how to do that. Here is what i have as HTML: <html> <head> <link rel="stylesheet" type="text/css" href="reportstyle.css"> </head> <body> <div class="form-wrapper"> <form action="reportanalysis.php" method="post"> <div class="form-item"> <h4>Select a month:</h4> <select id="months" name="months" required="required"> <option selected="selected" value="chose">Choose one option...</option> <option value="jan">Jan - 01</option> <option value="feb">Feb - 02</option> <option value="mar">Mar - 03</option> <option value="apr">Apr - 04</option> <option value="may">May - 05</option> <option value="jun">Jun - 06</option> <option value="jul">Jul - 07</option> <option value="aug">Aug - 08</option> <option value="sep">Sep - 09</option> <option value="oct">Oct - 10</option> <option value="nov">Nov - 11</option> <option value="dec">Dec - 12</option> </select> </div> <div class="form-item"> <h4>Select a year:</h4> <select id="years" name="years" required="required"> <option selected="selected" value="chose">Choose one option...</option> <option value="2020">2020</option> <option value="2021">2021</option> <option value="2022">2022</option> <option value="2023">2023</option> <option value="2024">2024</option> </select> </div> <div class="button-panel"> <center><button type="submit" name="reporting" class="buttonstyle">Generate Graph Report</button></center> </div> <div class="reminder"> <p><a href="home.php">Return to Main Menu</a> </div> </form> </div> </body> </html> Edited April 3, 2020 by ramiwahdan typo error Hello, I'm trying to populate a dropdown box in a RSForm using this code: //<code> $db = JFactory::getDbo(); $db->setQuery("SELECT Bruel_ID FROM mpctz_rsform_bruels"); return $db->loadObjectList(); //</code>However, it displays nothing in the box and some code outside of it (see attached file). Can anyone help? Thanks, Dani Attached Files APNAE.jpg 16.92KB 0 downloads I am trying to figure out how to display member records after selecting it from the box. I've got the dropdown box working which retrieves the members name but cannot figure out how to populate that members details on the same page? I'm using php/mysql and although I want to display the records I also want a user to update that record aswell, creating it for administrators to update accounts? Any help would be appreciated I've researched that ajax or javascript might be helpful but not totally familiar with them. Hi, I'm trying to populate the previous and next links with an id from mysql. The code below works but also displays ids that do not exist in the database. I want the code to only show me the rows that exist not the ones that do not exist. For example, at this time I have 5 rows. The ids of the rows are 1, 2, 3, 4, 6 when I get to say, id 6 and click on next it displays id 7 instead of going back to 1 or greying out next - meaning there's no more to view. Can someone help? <?php include('connection.php'); if(isset($_GET['id'])){ $start = $_GET['id']; }else{ $start = 0; } $sql = mysql_num_rows(mysql_query("SELECT * FROM thetable")); $result = mysqli_query($con,$sql); $rows = mysql_fetch_array($result); echo $rows['thetable']; if($start == 0){ echo "Previous «"; }else{ echo "<a href=\"./thepage.php?id=" . ($start - 1) . "\">« Previous </a>"; } if($start == $sql-1){ echo "Next »"; }else{ echo "<a href=\"./thepage.php?id=" . ($start + 1) . "\">Next »</a>"; } ?> <?php // End while loop. mysqli_close($con); ?> I need to fill an array dynamically with all the data in the users table. Any help will be appreciated, thanks! Basically, I have a database table called 'users' and I would like to populate a drop down box with these values of 'users'. How?? - to call upon the values is this: 'upduser2' Right now, all I am using is a text box, in where you have to type in the users name manually (this is so an admin can change variables and settings according to that current user). This is what I am using so far: <h3>Update User Level</h3> <? echo $form->error("upduser"); ?> <table> <form action="adminprocess.php" method="post"> <tr> <td> Username:<br /> <input type="text" name="upduser" maxlength="30" value="<? echo $form->value("upduser"); ?>" /></td> <td> Level:<br /> <select name="updlevel"> <option value="1">1 </option> //example settings <option value="9">9 </option> </select></td> <td><br /> <input type="hidden" name="subupdlevel" value="1" /> <input type="submit" value="Update Level" /></td> </tr> </form> </table></td> </tr> Much help would be appreciated. How would I force a certain table format and then populate it with the SQL results in their respective columns and rows? i.e. Code: [Select] +------------------+----------+----------+----------+ | | Col 1 | Col 2 | Col 3 | +-------------------+----------+----------+----------+ | row 1 lab data | 16777216 | | 573 | +-------------------+----------+----------+----------+ | row 2 lab data | 23454235 | 87247247 | 65743 | +-------------------+----------+----------+----------+ | row 3 lab data | 16777216 | 47832364 | | +-------------------+----------+----------+----------+ Currently I'm just using a while loop to populate it horizontally, but that doesn't work for row 1. Code: [Select] <?PHP while($row = mysql_fetch_array($result) { ?> blah blah blah html here <?PHP echo $row[0]; ?> more html <?PHP echo $row[1]; ?> and so forth <?PHP } ?> It ends up producing this: Code: [Select] +------------------+----------+----------+----------+ | | Col 1 | Col 2 | Col 3 | +-------------------+----------+----------+----------+ | row 1 lab data | 16777216 | 573 | | +-------------------+----------+----------+----------+ | row 2 lab data | 23454235 | 87247247 | 65743 | +-------------------+----------+----------+----------+ | row 3 lab data | 16777216 | 47832364 | | +-------------------+----------+----------+----------+ Hi, Can someone help me with the following problem... I am populating a html table with results from a mysql query. These results populate the 1st of four columns. The second column is a "RAG STATUS" dropdown menu - so GREEN/AMBER/RED. When this is selected I want it to change the colour of the corresponding row it is on. I have had a play around but can only get it to change the colour of the first row, no matter which dropdown menu I change. Code is below. If anything is not clear please let me know. Any help appreciated Code: [Select] <?php include ("commonTop.php"); include("dbvariables.php"); include("functions.php"); ?> <script type="text/javascript"> function changeBGCol(status) { document.getElementById("colour").bgColor=status; } </script> <?php $Checkout_ID = 2; $result = mysql_query( "SELECT Task FROM Task T, Checkout C Where T.Checkout_ID = C.Checkout_ID and C.Checkout_ID= $Checkout_ID" ) or die("SELECT Error: ".mysql_error()); $num_rows = mysql_num_rows($result); echo "This will be sent to the following recepients $num_rows records.<P>"; echo "<table width=70% border=3>\n"; echo "<tr><th>Check</th><th>STATUS</th><th>JIRA</th><th>Comments</th></tr>"; while ($get_info = mysql_fetch_row($result)){ echo "<tr id=colour>\n"; foreach ($get_info as $field) echo "\t<td><font face=arial size=1/>$field</font></td>\n"; echo "\t<td><select name='Status'> <option value='None'>-- Choose --</option> <option onclick='changeBGCol(this.value)' value='green' >GREEN</option> <option onclick='changeBGCol(this.value)' value='orange'>AMBER</option> <option onclick='changeBGCol(this.value)' value='red'> RED</option> </select></td>"; echo "\t<td><input type='text' name='JIRA'></td>"; echo "\t<td><input type='text' name='Comments'></td>"; echo "</tr>\n"; } print "</table>\n"; ?> [code] </code> Any help on this would be greatly appreciated. I am trying to run a mysqldump from my site for my client when they want to back up. They basically will jsut click a button to run the backup. With my script below, the backup file is genrated, but there is no table data in the file. There are the headers in the file with the server IP, linux versin, etc..., but there is no data in the file. Does this look right? Thank you for helping me out. Ryan Code: [Select] ini_set ("display_errors", "1"); error_reporting(E_ALL); $dbhost = 'localhost'; $dbuser = 'databaseuser'; $dbpass = 'password'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'database'; mysql_select_db($dbname); $tableName = 'lots'; $backupFile1 = '/home/stuff/wwwroot/stuff/appnew/backup/'; $backupFile = $backupFile1.$dbname . date("Y-m-d-H-i-s") . '.gz'; $command = "mysqldump --opt -h$dbhost -u$dbuser -p$dbpass $dbname | gzip > $backupFile"; system($command); $result = mysql_query($command); |