FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » testing for source to use
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: testing for source to use [message #181662 is a reply to message #181624] Fri, 24 May 2013 19:22 Go to previous messageGo to previous message
richard is currently offline  richard   
Messages: 213
Registered: June 2013
Karma:
Senior Member
On Fri, 24 May 2013 05:38:44 -0700, Scott Johnson wrote:

> On 5/23/2013 8:23 PM, richard wrote:
>
>>
>> $result = mysql_query("SELECT avid FROM A$year WHERE id = $number");
>> if (!$result) { echo 'Could not run query: ' . mysql_error(); exit; }
>> $vid = mysql_fetch_row($result);
>>
>> echo $vid[0];
>> $v=$vid[0];
>> $v1=substr($v,0,1);
>>
>>
>> $yt="http://www.youtube.com/watch?v=".$vid[0];
>>
>> if ($v1="/"){$yt="http://mroldies.net".$vid[0];}
>> echo "<br />".$yt;
>>
>
> Richard.....*lost for words*
>
> *refound*
>
> Brother you really should start keeping notes of these simple errors.
> You keep revisiting the errors that people do when they first start
> using PHP.
>
> Many in the NG have taken their own time to point these out and give you
> good advice, and to not learn or write the solutions down is being very
> disrespectful to those peoples times, which is why you probably get many
> disparaging comments.
>
> I have a very bad memory myself but I keep a notebook and revisit it
> whenever I run into an error to ensure I (or someone else) have not
> already solved it previously.
>
> Just a suggestion.
>
> Scotty

FYI, I found that I could use the substr() function to solve my problem
with.
With everything that I had read, there was one very important thing every
one of these writers left out!
That being, the natural mind says the first character is "1" and therefore
the number 1 should be used if you want to start at the begining.
e.g.
substr("123",1,1)
The output is "1" correct?
Wrong!
It is "2".
To output the "1", the correct code is substr("123",0,1).
Why?
I suspect that this is due to the fact the substring is treated as an array
and the array always begins with [0] by default.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: use a value form a manu list in a form on the same page
Next Topic: TEST only
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 11:41:12 GMT 2024

Total time taken to generate the page: 0.05036 seconds