Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

Select Query Displaying Funky in Text Box

Codes here !

Moderators: macek, egami, gesf

Select Query Displaying Funky in Text Box

Postby Chadf » Wed Mar 12, 2003 4:43 pm

The site that I am developing allows users to login and add their contributions to a self-publishing book review board.

The problem that I am having is that the following select statement refuses to put more than one word in either the "Work Reviewed" or " "Review Title" form fields on the "edit" page. The edit page allows users to go back and make corrections to previous reviews.

Also, PHP is adding extra space in the $reviewbody field every time it loads into the edit page. I tried using a multiline text box, like that of $reviewbody, for the Title and Work Reviewed fields and I got a similar result. For some reason, extra space is getting added into the variables just as they load.

I checked the DB and there are no extra spaces there. The datatypes are tinytext, tinytext and text respectively (if that matters here). I sort of assumed I was having an SQL issue at first, but then the data appears to be normal. This is weirding me out. :cry:

here's the code:

$reviewquery =("SELECT * FROM reviews WHERE reviewid='".$reviewid."'");
$result= mysql_query($reviewquery);
if(!$result)
die(mysql_error());


$row = mysql_fetch_array($result);
extract($row);

Echo "

<table><form action='updatereviews.php' method='POST'> \n
<tr>
<tr><td>Review Date:</td><td> $reviewdate</td>\n
</tr>
<tr>
<td>Work Reviewed:</td>
<td><INPUT TYPE='text' NAME='reviewedwork' size='60' value=$reviewedwork></td>
</tr>
<tr>
<td>Review Title:</td>
<td><INPUT TYPE='text' NAME='reviewtitle' size='80' value-$reviewtitle></td>
</tr>\n
<tr>
<td>Review Rating:</td>
<td>";

//I have a series of if statements that figure out which radio button should be checked in this section. That seems to be working fine.

$reviewdate = date("Y-m-d");

echo "</td><tr></table><TEXTAREA NAME='reviewbody' ROWS='20' COLS='90' WRAP='virtual'>
$reviewbody</textarea><br><br>\n
<INPUT TYPE='hidden' NAME='reviewid' VALUE=$reviewid> \n
<INPUT TYPE='hidden' NAME='reviewdate' VALUE=$reviewdate> \n
<INPUT TYPE='hidden' NAME='reviewerid' VALUE=$reviewerid> \n
<INPUT TYPE='hidden' NAME='logonuserpassword' VALUE=$userpasstxt>\n
<INPUT TYPE='hidden' NAME='logonusername' VALUE=$username> \n
<INPUT TYPE='Submit' NAME='updatereviews' VALUE='Update Review'></form></table><br>";


I'd really appreciate any advice you guys could give. Thanks a bunch.

-Chad (hat firmly in hand)
Chadf
New php-forum User
New php-forum User
 
Posts: 5
Joined: Sun Feb 23, 2003 4:18 pm
Location: Location, Location, Location

Postby pootergeist » Thu Mar 13, 2003 1:32 am

add quotes around the output variables

basically your syntax forces a html error

<input value=blat fooey /> would only display blat

<input value="blat fooey" /> would display blat fooey
pootergeist
New php-forum User
New php-forum User
 
Posts: 191
Joined: Wed Jan 29, 2003 7:11 am
Location: UK

Chad owes pootergeist beer/drink of choice.

Postby Chadf » Thu Mar 13, 2003 9:24 pm

Your advice worked perfectly; I'm back on track thanks to your help. I must admit my relative 'newbidity' in the area of PHP, and I appreciate your taking a minute to straighten me out. Thanks again.

Cheers,
-Chad
Chadf
New php-forum User
New php-forum User
 
Posts: 5
Joined: Sun Feb 23, 2003 4:18 pm
Location: Location, Location, Location


Return to mySQL & php coding

Who is online

Users browsing this forum: Yahoo [Bot] and 3 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron