Re: [PHP-DB] Newbie Question $2

2014-06-18 Thread Michael Stowe
Can we kill this thread?  Or can you guys continue the conversation between
yourselves.  We now have 8 emails pertaining to the technical question, and
8 emails ranting about him asking it.

I understand that some people do not believe this is the appropriate forum
for that question - but personal attacks and rantings accomplish nothing
other than to provide bully tactics and express your outrage at "list
spamming" while spamming the list.

Thank you for your consideration.

- Mike


On Wed, Jun 18, 2014 at 11:49 AM, Jim Giner 
wrote:

> On 6/18/2014 2:16 PM, Aziz Saleh wrote:
>
>> On Wed, Jun 18, 2014 at 2:13 PM, Karl DeSaulniers 
>> wrote:
>>
>>
>>>
>>> Sent from losPhone
>>>
>>>  On Jun 18, 2014, at 7:56 AM, Jim Giner 

>>> wrote:
>>>

  On 6/18/2014 12:31 AM, Ethan Rosenberg, PhD wrote:
>
>> On 06/17/2014 12:02 PM, onatawah...@yahoo.ca wrote:
>> Hi Ethan,
>>
>> Here are some things to clean up your code:
>>
>> Your line:
>>
>> $phn = $_POST[phone];
>>
>> should use quotations as follows:
>>
>> $phn = $_POST['phone'];
>>
>> Your line:
>>
>> $sql1 ='select Lname, Fname from Customers where Phone = $Phn ';
>>
>> Should use double quotes if you need the variable to be interpreted:
>>
>> $sql1 ="select Lname, Fname from Customers where Phone = $Phn ";
>>
>> Lastly, as people have mentioned PDO is probably the best way to go.
>> Try connecting to your database with PDO. Look on Google for "PDO
>> prepared statements" and use those instead of the mysql escape string
>> method.
>>
>> Hope this helps,
>>
>> -Kevin
>>
>> Sent from Yahoo Mail on Android
>>
> IT WORKS!!!
>
> Here is the code -
>
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> http://www.w3.org/1999/xhtml";>
>
> 
> $bla = 1;
> ?>
>  
>  
>  
>  
>  
>  
>  
>  
>  
>  
>   error_reporting(-1);
>  require '/home/ethan/PHP/ethan.inc';
>  $db = "Store";
>  $cxn = mysqli_connect($host,$user,$password,$db);
>
>  $phn = $_POST[phone];
>  $phn = (string)$phn;
>  $dsh = '-';
>  $Phn =
>
>  $phn[0].$phn[1].$phn[2].$dsh.$phn[3].$phn[4].$phn[5].$dsh.$
>>> phn[6].$phn[7].$phn[8].$phn[9];
>>>

>  $sql1 ="select Lname, Fname from Customers where Phone =
> '$Phn' ";
>  $result1 = mysqli_query($cxn, $sql1);
>  if(!$result)
>  {
> ?>
>  
>
>  No Match Found
>  
>  
>   }
>
> ?>
>  
>   rules="all" frame="box">
>  
>  Last Name
>  First Name
> 
>  while($row1 = mysqli_fetch_row($result1))
>  {
>
>  $Lname = $row1[0];
>  $Fname = $row1[1];
>
>
>
> ?>  
>
>
>  
> }
> ?>
>
>  >
>  
> 
>
> As you [those that replied] accurately noted, the problem was with the
> quoting.
>
> I appreciate all your comments, take them seriously and will use the
> information contained in them for future programming.
>
> No matter how much skill in programming I have, I will remain a NEWBIE;
> ie, someone who wishes to grrow in knowledge and acknowledges that
> there
> are many programmers much more skilled than I.
>
> Thanks again.
>
> Ethan
>
 happy to hear you got it working.  Sad to see that you didn't heed the

>>> tips provided to you and alter your code, and that you still have errors
>>> in
>>> it.  oh, well
>>>


>>> Wow. Just wow. I though when I signed up on this list that if I did what
>>> Ethan did I would be shunned from the list. But I guess I was wrong. You
>>> can be an ask hole on here and people will still try and help. Kudos to
>>> the
>>> good souls who try.
>>>
>>> Karl
>>> --
>>> PHP Database Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>>  There are lots of people who have free time on their hands to teach the
>> basics, which I think is a good thing. Personally, if someone doesn't care
>> enough to read the manual or attempt to understand the basics, I wouldn't
>> spend too much time on their problems.
>>
>>  And despite Ethan's continual ignorance of the manual and the basic
> principles espoused by those taking

Re: [PHP-DB] Subject Matter

2013-08-26 Thread Michael Stowe
*"There are a lot of off topic emails sent. But there is far more whining
and
**complaining. Good grief!"

+1*

Let's remember that not everyone on the list is an expert programmer or
someone with years of DBA experience.  The purpose of the list (IMHO) is to
HELP others with their PHP/DB questions, or at least point them in the
right direction so that they can continue to learn and grow.  This is one
thing I have commended the PHP community for, their willingness to INCLUDE
people and be patient with newbies.  Sure there are going to be off-topic
conversations, questions that get proposed to the wrong list, etc - heck
I'm guilty of it myself.

But quite frankly (haven't had my coffee, be warned), if you're going to
complain that not every message on the list meets your specific standards,
then you're in the wrong place.  Add some filters to your mailbox, or
better yet, jump in and help out instead of complaining that "your needs"
aren't being met.

Just my two cents...

- Mike

ps - if you look on php.net it clearly says this list is NOT moderated...


On Mon, Aug 26, 2013 at 9:32 AM, Thomas Rudy  wrote:

> There are a lot of off topic emails sent. But there is far more whining and
> complaining. Good grief!
>
>
> On Fri, Aug 23, 2013 at 2:40 PM, Tamara Temple  >wrote:
>
> >
> > On Aug 23, 2013, at 7:32 AM, Jim Giner 
> > wrote:
> >
> > > On 8/23/2013 4:52 AM, Matt Pelmear wrote:
> > >> On 08/23/2013 04:36 PM, Lester Caine wrote:
> > >>> Matt Pelmear wrote:
> >  I am not sure who runs the list, whether they care about off-topic
> >  posts,
> >  or whether anyone else cares about it.
> > >>>
> > >>> The php lists are only loosely moderated, but comments like yours
> > >>> usually bring things under control. I'd refer you to my recent post
> > >>> thought as to why the current threads are not that far off topic ;)
> > >>>
> > >>
> > >> Indeed, that thread is one that is on topic... but I think the
> > >> signal-to-noise ratio on this list is rather poor ;)
> > >> If I'm the only one bothered by it, it's no big deal for me to
> > >> unsubscribe... I just thought I'd check the general opinion first.
> > >> I don't run into these problems on the internals list... :-)
> > >>
> > >> -Matt
> > >>
> > > Funny - I never knew this list was handling  off-topic posts that
> > regularly.  I always thought this list was about using php to access
> > database info and the problems incurred, such as Ethan's recent post
> about
> > his bad query code.
> > >
> > > So - this is supposed to be about "database integration"?  I'll have to
> > reconsider my subscription choice as well, just as soon as I look up
> > whatever the heck that is.  :)
> >
> > This is the description on www.php.net/mailing-lists.php:
> >
> > "Databases and PHP
> > This list is for the discussion of PHP database topics"
> >
> > Nothing more specific than that. I, personally, don't know of any PHP
> > databases, so I'm going to assume it means the broader interpretation of
> > using PHP with databases.
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>



-- 
---

"My command is this: Love each other as I
have loved you." John 15:12

---


Re: [PHP-DB] PDO user question

2012-09-09 Thread Michael Stowe
How are you using the number?  Probably the easiest way is to utilize 
PDOStatement::FetchAll() and then do a count() on that result set. 

- Mike



Sent from my iPhone

On Sep 9, 2012, at 11:42 AM, Stefan Wixfort  wrote:

> Hi Jim
> 
>> I've had some success with querying using pdo and prepared statements as
>> well.  One thing that I'm curious about is
>> 
>> How does one handle the need to get the number of rows returned by a
>> Select?  The documentation is very clear that PDO doesn't return that
>> value for a Select statement (depending upon driver?) and there were a
>> couple of solutions that made no sense to me.  There was even one that
>> did a completely separate query just to get the row count which makes
>> even less sense.
> 
> I believe you are referring to "SELECT COUNT(*)..."
> Because I couldn't find a different way I use that.
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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



Re: [PHP-DB] Help with If else if

2012-03-13 Thread Michael Stowe
Hmm, what happens with the code I sent you?  Just tested it on my end and
worked exactly as expected.

Try doing a
var_dump($search->plugin->ListViewValue(), $search->facebook->ListViewValue());
to make sure the data being returned is what's expected... you should be
getting string(0) "" returned for both.

Thanks,
Mike



On Tue, Mar 13, 2012 at 10:53 AM, Gu®u  wrote:

