Jump to content

dennismonsewicz

Members
  • Posts

    1,136
  • Joined

  • Last visited

Everything posted by dennismonsewicz

  1. I was able to figure it out here is the code for those who might want to know $sql = mysql_query("SELECT * FROM tbl_name") or die(mysql_error()); echo mysql_field_name($sql, 3); the number in the mysql_field_name array is the column name to display Here is where this code came from: http://aspn.activestate.com/ASPN/docs/PHP/function.mysql-field-name.html
  2. oh sorry mysql column names is what I am talking about $sql = "SELECT * FROM table"; $query = mysql_query($sql,$connection); $columns = mysql_num_fields($query); for($i = 0; $i < $columns; $i++) { print mysql_field_name($columns,$i); } How would I display a particular mysql column name more than once? IE: If I had a column name called Designer, and I needed to show that column name more than once, but just that particular column name
  3. I know how to get column names to show, but how would i show a particular column name to show more than once?
  4. make sure you have enctype="multipart/form-data" in the form tag
  5. thanks for everyone's help. I have a much better understanding of it now!
  6. does it work the same as this: $results = mysql_fetch_array($sql); $upload_name = $results['upload_name']; $size = $results['size']; could you say $results->upload_name?
  7. I have a bit of code: while($i < mysql_num_fields($result)) { $meta = mysql_fetch_field($result,$i); echo $i . ". " . str_replace($notallowed,"",$meta->name) . "<br />"; $i++; } what does $meta->name do exactly?
  8. I know its a retarded way of setting up it the table but its the only solution I can come up with for the project I am working on. Thanks for the help, the script worked like a charm
  9. You would assemble your download link like this: <a href="uploads/download.php?id=' . $id . '"><img src="uploads/image.jpg" border="0" /></a> here is a script I use for my downloads, now the download.php file must be in the uploads directory <?php $base_dir = "PATH_TO_UPLOAD_DIR""; //The place you'll store the files $id = $_GET['id']; include "../includes/sql.php"; $query = mysql_query("SELECT column_name from table_name where upload_id = '$id'") or die("ERROR: " . mysql_error()); $row = mysql_fetch_array($query); $file = $row['upload_name']; $file_extension = strtolower(substr(strrchr($file,"."),1)); $filename = $base_dir . $file; if ( ! file_exists( $file ) ) { echo "<html><title>eLouai's Download Script</title><body>ERROR: File not found. USE force-download.php?file=filepath</body></html>"; exit; } switch( $file_extension ) { case "pdf": $ctype="application/pdf"; break; case "exe": $ctype="application/octet-stream"; break; case "zip": $ctype="application/zip"; break; case "doc": $ctype="application/msword"; break; case "xls": $ctype="application/vnd.ms-excel"; break; case "ppt": $ctype="application/vnd.ms-powerpoint"; break; case "gif": $ctype="image/gif"; break; case "png": $ctype="image/png"; break; case "jpeg": case "jpg": $ctype="image/jpg"; break; default: $ctype="application/force-download"; } // required for IE, otherwise Content-disposition is ignored if(ini_get('zlib.output_compression')) ini_set('zlib.output_compression', 'Off'); header("Pragma: public"); // required header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private",false); // required for certain browsers header("Content-Type: $ctype"); // change, added quotes to allow spaces in filenames, by Rajkumar Singh header("Content-Disposition: attachment; filename=\"".basename($file)."\";" ); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".filesize($file)); readfile($file); exit(); ?>
  10. I thought it had to be an array... I am displaying column names in my sql table but some of the columns contain numbers, IE(Name1, Name2). I am wanting to strip out the 1, 2, 3, 4... or whatever number it happens to be.
  11. are you using static IPs? if so then hardcoding your IP address is fine, but if you have are using dynamic IP addresses then it will be really hard to hardcode your IP in the IF statement
  12. here is an upload script I have written: $sql = mysql_query("SELECT * FROM $TBL-NAME") or die(mysql_error()); $results = mysql_fetch_array($sql); $upload_dir = "PATH-TO-UPLOAD-DIR"; $upload_name = $_FILES['uploadedfile']['name']; $target_path = "uploads/"; $target_path = $target_path . basename($_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { $sql = mysql_query("INSERT INTO table_name (column1, column2, column3) VALUES ('$column1', '$column2', '$column3')") or die(mysql_error()); echo '<h2>Upload successful!</h2>'; echo '<p>Thanks for your contribution. Here is the information on <strong>' . $_FILES['uploadedfile']['name'] . '</strong>!</p>'; echo '<p>Name of Ad: ' . $_FILES['uploadedfile']['name'] . '</p>'; echo '<p>File width and height: ' . $ad_size . '</p>'; echo '<p>Company: ' . $company . '</p>'; if($comments) { echo '<p>Comments: ' . $comments . '</p>'; } echo '<h2><a href="upload.php?action=upload">Upload another file?</a></h2>'; } else { echo '<h2>Upload failed!</h2>'; echo $_FILES['uploadedfile']['error']; }
  13. Is there a way to manipulate a query to strip numbers out of a mysql query? Here is some example code I have written: $result = mysql_query("SELECT * FROM test") or die(mysql_error()); $i = 0; $notallowed = "1234567890"; while($i < mysql_num_fields($result)) { $meta = mysql_fetch_field(str_replace($notallowed, "", $result),$i); echo $i . ". " . $meta->name . "<br />"; $i++; }
  14. Has any ever used or even heard of drasticdata? Their web address is http://www.drasticdata.nl I am having a little problem with their script and was wondering if anyone had maybe found a fix or worked around it. I am using the dataGrid to accomplish my task. Thanks!
  15. and this will strip quotations from posted info from like a textarea?
  16. How would I strip single quotation and double quotation marks?
  17. the question came up when I was doing some server side validation...
  18. how would I go about taking text like out of a DB and truncate it after a set amount of characters? After 80 characters i would like to place a "read more" statement.
  19. WOW I didn't realize I had asked a loaded question! ROFL
  20. hmmm... i got that i was just wondering if there was anyway of doing it within the same if statement
  21. How would you say if($var == 2 AND/OR $var == 3) obviously the and/or being the logicals
×
×
  • 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.