Madnhain Posted August 9, 2011 Share Posted August 9, 2011 Greetings! I'm not sure if this is a PHP issue or MYSQL, but here it is: When I request the value from my database, it only returns to value to the point of the first space. For example if I insert "This is Data" into my database, when I select that field, the it will only display "This" It's not a length limit, I've tried replacing spaces with underscores, and it works fine, though ugly. So I'm thinking it's gotta be some kind of other issue. I'm using Type MyISAM and Collation is utf8_unicode_ci. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/244328-not-returning-full-value-of-field/ Share on other sites More sharing options...
Maq Posted August 9, 2011 Share Posted August 9, 2011 Please show us the relevant code. Quote Link to comment https://forums.phpfreaks.com/topic/244328-not-returning-full-value-of-field/#findComment-1254930 Share on other sites More sharing options...
PFMaBiSmAd Posted August 9, 2011 Share Posted August 9, 2011 <--- psychic crystal ball says you are missing some quotes around the value in your HTML so that the space is a stop character. Quote Link to comment https://forums.phpfreaks.com/topic/244328-not-returning-full-value-of-field/#findComment-1254933 Share on other sites More sharing options...
Madnhain Posted August 10, 2011 Author Share Posted August 10, 2011 here's some code snippets: Input information: <form action="main.php?content=process_new_daily_report" method="post"> <table width="788" border="0" cellspacing="2" cellpadding="0"> <tr height="30"> <td colspan="3">Pad / Well Names</td> <td colspan="4"><input type="text" name="i_Pad_Well_Names_1" size="24" /></td> </tr> ... <input type="submit" value="Submit" /> </form> Process information: $i_Pad_Well_Names_1 = $_POST['i_Pad_Well_Names_1']; $query = "INSERT INTO daily_reports (i_Pad_Well_Names_1, ) VALUES ('$i_Pad_Well_Names_1')"; Retrieve Information: $reportid = $_REQUEST['report']; $query = "SELECT * FROM daily_reports WHERE reportid = $reportid"; $result=mysql_query($query); $row = mysql_fetch_array($result, MYSQL_ASSOC); $i_Pad_Well_Names_1 = $row['i_Pad_Well_Names_1']; <input type='text' name='i_Pad_Well_Names_1' size='24' value=<?php echo $i_Pad_Well_Names_1 ?>> There are around 40 of entries that need to be entered, processed, and retrieved, all part of the same report (they are retrieved into an input field so they can be reviewed or modified) I only gave 1 of the many to keep the code short for this post, but all fields suffer the same problem. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/244328-not-returning-full-value-of-field/#findComment-1255119 Share on other sites More sharing options...
fenway Posted August 10, 2011 Share Posted August 10, 2011 Ignoring obvious SQL quoting problems, prove that what you're inserting works. Quote Link to comment https://forums.phpfreaks.com/topic/244328-not-returning-full-value-of-field/#findComment-1255251 Share on other sites More sharing options...
Maq Posted August 10, 2011 Share Posted August 10, 2011 You have a comma in your table name: i_Pad_Well_Names_1, Quote Link to comment https://forums.phpfreaks.com/topic/244328-not-returning-full-value-of-field/#findComment-1255288 Share on other sites More sharing options...
PFMaBiSmAd Posted August 10, 2011 Share Posted August 10, 2011 I think that's because he removed the other 39 fields when he posted the code. Quote Link to comment https://forums.phpfreaks.com/topic/244328-not-returning-full-value-of-field/#findComment-1255293 Share on other sites More sharing options...
fenway Posted August 10, 2011 Share Posted August 10, 2011 I think that's because he removed the other 39 fields when he posted the code. 39 fields that shouldn't be in the table to begin with? Quote Link to comment https://forums.phpfreaks.com/topic/244328-not-returning-full-value-of-field/#findComment-1255313 Share on other sites More sharing options...
Maq Posted August 10, 2011 Share Posted August 10, 2011 I think that's because he removed the other 39 fields when he posted the code. oops ;/ That's a lot anyway, but a whole different design issue. As fenway suggested, echo out your values when you're passing them from the HTML form, to the processing form (before you insert) to make sure the values are correct. Quote Link to comment https://forums.phpfreaks.com/topic/244328-not-returning-full-value-of-field/#findComment-1255321 Share on other sites More sharing options...
PFMaBiSmAd Posted August 10, 2011 Share Posted August 10, 2011 This is your code - <input type='text' name='i_Pad_Well_Names_1' size='24' value=<?php echo $i_Pad_Well_Names_1 ?>> This is your code as valid HTML - <input type='text' name='i_Pad_Well_Names_1' size='24' value='<?php echo $i_Pad_Well_Names_1 ?>'> I also recommend that you use htmlentities, with the second parameter set to ENT_QUOTES, on any data values you echo on a page so that any html special characters in the data (<, >, ', ", &) don't also break the HTML on your page. Quote Link to comment https://forums.phpfreaks.com/topic/244328-not-returning-full-value-of-field/#findComment-1255325 Share on other sites More sharing options...
Madnhain Posted August 10, 2011 Author Share Posted August 10, 2011 yes, there are some errors with quotations and syntax, because I did in fact remove a massive amount of code, and just pasted a sample of the pertinent lines. would it be more helpful if I just pasted the code in its entirety? Quote Link to comment https://forums.phpfreaks.com/topic/244328-not-returning-full-value-of-field/#findComment-1255357 Share on other sites More sharing options...
fenway Posted August 10, 2011 Share Posted August 10, 2011 yes, there are some errors with quotations and syntax, because I did in fact remove a massive amount of code, and just pasted a sample of the pertinent lines. would it be more helpful if I just pasted the code in its entirety? Never. But I doubt you removed single quotes when you cut & pasted. Quote Link to comment https://forums.phpfreaks.com/topic/244328-not-returning-full-value-of-field/#findComment-1255472 Share on other sites More sharing options...
Madnhain Posted August 10, 2011 Author Share Posted August 10, 2011 Thanks for the tips guys, I'll give it a shot adjusting the quotes, though I fail to see how that would give me partial data return. The echo out info is one of those "duh" moments that I should have thought of... thanks for that. I will give an update in a few days, unfortunately I won't be able to test these for a few days. Thank you again for your assistance! Quote Link to comment https://forums.phpfreaks.com/topic/244328-not-returning-full-value-of-field/#findComment-1255512 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.