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
Switch to threaded view of this topic Create a new topic Submit Reply
testing for source to use [message #181611] Fri, 24 May 2013 03:23 Go to next message
richard is currently offline  richard   
Messages: 213
Registered: June 2013
Karma: 0
Senior Member
In this bit of code, the procedure is fairly simple.
1) get the value from the database.
2) check the value to find out what the first character is.
3) if the first character is "/" then the source is my site.
4) if not, the source is youtube.

I chose the / because I've never seen it used in the values on youtube.
and it makes finishing off the url easier.

the problem is, no matter what link I select, the url is always MY SITE!

What other ways can I do this?

Oh, and Beau dear? Shut the fuck up with seeing a big blank page because
that makes you a liar.

www.mroldies.net/test4.php



$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;
Re: testing for source to use [message #181612 is a reply to message #181611] Fri, 24 May 2013 03:36 Go to previous messageGo to next message
Beauregard T. Shagnas is currently offline  Beauregard T. Shagnas
Messages: 154
Registered: September 2010
Karma: 0
Senior Member
richard the sto0pid wrote:

> Oh, and Beau dear? Shut the fuck up with seeing a big blank page because
> that makes you a liar.
>
> www.mroldies.net/test4.php

That's not the same page, sto0pid.

Your previous iteration - that which I was talking about - was completely
blank when JavaScript is blocked or not enabled.

This: http://www.mroldies.net/test3.html which at this moment is still
active, and blank.

BTW, you should hire someone who has at least a scrap of artistic
abilities. You certainly don't.

--
-bts
-This space for rent, but the price is high
Re: testing for source to use [message #181619 is a reply to message #181611] Fri, 24 May 2013 10:17 Go to previous messageGo to next message
JohnT is currently offline  JohnT
Messages: 16
Registered: April 2011
Karma: 0
Junior Member
On Thu, 23 May 2013 23:23:51 -0400, richard wrote:

>
> if ($v1="/"){$yt="http://mroldies.net".$vid[0];} echo "<br />".$yt;

Should be:
if ($v1=="/"){$yt="http://mroldies.net".$vid[0];} echo "<br />".$yt;

I think you've been advised of a similar error recently.

Regards
JohnT
Re: testing for source to use [message #181620 is a reply to message #181611] Fri, 24 May 2013 10:50 Go to previous messageGo to next message
Doug Miller is currently offline  Doug Miller
Messages: 171
Registered: August 2011
Karma: 0
Senior Member
richard <noreply(at)example(dot)com> wrote in news:1ij92ldq768qa.1x65hwkghfrwa.dlg@
40tude.net:

[...]
> the problem is, no matter what link I select, the url is always MY SITE!
>
[...]

> if ($v1="/"){$yt="http://mroldies.net".$vid[0];}

Same problem you had on your last question: the above is an assignment statement, not a
comparison. The equality comparison operator in php is ==, not =.
Re: testing for source to use [message #181622 is a reply to message #181620] Fri, 24 May 2013 11:53 Go to previous messageGo to next message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma: 0
Senior Member
In article <XnsA1CA4644ADFF2dougmilmaccom(at)78(dot)46(dot)70(dot)116>,
Doug Miller <doug_at_milmac_dot_com(at)example(dot)com> wrote:

> richard <noreply(at)example(dot)com> wrote in news:1ij92ldq768qa.1x65hwkghfrwa.dlg@
> 40tude.net:
>
> [...]
>> the problem is, no matter what link I select, the url is always MY SITE!
>>
> [...]
>
>> if ($v1="/"){$yt="http://mroldies.net".$vid[0];}
>
> Same problem you had on your last question: the above is an assignment
> statement, not a
> comparison. The equality comparison operator in php is ==, not =.

Fuckin' Ada, richard, how about *learning* some shit before posting
dopey questions, eh? How about looking through your code for simple
errors and, like, *fixing* them before posting here, eh?

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
Re: testing for source to use [message #181623 is a reply to message #181622] Fri, 24 May 2013 12:23 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
On 24/05/13 12:53, Tim Streater wrote:
> In article <XnsA1CA4644ADFF2dougmilmaccom(at)78(dot)46(dot)70(dot)116>,
> Doug Miller <doug_at_milmac_dot_com(at)example(dot)com> wrote:
>
>> richard <noreply(at)example(dot)com> wrote in
>> news:1ij92ldq768qa.1x65hwkghfrwa.dlg@
>> 40tude.net:
>>
>> [...]
>>> the problem is, no matter what link I select, the url is always MY
>> SITE!
>>> [...]
>>
>>> if ($v1="/"){$yt="http://mroldies.net".$vid[0];}
>>
>> Same problem you had on your last question: the above is an
>> assignment statement, not a comparison. The equality comparison
>> operator in php is ==, not =.
>
> Fuckin' Ada, richard, how about *learning* some shit before posting
> dopey questions, eh? How about looking through your code for simple
> errors and, like, *fixing* them before posting here, eh?
>
because he is a Dick?


--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.
Re: testing for source to use [message #181624 is a reply to message #181611] Fri, 24 May 2013 12:38 Go to previous messageGo to next message
Scott Johnson is currently offline  Scott Johnson
Messages: 196
Registered: January 2012
Karma: 0
Senior Member
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
Re: testing for source to use [message #181625 is a reply to message #181622] Fri, 24 May 2013 13:10 Go to previous messageGo to next message
Doug Miller is currently offline  Doug Miller
Messages: 171
Registered: August 2011
Karma: 0
Senior Member
Tim Streater <timstreater(at)greenbee(dot)net> wrote in news:timstreater-B96075.12530724052013
@news.individual.net:

> Fuckin' Ada, richard, how about *learning* some shit before posting
> dopey questions, eh? How about looking through your code for simple
> errors and, like, *fixing* them before posting here, eh?

You don't understand who you're dealing with here. This may help:

https://groups.google.com/forum/?fromgroups#!search/richard$20the$20stoopid
https://groups.google.com/forum/?fromgroups#!search/richard$20the$20sto0pid
Re: testing for source to use [message #181661 is a reply to message #181625] Fri, 24 May 2013 19:10 Go to previous messageGo to next message
richard is currently offline  richard   
Messages: 213
Registered: June 2013
Karma: 0
Senior Member
On Fri, 24 May 2013 13:10:58 +0000 (UTC), Doug Miller wrote:

> Tim Streater <timstreater(at)greenbee(dot)net> wrote in news:timstreater-B96075.12530724052013
> @news.individual.net:
>
>> Fuckin' Ada, richard, how about *learning* some shit before posting
>> dopey questions, eh? How about looking through your code for simple
>> errors and, like, *fixing* them before posting here, eh?
>
> You don't understand who you're dealing with here. This may help:
>
> https://groups.google.com/forum/?fromgroups#!search/richard$20the$20stoopid
> https://groups.google.com/forum/?fromgroups#!search/richard$20the$20sto0pid

Bringing up ancient history is not good for YOU.
That moniker was given to me by a guy who simply edited an email I had sent
him, which he posted.
The good boys of AUK took it and made it their signature.
It's been politcally correct over the years to harass me for anything I
say, even though someone else who says the same damn thing, gets applauded.

I will remind you, that it was this very KOOK (RtS), who shot down and
identified the very kookmeister who made RtS his personal punching bag.
When I found out who he really was, the chicken shit high tailed to parts
unknown and would never say another word to me.

So I'm stupid huh?
Then how come my IQ is routinely tested at 125?

Now let's see how smart you are.
You have a set of equal squares lined up in a 3x3 pattern.
How many boxes do you see?
86% of the people get the answer wrong.

Brought to you by the "Lord of the Bull!".
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 next message
richard is currently offline  richard   
Messages: 213
Registered: June 2013
Karma: 0
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.
Re: testing for source to use [message #181665 is a reply to message #181661] Fri, 24 May 2013 21:41 Go to previous messageGo to next message
Doug Miller is currently offline  Doug Miller
Messages: 171
Registered: August 2011
Karma: 0
Senior Member
richard <noreply(at)example(dot)com> wrote in news:1f2h8l3xg19eu$.qdytiuo8qvql$.dlg@
40tude.net:

> On Fri, 24 May 2013 13:10:58 +0000 (UTC), Doug Miller wrote:
>
>> Tim Streater <timstreater(at)greenbee(dot)net> wrote in news:timstreater-
B96075.12530724052013
>> @news.individual.net:
>>
>>> Fuckin' Ada, richard, how about *learning* some shit before posting
>>> dopey questions, eh? How about looking through your code for simple
>>> errors and, like, *fixing* them before posting here, eh?
>>
>> You don't understand who you're dealing with here. This may help:
>>
>> https://groups.google.com/forum/?fromgroups#!search/richard$20the$20stoopid
>> https://groups.google.com/forum/?fromgroups#!search/richard$20the$20sto0pid
>
> Bringing up ancient history is not good for YOU.
> That moniker was given to me by a guy who simply edited an email I had sent
> him, which he posted.

And with good reason, too.

> The good boys of AUK took it and made it their signature.

And with good reason, too.

> It's been politcally correct over the years to harass me for anything I
> say, even though someone else who says the same damn thing, gets applauded.

No, Richard, you don't get harassed "for anything [you] say". This is what you get
"harassed" for:
- asking the same questions, over and over
- not listening to the answers...
- ... or worse, *arguing* with the answers
- criticizing people who are trying to help you
- never even considering that the problems you have are the direct result of _your own_
repeated failures to learn from experience
> [...]

> So I'm stupid huh?
> Then how come my IQ is routinely tested at 125?

Is that all?

Seriously. That's really not especially high. I certainly wouldn't go around bragging about a
125 IQ.
>
> Now let's see how smart you are.
> You have a set of equal squares lined up in a 3x3 pattern.

You mean like this?
http://math.about.com/od/weeklyproblem/ss/howmanysq.htm

> How many boxes do you see?
> 86% of the people get the answer wrong.
>
> Brought to you by the "Lord of the Bull!".

Evidently, I'm enough smarter than you to see that your question is ambiguous: does
"boxes" mean squares? or rectangles? or *any* enclosed figures?
Re: testing for source to use [message #181667 is a reply to message #181662] Fri, 24 May 2013 22:12 Go to previous message
Scott Johnson is currently offline  Scott Johnson
Messages: 196
Registered: January 2012
Karma: 0
Senior Member
On 5/24/2013 12:22 PM, richard wrote:
> 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.
>


Yes that is the expected return/functionality of substr(), especially if
you read the 'manual' on the function. It specifies that 0 is the base.

Always remember (or write it down). php.net is your friend.
  Switch to threaded view of this topic Create a new topic Submit Reply
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: Thu Nov 21 16:50:12 GMT 2024

Total time taken to generate the page: 0.04553 seconds