dennismonsewicz Posted March 27, 2008 Share Posted March 27, 2008 my sql statement is creating a blank field then inserting the data in the next field within the table. Any ideas what causes this? Link to comment https://forums.phpfreaks.com/topic/98225-blank-field-then-data-field/ Share on other sites More sharing options...
Caesar Posted March 27, 2008 Share Posted March 27, 2008 Number of reasons. One would be, a loop with bad logic. Can't say for sure without seeing your code. Link to comment https://forums.phpfreaks.com/topic/98225-blank-field-then-data-field/#findComment-502596 Share on other sites More sharing options...
dennismonsewicz Posted March 27, 2008 Author Share Posted March 27, 2008 if(move_uploaded_file) { include "includes/sql.php"; $query = "insert into uploads (username, name, size, type, url, categories, downloaded_by) " . "values ('$uploaded_by', '$filename', '$filesize', '$filetype', '$url', '$categories', '')"; mysql_query($query) or die("ERROR: " . mysql_error()); echo '<p>File loaded into Database successfully!</p>'; } else { echo '<p>There was a problem with inserting the file into the database! Please try again!</p>'; } } else { echo '<div class="maincontentheader"> <h2>' . ucwords($_SESSION['username']) . ', use the form below to upload an image!</h2> </div> <p>Make sure to add categories to this image.</p> <p> </p> <p>Adding categories allows for the image to show up during an image search!</p> <p> </p> <p>Example Categories: Cat, Dog, Ocean, Older Male, Female, etc...</p> <p> </p> <p style="font-size: 80%"><b>Note: if you have more than one category please make sure to separate them by a comma!</b></p> <p> </p> <!-- The data encoding type, enctype, MUST be specified as below --> <form enctype="multipart/form-data" action="upload.php?username=' . $_SESSION['username'] . '" method="POST" name="uploadfile"> <!-- MAX_FILE_SIZE must precede the file input field --> <input type="hidden" name="MAX_FILE_SIZE" value="9999999" /> <!-- Name of input element determines name in $_FILES array --> <p>Image Categories: <input name="categories" type="text" /></p> <p> </p> <p>Upload this file: <input name="userfile" type="file" /></p> <p><input type="submit" value="Upload File" /></p> </form>'; } //On-the-fly thumbnail generator include "thumbtest.php"; $thumbq = mysql_query("insert into thumbs (thumb_name) " . "values ('$filename')"); Link to comment https://forums.phpfreaks.com/topic/98225-blank-field-then-data-field/#findComment-502601 Share on other sites More sharing options...
cooldude832 Posted March 27, 2008 Share Posted March 27, 2008 echo out $query and take a look at it odds are the variables aren't defined as u expected. Link to comment https://forums.phpfreaks.com/topic/98225-blank-field-then-data-field/#findComment-502614 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.