qry doesn't return complete results

#1
[eluser]justmelat[/eluser]
Hello All

The following code works fine except, if the title is one word like, nurse, clerk, everything is fine, but if it's 'web developer', 'project manager', the second word is left off. How do I correct that?

I have the following in my controller:

function conEdit()
{
$this->db->where('id',$this->uri->segment(3));
$data['query']=$this->db->get('contractors');


$this->load->view('conEdit_v.php', $data);

}

and the following in my view:

<?php echo form_open('purestaff/con_dbupdate'); ?>
<?php echo form_hidden('id',$this->uri->segment(3)); ?>
<?php if($query->num_rows()==1):?>
<?php foreach($query->result() as $row):?>
<p>First Name:&lt;input type="text" size="20"value=&lt;?php echo $row-&gt;fname;?&gt; name="fname"/></p>
<p>Last Name:&lt;input type="text" size="20" value=&lt;?php echo $row-&gt;lname;?&gt; name="lname"/></p>
<p>Title:&lt;input type="text" rows="2" cols="20" value=&lt;?php echo $row-&gt;title;?&gt; name="title"/></p>
<p>Comments:&lt;textarea name="comments"/&gt;&lt;?php echo $row->comments;?&gt; &lt;/textarea&gt;</p>
&lt;?php endforeach;?&gt;
&lt;input type="submit" value="update"/&gt;
&lt;?php else:?&gt;
&lt;?php echo"error!";?&gt;
&lt;?php endif;?&gt;

#2
[eluser]Glen Swinfield[/eluser]
You need to quote your values:

<p>First Name:&lt;input type="text" size="20" value="&lt;?php echo $row-&gt;fname;?&gt;" name="fname"/></p>

#3
[eluser]justmelat[/eluser]
Wow can't believe I didn't see that, thanks so much!!!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.