Re: Pulling data - stops at spaces

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



How does the data look in your actual database? Perhaps it was not inserted correctly in the first place?

Andres Figari wrote:

Hello,

I am sort of new to php and mysql (in regards to experience with it as a programmer), so my apologies for the silly questions :)

I am trying to pull text that was entered into a table. See code below. The only problem seems to be with lines like this:

$rows .= '<tr><td colspan=3>Video Title:</td><td><input name=video_title value='.$row['video_title'].' type=text maxlength=60></td></tr>';

Say the title is "the title", it only pulls out "the". I am wondering if I am using the wrong method for pulling the data, or if I should correct the way I am doing it. Looking at php.net I see these:

http://www.php.net/manual/en/ref.msql.php

Any suggestions for an alternative method?

thank you for your help :)

Andres


       /* Connecting, selecting database */
$link = mysql_connect($mysql_host, $mysql_user, $mysql_password) or die("Could not connect : " . mysql_error());
       mysql_select_db($mysql_db) or die("Could not select database");

       /* Performing SQL query */
       $query = "SELECT * FROM video where video_id=$video_id";
$result = mysql_query($query) or die("Query failed : " . mysql_error());
       $query2 = "SELECT * FROM artist";
$result2 = mysql_query($query2) or die("Query failed : " . mysql_error());

       /* Converting result of ad_type query into array */
       if ($result) {
               $row = mysql_fetch_array($result);
$rows .= '<tr><td colspan=3>Video ID:</td><td>&nbsp;'.$row['video_id'].'</td></tr>'; $rows .= '<tr><td colspan=3><input name=video_id value='.$row['video_id'].' type=hidden size=20></td></tr>'; $rows .= '<tr><td colspan=3>Video Title:</td><td><input name=video_title value='.$row['video_title'].' type=text maxlength=60></td></tr>'; $rows .= '<tr><td colspan=3>Recording Label:</td><td><input name=video_lable value='.$row['video_label'].' type=text maxlength=60></td></tr>'; $rows .= '<tr><td colspan=4><b>HTML Attributes</b></td></tr>'; $rows .= '<tr><td colspan=3>Title - HTML Tag:</td><td><input name=html_title value='.$row['html_title'].' type=text maxlength=60></td></tr>'; $rows .= '<tr><td colspan=3>Video URL:</td><td><input name=video_url value='.$row['video_url'].' maxlength=60></td></tr>'; $rows .= '<tr><td colspan=3>Keywords - Meta Tag:</td><td><textarea name=html_title value='.$row['video_meta_keywords'].' maxlength=847></textarea></td></tr>'; $rows .= '<tr><td colspan=3>Description - Meta Tag:</td><td><textarea name=html_title value='.$row['video_meta_description'].' maxlength=150></textarea></td></tr>'; $rows .= '<tr><td colspan=3>Abstract - Meta Tag:</td><td><textarea name=html_title value='.$row['video_meta_abstract'].' maxlength=150></textarea></td></tr>'; $rows .= '<tr><td colspan=4><b>Genres Below (more than one can be selected)</b></td></tr>'; $rows .= '<tr><td>Electronica:</td><td colspan=3><input type="checkbox" name="video_category_electronica"></td></tr>'; $rows .= '<tr><td>Rock:</td><td colspan=3><input type=checkbox name=video_category_rock></td></tr>'; $rows .= '<tr><td>HipHop:</td><td colspan=3><input type=checkbox name=video_category_hiphop></td></tr>'; $rows .= '<tr><td>Eclectic:</td><td colspan=3><input type=checkbox name=video_category_eclectic></td></tr>'; $rows .= '<tr><td>Humor:</td><td colspan=3><input type=checkbox name=video_category_humor></td></tr>'; $rows .= '<tr><td>Other:</td><td colspan=3><input type=checkbox name=video_category_other value='.$row['video_category_other:q'].'></td></tr>';
       }

       /*Converting result of artist query into array */
       if($result2){
               $num_rows2 = mysql_num_rows($result2);
               for($i=0;$i<$num_rows2;$i++){
                       $row2 = mysql_fetch_array($result2);
$artist_choice .= '<option value='.$row2['artist_id'].'>'.$row2['artist_name'];
                       }
       }


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux