dennismonsewicz
Members-
Posts
1,136 -
Joined
-
Last visited
Everything posted by dennismonsewicz
-
[SOLVED] showing column name more than once
dennismonsewicz replied to dennismonsewicz's topic in PHP Coding Help
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 -
[SOLVED] showing column name more than once
dennismonsewicz replied to dennismonsewicz's topic in PHP Coding Help
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 -
I know how to get column names to show, but how would i show a particular column name to show more than once?
-
make sure you have enctype="multipart/form-data" in the form tag
-
thanks for everyone's help. I have a much better understanding of it now!
-
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?
-
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?
-
[SOLVED] stripping numbers away from query
dennismonsewicz replied to dennismonsewicz's topic in PHP Coding Help
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 -
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(); ?>
-
[SOLVED] stripping numbers away from query
dennismonsewicz replied to dennismonsewicz's topic in PHP Coding Help
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. -
[SOLVED] stripping numbers away from query
dennismonsewicz replied to dennismonsewicz's topic in PHP Coding Help
BUMP -
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']; }
-
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++; }
-
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!
-
stripping quotes from post info
dennismonsewicz replied to dennismonsewicz's topic in PHP Coding Help
alright thanks! -
stripping quotes from post info
dennismonsewicz replied to dennismonsewicz's topic in PHP Coding Help
and this will strip quotations from posted info from like a textarea? -
How would I strip single quotation and double quotation marks?
-
the question came up when I was doing some server side validation...
-
WOW I didn't realize I had asked a loaded question! ROFL
-
ok thanks guys!
-
hmmm... i got that i was just wondering if there was anyway of doing it within the same if statement
-
How would you say if($var == 2 AND/OR $var == 3) obviously the and/or being the logicals