Pulling data - stops at spaces

Pulling data - stops at spaces

am 24.05.2006 18:38:27 von Andres Figari

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 .= 'Video Title: value='.$row['video_title'].' type=text maxlength=60>';

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 .= 'Video
ID: '.$row['video_id'].'';
$rows .= ' value='.$row['video_id'].' type=hidden size=20>';
$rows .= 'Video Title: name=video_title value='.$row['video_title'].' type=text
maxlength=60>';
$rows .= 'Recording
Label: type=text maxlength=60>';
$rows .= 'HTML
Attributes
';
$rows .= 'Title - HTML
Tag: type=text maxlength=60>';
$rows .= 'Video URL: name=video_url value='.$row['video_url'].' maxlength=60>';
$rows .= 'Keywords - Meta
Tag:';
$rows .= 'Description - Meta
Tag:';
$rows .= 'Abstract - Meta
Tag:';
$rows .= 'Genres Below (more than
one can be selected)
';
$rows .= 'Electronica: type="checkbox" name="video_category_electronica">';
$rows .= 'Rock: type=checkbox name=video_category_rock>';
$rows .= 'HipHop: type=checkbox name=video_category_hiphop>';
$rows .= 'Eclectic: type=checkbox name=video_category_eclectic>';
$rows .= 'Humor: type=checkbox name=video_category_humor>';
$rows .= 'Other: type=checkbox name=video_category_other
value='.$row['video_category_other:q'].'>';
}

/*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 .= '

Re: Pulling data - stops at spaces

am 24.05.2006 18:45:34 von Brad Bonkoski

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 .= 'Video Title: > name=video_title value='.$row['video_title'].' type=text
> maxlength=60>';
>
> 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 .= 'Video
> ID: '.$row['video_id'].'';
> $rows .= ' > value='.$row['video_id'].' type=hidden size=20>';
> $rows .= 'Video Title: > name=video_title value='.$row['video_title'].' type=text
> maxlength=60>';
> $rows .= 'Recording
> Label: > type=text maxlength=60>';
> $rows .= 'HTML
> Attributes
';
> $rows .= 'Title - HTML
> Tag: > type=text maxlength=60>';
> $rows .= 'Video URL: > name=video_url value='.$row['video_url'].' maxlength=60>';
> $rows .= 'Keywords - Meta
> Tag:';
> $rows .= 'Description - Meta
> Tag:';
> $rows .= 'Abstract - Meta
> Tag:';
> $rows .= 'Genres Below (more than
> one can be selected)
';
> $rows .= 'Electronica: > type="checkbox" name="video_category_electronica">';
> $rows .= 'Rock: > type=checkbox name=video_category_rock>';
> $rows .= 'HipHop: > type=checkbox name=video_category_hiphop>';
> $rows .= 'Eclectic: > type=checkbox name=video_category_eclectic>';
> $rows .= 'Humor: > type=checkbox name=video_category_humor>';
> $rows .= 'Other: > type=checkbox name=video_category_other
> value='.$row['video_category_other:q'].'>';
> }
>
> /*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 .= '

Re: Pulling data - stops at spaces

am 24.05.2006 19:09:30 von Bastien Koert

Nah, he just needs to have the value in quotes when its presented as the
html form

bastien

>From: Brad Bonkoski
>To: Andres Figari
>CC: php-db@lists.php.net
>Subject: Re: [PHP-DB] Pulling data - stops at spaces
>Date: Wed, 24 May 2006 12:45:34 -0400
>
>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 .= 'Video Title: >>value='.$row['video_title'].' type=text maxlength=60>';
>>
>>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 .= 'Video
>>ID: '.$row['video_id'].'';
>> $rows .= ' >>value='.$row['video_id'].' type=hidden size=20>';
>> $rows .= 'Video Title: >>name=video_title value='.$row['video_title'].' type=text
>>maxlength=60>';
>> $rows .= 'Recording
>>Label: >>type=text maxlength=60>';
>> $rows .= 'HTML
>>Attributes
';
>> $rows .= 'Title - HTML
>>Tag: >>maxlength=60>';
>> $rows .= 'Video URL: >>name=video_url value='.$row['video_url'].' maxlength=60>';
>> $rows .= 'Keywords - Meta
>>Tag:';
>> $rows .= 'Description - Meta
>>Tag:';
>> $rows .= 'Abstract - Meta
>>Tag:';
>> $rows .= 'Genres Below (more than one
>>can be selected)
';
>> $rows .= 'Electronica: >>type="checkbox" name="video_category_electronica">';
>> $rows .= 'Rock: >>type=checkbox name=video_category_rock>';
>> $rows .= 'HipHop: >>type=checkbox name=video_category_hiphop>';
>> $rows .= 'Eclectic: >>type=checkbox name=video_category_eclectic>';
>> $rows .= 'Humor: >>type=checkbox name=video_category_humor>';
>> $rows .= 'Other: >>type=checkbox name=video_category_other
>>value='.$row['video_category_other:q'].'>';
>> }
>>
>> /*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 .= '

Re: Pulling data - stops at spaces

am 24.05.2006 20:51:01 von Andres Figari

Awesome, putting quotes worked!!!

Thanks a lot Brad and Bastien :)
Bastien Koert wrote:

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