[PHP-DB] Re: Newbie Question $2

2014-06-17 Thread Jim Giner
We're all so eager to help out poor Ethan (who many of you know is NOT a 
newbie) but nowhere does Ethan say what difficulty he is having.


The suggestions made so far are great but what are we solving?

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



[PHP-DB] Re: Newbie Question $2

2014-06-17 Thread Jim Giner

Finally figured out what the question was!

Here's a better version of your code Ethan:

$phn = $_POST['phone']; // note the quotes on the index
if (strlen($phn)  10)
{
echo Error in phone number entry - must be 10 digits;
exit();
}
$phn = mysqli_real_escape_string($cxn,$phn);
$masked_phone = substr($phn,0,3) . -.substr($phn,3,3). -. 
substr($phn,6,4);
$sql1 = select Lname, Fname from Customers where Phone = 
'$masked_phone';	// note use of diff quotes

$result1 = mysqli_query($cxn, $sql1);
if (mysqli_num_rows($result1) == 0)
{
echo Phone number $masked_phone not on file;
exit();
}
else
{
	echo Found {$result1['Fname']} {$result1['Lname']} is on file with 
number $masked_phone;

exit();
}


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



Re: [PHP-DB] Re: Newbie Question $2

2014-06-17 Thread Lester Caine
On 17/06/14 15:04, Jim Giner wrote:
 We're all so eager to help out poor Ethan (who many of you know is NOT a
 newbie) but nowhere does Ethan say what difficulty he is having.
 
 The suggestions made so far are great but what are we solving?
I see you have spotted the original question :)
The original post was fairly complete in what it was asking, and the
answers reasonably worded ...

-- 
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

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



Re: [PHP-DB] Re: Newbie Question $2

2014-06-17 Thread Jim Giner

On 6/17/2014 10:51 AM, Lester Caine wrote:

On 17/06/14 15:04, Jim Giner wrote:

We're all so eager to help out poor Ethan (who many of you know is NOT a
newbie) but nowhere does Ethan say what difficulty he is having.

The suggestions made so far are great but what are we solving?

I see you have spotted the original question :)
The original post was fairly complete in what it was asking, and the
answers reasonably worded ...

Yeah - I just didn't take Ethan's comment as 'his question' since a) it 
didn't even have a ? mark on it and b) his spelling of his phn vars was 
crisscrossed re: the usage in the query statement.  I knew people were 
seeing something I wasn't - just didn't realize that the question itself 
was a puzzle of sorts.


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



Re: [PHP-DB] Re: Newbie Question $2

2014-06-17 Thread Aziz Saleh
IMO a newbie is someone who read the docs and understood them (at least in
theory) before they attempt to write code, which doesn't seem to be the
case.


On Tue, Jun 17, 2014 at 10:04 AM, Jim Giner jim.gi...@albanyhandball.com
wrote:

 We're all so eager to help out poor Ethan (who many of you know is NOT a
 newbie) but nowhere does Ethan say what difficulty he is having.

 The suggestions made so far are great but what are we solving?


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