> No Michael, your code is also not working. What you have understood is
> correct. let me explain it to others too.
>
> If variable twitter and facebook are empty don't echo anything,
>
> if variable twitter has a value and facebook is empty echo out only
> twitter,
>
> if variable twitter has no value and facebook has a value echo out
> facebook only,
>
> and finally if both has values echo out both.
>
> Basically I want to echo out only if there is some value in the database.
> But in my case both the images are echoing out.
>
>
>
>
> On Tue, Mar 13, 2012 at 8:54 PM, Michael Stowe  wrote:
>
>> From looking at your code, the issue is that your if statements are
>> checking for the same criteria as your else statements, meaning that if the
>> string is empty ("") the if statements will be triggered, and since the if
>> statements are true, the elseif statement will not be.  Or if the string
>> isn't empty, neither the if or the elseif statements will be triggered,
>> causing the else statement to be activated.  Either way, the images would
>> be printed out. *
>> *
>> *
>> *
>> *Did you mean to do this?*
>>
>> > if($search->plugin->ListViewValue() == "" &&
>> $search->facebook->ListViewValue() == "") {
>> // Neither one has a value
>> } elseif ($search->plugin->ListViewValue() != "" &&
>> $search->facebook->ListViewValue() != "") {
>> // Both have a Value
>> echo '> src="images/twitter.gif" width="22" height="23"/>' . '> href="' . $search->facebook->ListViewValue() . '">> src="images/facebook.gif" width="22" height="23"/>';
>> } elseif ($search->plugin->ListViewValue() != "") {
>> // Twitter has a value
>> echo '>  src="images/twitter.gif" width="22" height="23"/>';
>> } else {
>> // Facebook has a value (only possible option left)
>> echo '>  src="images/facebook.gif" width="22" height="23"/>';
>> }
>> ?>
>>
>>
>>
>> Hope that helps,
>> Mike
>>
>>
>>
>> On Tue, Mar 13, 2012 at 9:44 AM, Matijn Woudt  wrote:
>>
>>> On Tue, Mar 13, 2012 at 3:06 PM, Gu®u  wrote:
>>> > The issue is both the images are echoing and no if else statement is
>>> > working.
>>> >
>>>
>>> First of all, please bottom post on this (and probably any) mailing list.
>>>
>>> You should perhaps provide what the contents of
>>> $search->plugin->ListViewValue()=="" and
>>> $search->facebook->ListViewValue()=="" is.
>>> Though, if I understood you correctly, it would be as simple as:
>>> $facebookEnabled = $search->facebook->ListViewValue()!="";
>>> $twitterEnabled = $search->plugin->ListViewValue()!="";
>>> if($facebookEnabled)
>>>  {
>>>
>>>  echo '>> src="images/facebook.gif" width="22" height="23"/>';
>>> }
>>>  if($twitterEnabled)
>>>  {
>>>
>>> echo '>> src="images/twitter.gif" width="22" height="23"/>';
>>> }
>>>
>>> - Matijn
>>>
>>> --
>>> PHP Database Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>
>>
>> --
>> ---
>>
>> "My command is this: Love each other as I
>> have loved you." John 15:12
>>
>> ---
>>
>
>
>
> --
> *Best,
> *
> *Gu®u*
>
>


-- 
---

"My command is this: Love each other as I
have loved you." John 15:12

---


Re: [PHP-DB] Help with If else if

2012-03-13 Thread Michael Stowe
>From looking at your code, the issue is that your if statements are
checking for the same criteria as your else statements, meaning that if the
string is empty ("") the if statements will be triggered, and since the if
statements are true, the elseif statement will not be.  Or if the string
isn't empty, neither the if or the elseif statements will be triggered,
causing the else statement to be activated.  Either way, the images would
be printed out. *
*
*
*
*Did you mean to do this?*

plugin->ListViewValue() == "" &&
$search->facebook->ListViewValue() == "") {
// Neither one has a value
} elseif ($search->plugin->ListViewValue() != "" &&
$search->facebook->ListViewValue() != "") {
// Both have a Value
echo '' . '';
} elseif ($search->plugin->ListViewValue() != "") {
// Twitter has a value
echo '';
} else {
// Facebook has a value (only possible option left)
echo '';
}
?>



Hope that helps,
Mike



On Tue, Mar 13, 2012 at 9:44 AM, Matijn Woudt  wrote:

> On Tue, Mar 13, 2012 at 3:06 PM, Gu®u  wrote:
> > The issue is both the images are echoing and no if else statement is
> > working.
> >
>
> First of all, please bottom post on this (and probably any) mailing list.
>
> You should perhaps provide what the contents of
> $search->plugin->ListViewValue()=="" and
> $search->facebook->ListViewValue()=="" is.
> Though, if I understood you correctly, it would be as simple as:
> $facebookEnabled = $search->facebook->ListViewValue()!="";
> $twitterEnabled = $search->plugin->ListViewValue()!="";
> if($facebookEnabled)
>  {
>
>  echo ' src="images/facebook.gif" width="22" height="23"/>';
> }
>  if($twitterEnabled)
>  {
>
> echo ' src="images/twitter.gif" width="22" height="23"/>';
> }
>
> - Matijn
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
---

"My command is this: Love each other as I
have loved you." John 15:12

---