steves Posted November 8, 2006 Share Posted November 8, 2006 Ok so if I have a row of data that contains "All this text should show" and i query that row, the only thing that would show up is "All" what command do I use to have it pull up all the data? It's like when it hits a space, it stops and goes onto the next row of information. [code]$search = @$_GET['search'] ; SQL LOGIN HERE$query = "SELECT * FROM ads WHERE ad LIKE '$search' order by ad"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)){ $title = $row["ad"]; $title2 = $row["ad_type"]; $title3 = $row["resort_name"]; $title4 = $row["resort_location"]; $title5 = $row["week"]; $title6 = $row["bed"]; $title7 = $row["bath"]; $title8 = $row["bath"]; $title9 = $row["ad_type"]; } echo "<form action=updated.php method=post>Ad: <input type=text name=ad value=$title><br>Ad Type: <input type=text name=ad_type value=$title2><br>Resort Name: <input type=text name=resort_name value=$title3><br>Resort Location: <input type=text name=resort_location value=$title4><br>Week: <input type=text name=week value=$title5><br>Bed: <input type=text name=bed value=$title6><br>Bath: <input type=text name=bath value=$title7><br><input type=Submit value=Update></form> "; ?>[/code] Link to comment https://forums.phpfreaks.com/topic/26600-all-the-data-is-not-being-pulled-from-my-rows/ Share on other sites More sharing options...
bqallover Posted November 8, 2006 Share Posted November 8, 2006 Are you sure all the text is being INSERTed into the DB? Have you checked it with PHPMyAdmin / MySQL Command Line / etc.? Or just a "SELECT * FROM ads"? Link to comment https://forums.phpfreaks.com/topic/26600-all-the-data-is-not-being-pulled-from-my-rows/#findComment-121663 Share on other sites More sharing options...
steves Posted November 8, 2006 Author Share Posted November 8, 2006 Yes I have phpmyadmin installed right now and all the informatoin is there. However I am slowly trying to build my own admin system so I will not have to rely on phpadmin. For example a resort location shows up in the database as "Las Vegas, Nevada" as being in the resort_location row. However with the script posted above, it will only pull out the word "Las" and move on to the next row. Any help is appreciated on this, thank you. Link to comment https://forums.phpfreaks.com/topic/26600-all-the-data-is-not-being-pulled-from-my-rows/#findComment-121664 Share on other sites More sharing options...
Orio Posted November 8, 2006 Share Posted November 8, 2006 You have to use quotes:echo "<input ... value=[b][color=red]\"[/color]".$var_with_spaces."[color=red]\"[/color][/b]>";If you dont use quotes, the browser get's this:<input type=text value=All this text should show>The browser doesnt know what the word "this" or "should" means, so it ignores/deletes it.By using quotes, the browser "understands" everything should be in the value.Orio. Link to comment https://forums.phpfreaks.com/topic/26600-all-the-data-is-not-being-pulled-from-my-rows/#findComment-121666 Share on other sites More sharing options...
bqallover Posted November 8, 2006 Share Posted November 8, 2006 :o Just looked at your HTML. You need to wrap all the name=value pairs as name="value". That's most likely why only one work is showing up. Hope that helps, :)EDIT: Yes, what Orio said. ;) Link to comment https://forums.phpfreaks.com/topic/26600-all-the-data-is-not-being-pulled-from-my-rows/#findComment-121668 Share on other sites More sharing options...
steves Posted November 8, 2006 Author Share Posted November 8, 2006 Ok i went ahead and made this change and still nothing. [code]Resort Name: <input type=text name=resort_name value=".$title3."><br>Resort Location: <input type=text name=resort_location value=".$title4."><br>[/code]If i put quotes around name="resort_name" then it gives me an error message. However this way it will display the text fields with the data, but still not pulling anything but the first word from the row. Strange thing is if I put $title3 just like that at the very bottom of the code, it displays the entire resort name without a problem. I just don't get it. Link to comment https://forums.phpfreaks.com/topic/26600-all-the-data-is-not-being-pulled-from-my-rows/#findComment-121671 Share on other sites More sharing options...
Orio Posted November 8, 2006 Share Posted November 8, 2006 It should be:[code]<?phpecho "<form action=updated.php method=post>Ad: <input type=text name=ad value=\"".$title."\"><br>Ad Type: <input type=text name=ad_type value=\"".$title2."\"><br>Resort Name: <input type=text name=resort_name value=\"".$title3."\"><br>Resort Location: <input type=text name=resort_location value=\"".$title4."\"><br>Week: <input type=text name=week value=\"".$title5."\"><br>Bed: <input type=text name=bed value=\"".$title6."\"><br>Bath: <input type=text name=bath value=\"".$title7."\"><br><input type=Submit value=Update></form> "; ?>[/code]Orio. Link to comment https://forums.phpfreaks.com/topic/26600-all-the-data-is-not-being-pulled-from-my-rows/#findComment-121674 Share on other sites More sharing options...
steves Posted November 8, 2006 Author Share Posted November 8, 2006 That fixed my problem, thank you very much for the fast response and willingness to help me out in this time of learning.Steve Link to comment https://forums.phpfreaks.com/topic/26600-all-the-data-is-not-being-pulled-from-my-rows/#findComment-121675 Share on other sites More sharing options...
Orio Posted November 8, 2006 Share Posted November 8, 2006 Sure thing :) Everyone was a starter at some point :)Orio. Link to comment https://forums.phpfreaks.com/topic/26600-all-the-data-is-not-being-pulled-from-my-rows/#findComment-121680 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.