Jump to content

All the data is not being pulled from my rows.


steves

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

It should be:

[code]<?php
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]

Orio.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.