Re: [PHP-DB] Newbie Question $2
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 - !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; html ?php $bla = 1; ? head /head body div align=center form method=post input type='text' name=phone/input input type='submit' br /br /br / /form /div ?php 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) { ? div align=center strongNo Match Found/strong br /br / /div ?php } ? div align=center table border=4 cellpadding=5 cellspacing=55 rules=all frame=box tr class='heading' thLast Name/th thFirst Name/th ?php while($row1 = mysqli_fetch_row($result1)) { $Lname = $row1[0]; $Fname = $row1[1]; ? tr td ?php echo $Lname; ? /td td ?php echo $Fname; ? /td /tr ?php } ? /table /div /body /html 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Newbie Question $2
Sent from losPhone On Jun 18, 2014, at 7:56 AM, Jim Giner jim.gi...@albanyhandball.com 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 - !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; html ?php $bla = 1; ? head /head body div align=center form method=post input type='text' name=phone/input input type='submit' br /br /br / /form /div ?php 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) { ? div align=center strongNo Match Found/strong br /br / /div ?php } ? div align=center table border=4 cellpadding=5 cellspacing=55 rules=all frame=box tr class='heading' thLast Name/th thFirst Name/th ?php while($row1 = mysqli_fetch_row($result1)) { $Lname = $row1[0]; $Fname = $row1[1]; ? tr td ?php echo $Lname; ? /td td ?php echo $Fname; ? /td /tr ?php } ? /table /div /body /html 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
Re: [PHP-DB] Newbie Question $2
On Wed, Jun 18, 2014 at 2:13 PM, Karl DeSaulniers k...@designdrumm.com wrote: Sent from losPhone On Jun 18, 2014, at 7:56 AM, Jim Giner jim.gi...@albanyhandball.com 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 - !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; html ?php $bla = 1; ? head /head body div align=center form method=post input type='text' name=phone/input input type='submit' br /br /br / /form /div ?php 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) { ? div align=center strongNo Match Found/strong br /br / /div ?php } ? div align=center table border=4 cellpadding=5 cellspacing=55 rules=all frame=box tr class='heading' thLast Name/th thFirst Name/th ?php while($row1 = mysqli_fetch_row($result1)) { $Lname = $row1[0]; $Fname = $row1[1]; ? tr td ?php echo $Lname; ? /td td ?php echo $Fname; ? /td /tr ?php } ? /table /div /body /html 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.
Re: [PHP-DB] Newbie Question $2
On 6/18/2014 2:16 PM, Aziz Saleh wrote: On Wed, Jun 18, 2014 at 2:13 PM, Karl DeSaulniers k...@designdrumm.com wrote: Sent from losPhone On Jun 18, 2014, at 7:56 AM, Jim Giner jim.gi...@albanyhandball.com 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 - !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; html ?php $bla = 1; ? head /head body div align=center form method=post input type='text' name=phone/input input type='submit' br /br /br / /form /div ?php 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) { ? div align=center strongNo Match Found/strong br /br / /div ?php } ? div align=center table border=4 cellpadding=5 cellspacing=55 rules=all frame=box tr class='heading' thLast Name/th thFirst Name/th ?php while($row1 = mysqli_fetch_row($result1)) { $Lname = $row1[0]; $Fname = $row1[1]; ? tr td ?php echo $Lname; ? /td td ?php echo $Fname; ? /td /tr ?php } ? /table /div /body /html 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 the time to respond to him we still do it. Aren't we all amazing? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Newbie Question $2
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 jim.gi...@albanyhandball.com wrote: On 6/18/2014 2:16 PM, Aziz Saleh wrote: On Wed, Jun 18, 2014 at 2:13 PM, Karl DeSaulniers k...@designdrumm.com wrote: Sent from losPhone On Jun 18, 2014, at 7:56 AM, Jim Giner jim.gi...@albanyhandball.com 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 - !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; html ?php $bla = 1; ? head /head body div align=center form method=post input type='text' name=phone/input input type='submit' br /br /br / /form /div ?php 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) { ? div align=center strongNo Match Found/strong br /br / /div ?php } ? div align=center table border=4 cellpadding=5 cellspacing=55 rules=all frame=box tr class='heading' thLast Name/th thFirst Name/th ?php while($row1 = mysqli_fetch_row($result1)) { $Lname = $row1[0]; $Fname = $row1[1]; ? tr td ?php echo $Lname; ? /td td ?php echo $Fname; ? /td /tr ?php } ? /table /div /body /html 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 the time to respond to him we still do it. Aren't we all amazing? -- 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] Newbie Question $2
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
Re: [PHP-DB] Newbie Question $2
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 - !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; html ?php $bla = 1; ? head /head body div align=center form method=post input type='text' name=phone/input input type='submit' br /br /br / /form /div ?php 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) { ? div align=center strongNo Match Found/strong br /br / /div ?php } ? div align=center table border=4 cellpadding=5 cellspacing=55 rules=all frame=box tr class='heading' thLast Name/th thFirst Name/th ?php while($row1 = mysqli_fetch_row($result1)) { $Lname = $row1[0]; $Fname = $row1[1]; ? tr td ?php echo $Lname; ? /td td ?php echo $Fname; ? /td /tr ?php } ? /table /div /body /html 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Newbie Question $2
Dear List - I have the following code: The input from the form is a 10 digit string [1234567890] which is converted to phone number format [123-456-7890] $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]; echo $Phn; // this is folded by Thunderbird. In the script, it is //all on one line mysql_real_escape_string($Phn); $sql1 ='select Lname, Fname from Customers where Phone = $Phn '; echo $sql1; //this always shows $phn as Phn and not as a numerical //string. $result1 = mysqli_query($cxn, $sql1); TIA Ethan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Newbie Question $2
On Jun 16, 2014, at 9:58 PM, Ethan Rosenberg erosenb...@hygeiabiomedical.com wrote: Dear List - I have the following code: The input from the form is a 10 digit string [1234567890] which is converted to phone number format [123-456-7890] $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]; echo $Phn; // this is folded by Thunderbird. In the script, it is //all on one line mysql_real_escape_string($Phn); $sql1 ='select Lname, Fname from Customers where Phone = $Phn '; echo $sql1; //this always shows $phn as Phn and not as a numerical //string. $result1 = mysqli_query($cxn, $sql1); TIA Ethan Well, from first glance you're combining mysql and mysqli. Don't know if that is wise or permissible since I think mysql has been depreciated. Go with mysqli. Next you may want to try... $sql1 = 'SELECT Lname, Fname FROM Customers WHERE Phone = '.$Phn; Best, Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Newbie Question $2
On Mon, Jun 16, 2014 at 10:58 PM, Ethan Rosenberg erosenb...@hygeiabiomedical.com wrote: Dear List - I have the following code: The input from the form is a 10 digit string [1234567890] which is converted to phone number format [123-456-7890] $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]; echo $Phn; // this is folded by Thunderbird. In the script, it is //all on one line mysql_real_escape_string($Phn); $sql1 ='select Lname, Fname from Customers where Phone = $Phn '; echo $sql1; //this always shows $phn as Phn and not as a numerical //string. $result1 = mysqli_query($cxn, $sql1); TIA Ethan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This page should help you: http://www.php.net//manual/en/language.types.string.php understand the difference between single and double quotes.
Re: [PHP-DB] Newbie Question $2
On Jun 16, 2014, at 10:05 PM, Karl DeSaulniers k...@designdrumm.com wrote: On Jun 16, 2014, at 9:58 PM, Ethan Rosenberg erosenb...@hygeiabiomedical.com wrote: Dear List - I have the following code: The input from the form is a 10 digit string [1234567890] which is converted to phone number format [123-456-7890] $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]; echo $Phn; // this is folded by Thunderbird. In the script, it is //all on one line mysql_real_escape_string($Phn); $sql1 ='select Lname, Fname from Customers where Phone = $Phn '; echo $sql1; //this always shows $phn as Phn and not as a numerical //string. $result1 = mysqli_query($cxn, $sql1); TIA Ethan Well, from first glance you're combining mysql and mysqli. Don't know if that is wise or permissible since I think mysql has been depreciated. Go with mysqli. Next you may want to try... $sql1 = 'SELECT Lname, Fname FROM Customers WHERE Phone = '.$Phn; Best, Karl DeSaulniers Design Drumm http://designdrumm.com Also, you may want to store the number in your database without the dash and just apply the dash when displaying the number in HTML. Not that this is entirely necessary, more of a personal choice. If you have a large number of phone numbers stored lets say, numbers with no dash take up less space in the grand scheme of things I guess. Best, Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Newbie Question $2
Oh a few quick things. First, you can use substr to break up the phone instead of grabbing characters- might be a little easier to read long term. Secondly, mysql_real_escape_string will return the cleaned string, but doesn't change the original variable. So you'll need $phn = mysql_real_escape_string($phn); Thirdly anytime you use a single quote the strong is interpreted literally. You'll want to switch out the single quotes with double quotes, and then wrap $phn in single quotes in order to not break your query. Select ... Where phn = '$phn' I'd also really suggest looking at using PDO or even the mysqli extension tho instead of just plain mysql (believe this has been deprecated). Sorry for the quick reply, on mobile. But feel free to email me directly and I'll be happy to help out more. - Mike Sent from my iPhone On Jun 16, 2014, at 7:58 PM, Ethan Rosenberg erosenb...@hygeiabiomedical.com wrote: Dear List - I have the following code: The input from the form is a 10 digit string [1234567890] which is converted to phone number format [123-456-7890] $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]; echo $Phn; // this is folded by Thunderbird. In the script, it is //all on one line mysql_real_escape_string($Phn); $sql1 ='select Lname, Fname from Customers where Phone = $Phn '; echo $sql1; //this always shows $phn as Phn and not as a numerical //string. $result1 = mysqli_query($cxn, $sql1); TIA Ethan -- 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
[PHP-DB] Newbie question on MDB2 error handling
Hello all, I am quite new to php and especially MDB2 package. Despite some thorough research I could not find an answer yet. When I try to connect to a database using MDB2::connect method, and the database server is not running, I only get an error code of -1 and a message saying MDB2 Error: unknown error. Looking at MDB2 source it rather should say connect failed with a code of -24 (MDB2_ERROR_CONNECT_FAILED). Is my expectation wrong, or how can I get some meaningful message and error code in this situation? The code I use is: $dsn = mysqli://mysql:my...@127.0.0.1/MYDB; // This works when mysql server is running $con = MDB2::connect($dsn); if(MDB2::isError($con)) { print_r($con-getCode()); print_r($con-getMessage()); } Any hint is warmly appreciated! Thanks, Pascal. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] newbie question on PHP Mysql...
Hi all! I'm taking my first steps with PHP MySQL. Can anyone give me a hint on why this would not work? * $result = mysql_query('SELECT SUM(AcctInputOctets), SUM(AcctOutputOctets) FROM radacct WHERE username = $argv[1] '); echo mysql_result($result,0), \n; echo mysql_result($result,0,1); * I get: Warning: mysql_result(): supplied argument is not a valid MySQL result resource Regards, Evert -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Newbie Question - mysql_select_db fails with access denied.
Hi Folks, I want to do something like the following: $db = mysql_connect(localhost, myuser) or die(Connect failed : . mysql_error()); mysql_select_db(mydb,$db) or die(SELECT_DB failed : . mysql_error ()); $result = mysql_query(SELECT * FROM mytable, $db) or die(Query failed : . mysql_error()); The script does not proceed beyond the mysql_select_db line. I get this error: SELECT_DB failed: Access denied for user ''@'localhost' to database 'mydb' What happened to the user information. I have granted all neccessary rights to myuser. But it seems that its even not caring about the user. I have MySQL 4.1.4 and PHP 4.3.8-2.1 on a Fedore Core 2 System running. Thanks Regards, Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Newbie Question - mysql_select_db fails with access denied.
This might be a stupid idea, but did you remember to issue the Flush Privelages; command to the mysql database after granting your user all the rights? --John Christian Schlaefcke [EMAIL PROTECTED] wrote: Hi Folks, I want to do something like the following: $db = mysql_connect(localhost, myuser) or die(Connect failed : . mysql_error()); mysql_select_db(mydb,$db) or die(SELECT_DB failed : . mysql_error ()); $result = mysql_query(SELECT * FROM mytable, $db) or die(Query failed : . mysql_error()); The script does not proceed beyond the mysql_select_db line. I get this error: SELECT_DB failed: Access denied for user ''@'localhost' to database 'mydb' What happened to the user information. I have granted all neccessary rights to myuser. But it seems that it´s even not caring about the user. I have MySQL 4.1.4 and PHP 4.3.8-2.1 on a Fedore Core 2 System running. Thanks Regards, Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Do you Yahoo!? Yahoo! Mail - 50x more storage than other providers!
RE: [PHP-DB] Newbie Question - mysql_select_db fails with access denied.
Hi try $db = mysql_connect(localhost, myuser,mypassword) - without it you are not submitting a password Peter -Original Message- From: Christian Schlaefcke [mailto:[EMAIL PROTECTED] Sent: 24 September 2004 13:31 To: [EMAIL PROTECTED] Subject: [PHP-DB] Newbie Question - mysql_select_db fails with access denied. Hi Folks, I want to do something like the following: $db = mysql_connect(localhost, myuser) or die(Connect failed : . mysql_error()); mysql_select_db(mydb,$db) or die(SELECT_DB failed : . mysql_error ()); $result = mysql_query(SELECT * FROM mytable, $db) or die(Query failed : . mysql_error()); The script does not proceed beyond the mysql_select_db line. I get this error: SELECT_DB failed: Access denied for user ''@'localhost' to database 'mydb' What happened to the user information. I have granted all neccessary rights to myuser. But it seems that its even not caring about the user. I have MySQL 4.1.4 and PHP 4.3.8-2.1 on a Fedore Core 2 System running. Thanks Regards, Chris -- 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] Newbie Question - mysql_select_db fails with access denied.
I have chosen an empty password. I know that this is a security problem. Im using it for testing at the moment only. I use it because there also seems to be an issue with php connecting to mysql servers with verions 4.1. When trying to connect with password I get this: Connect failed : Client does not support authentication protocol requested by server; consider upgrading MySQL client. Because I want to track down issue after issue and not anything at once I decided to find out why mysql_select_db fails first. What really makes me wonder in my tiny example is that the error message does not say something like: SELECT_DB failed: Access denied for user 'myuser'@'localhost' to database 'mydb' instead it says: SELECT_DB failed: Access denied for user ''@'localhost' to database 'mydb' So I think that the username is not interpreted at all. Why not? Regards, Chris Am Fr, den 24.09.2004 um 13:43 Uhr +0100 schrieb Peter Lovatt: Hi try $db = mysql_connect(localhost, myuser,mypassword) - without it you are not submitting a password Peter -Original Message- From: Christian Schlaefcke [mailto:[EMAIL PROTECTED] Sent: 24 September 2004 13:31 To: [EMAIL PROTECTED] Subject: [PHP-DB] Newbie Question - mysql_select_db fails with access denied. Hi Folks, I want to do something like the following: $db = mysql_connect(localhost, myuser) or die(Connect failed : . mysql_error()); mysql_select_db(mydb,$db) or die(SELECT_DB failed : . mysql_error ()); $result = mysql_query(SELECT * FROM mytable, $db) or die(Query failed : . mysql_error()); The script does not proceed beyond the mysql_select_db line. I get this error: SELECT_DB failed: Access denied for user ''@'localhost' to database 'mydb' What happened to the user information. I have granted all neccessary rights to myuser. But it seems that its even not caring about the user. I have MySQL 4.1.4 and PHP 4.3.8-2.1 on a Fedore Core 2 System running. Thanks Regards, Chris -- 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] Newbie Question - mysql_select_db fails with access denied.
You're right: if you use mysql_connect(localhost, root,); you''ll get acces denied for user [EMAIL PROTECTED] if you use mysql_connect(localhost); you'll get Access denied for user @localhost I'll google for a while... but.. to solve YOUR problem, just use: mysql_connect(localhost,user,); Good luck! On Fri, 24 Sep 2004 14:56:35 +0200, Christian Schlaefcke [EMAIL PROTECTED] wrote: I have chosen an empty password. I know that this is a security problem. I´m using it for testing at the moment only. I use it because there also seems to be an issue with php connecting to mysql servers with verions 4.1. When trying to connect with password I get this: Connect failed : Client does not support authentication protocol requested by server; consider upgrading MySQL client. Because I want to track down issue after issue and not anything at once I decided to find out why mysql_select_db fails first. What really makes me wonder in my tiny example is that the error message does not say something like: SELECT_DB failed: Access denied for user 'myuser'@'localhost' to database 'mydb' instead it says: SELECT_DB failed: Access denied for user ''@'localhost' to database 'mydb' So I think that the username is not interpreted at all. Why not? Regards, Chris Am Fr, den 24.09.2004 um 13:43 Uhr +0100 schrieb Peter Lovatt: Hi try $db = mysql_connect(localhost, myuser,mypassword) - without it you are not submitting a password Peter -Original Message- From: Christian Schlaefcke [mailto:[EMAIL PROTECTED] Sent: 24 September 2004 13:31 To: [EMAIL PROTECTED] Subject: [PHP-DB] Newbie Question - mysql_select_db fails with access denied. Hi Folks, I want to do something like the following: $db = mysql_connect(localhost, myuser) or die(Connect failed : . mysql_error()); mysql_select_db(mydb,$db) or die(SELECT_DB failed : . mysql_error ()); $result = mysql_query(SELECT * FROM mytable, $db) or die(Query failed : . mysql_error()); The script does not proceed beyond the mysql_select_db line. I get this error: SELECT_DB failed: Access denied for user ''@'localhost' to database 'mydb' What happened to the user information. I have granted all neccessary rights to myuser. But it seems that it´s even not caring about the user. I have MySQL 4.1.4 and PHP 4.3.8-2.1 on a Fedore Core 2 System running. Thanks Regards, Chris -- 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 -- Pablo M. Rivas. http://pmrivas.ipupdater.com http://www.r3soft.com.ar --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Newbie Question - mysql_select_db fails with access denied.
When I switch back to user root with empty password and use mysql_connect(localhost, root) it works. I just found out when I set the permission for myuser to localhost instead of any it works also for myuser. Now I have to check out why I cant use passwords. Maybe the PHP Version Im running is not ready to work with MySQL 4.1.4? Any Ideas? Regards, Chris Am Fr, den 24.09.2004 um 12:04 Uhr -0300 schrieb Pablo M. Rivas: You're right: if you use mysql_connect(localhost, root,); you''ll get acces denied for user [EMAIL PROTECTED] if you use mysql_connect(localhost); you'll get Access denied for user @localhost I'll google for a while... but.. to solve YOUR problem, just use: mysql_connect(localhost,user,); Good luck! On Fri, 24 Sep 2004 14:56:35 +0200, Christian Schlaefcke [EMAIL PROTECTED] wrote: I have chosen an empty password. I know that this is a security problem. Im using it for testing at the moment only. I use it because there also seems to be an issue with php connecting to mysql servers with verions 4.1. When trying to connect with password I get this: Connect failed : Client does not support authentication protocol requested by server; consider upgrading MySQL client. Because I want to track down issue after issue and not anything at once I decided to find out why mysql_select_db fails first. What really makes me wonder in my tiny example is that the error message does not say something like: SELECT_DB failed: Access denied for user 'myuser'@'localhost' to database 'mydb' instead it says: SELECT_DB failed: Access denied for user ''@'localhost' to database 'mydb' So I think that the username is not interpreted at all. Why not? Regards, Chris Am Fr, den 24.09.2004 um 13:43 Uhr +0100 schrieb Peter Lovatt: Hi try $db = mysql_connect(localhost, myuser,mypassword) - without it you are not submitting a password Peter -Original Message- From: Christian Schlaefcke [mailto:[EMAIL PROTECTED] Sent: 24 September 2004 13:31 To: [EMAIL PROTECTED] Subject: [PHP-DB] Newbie Question - mysql_select_db fails with access denied. Hi Folks, I want to do something like the following: $db = mysql_connect(localhost, myuser) or die(Connect failed : . mysql_error()); mysql_select_db(mydb,$db) or die(SELECT_DB failed : . mysql_error ()); $result = mysql_query(SELECT * FROM mytable, $db) or die(Query failed : . mysql_error()); The script does not proceed beyond the mysql_select_db line. I get this error: SELECT_DB failed: Access denied for user ''@'localhost' to database 'mydb' What happened to the user information. I have granted all neccessary rights to myuser. But it seems that its even not caring about the user. I have MySQL 4.1.4 and PHP 4.3.8-2.1 on a Fedore Core 2 System running. Thanks Regards, Chris -- 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 -- Pablo M. Rivas. http://pmrivas.ipupdater.com http://www.r3soft.com.ar --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Newbie question
Hi! I'm new to PHP, so this may be an easy question. I tried to make a simple form-page, where the user enters his name, and on the following page it says Hello $name. What happens is that on the second page it says soemthing like unknown identifier $name. I'm using Apache 2 so that may be causing the problem, cause this is a clear textbook example: -- first.php -- html head titleFirst/title /head body bgcolor=#ff text=#00 link=#cbda74 vlink=#808040 alink=#808040 form action=second.php method=post bWhats your name?/b input type=text name=name size=20 maxlength=20 value=br input type=submit value=go! /form /body --- second.php html head titleSecond/title /head body bgcolor=#ff text=#00 link=#cbda74 vlink=#808040 alink=#808040 ? print Hello $name!; ? /body /html -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Newbie question
Try: ? print Hello .$_POST[name]; ? -Original Message- From: Gajo Csaba [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 24, 2004 4:10 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Newbie question Hi! I'm new to PHP, so this may be an easy question. I tried to make a simple form-page, where the user enters his name, and on the following page it says Hello $name. What happens is that on the second page it says soemthing like unknown identifier $name. I'm using Apache 2 so that may be causing the problem, cause this is a clear textbook example: -- first.php -- html head titleFirst/title /head body bgcolor=#ff text=#00 link=#cbda74 vlink=#808040 alink=#808040 form action=second.php method=post bWhats your name?/b input type=text name=name size=20 maxlength=20 value=br input type=submit value=go! /form /body --- second.php html head titleSecond/title /head body bgcolor=#ff text=#00 link=#cbda74 vlink=#808040 alink=#808040 ? print Hello $name!; ? /body /html -- 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
[PHP-DB] newbie question
hi, i am relatively new to php and new to this email list. i have what i think are fairly simple questions about using mysql and php. i have done some research and can't seem to find the answer i need. # 1. i want to set the date format to display dates in a format other than the standard mysql -mm-dd format. i have tried using the mysql DATE_FORMAT but i can's seem to get it to work... ideally i'd like to display dates as 2 digit date followed by three letter month abbreviation and leave the year off completely... example: 13 feb # 2. i want to hide entries that are newer than the current date AND hide entries older than 365 days. i apologize if this is the wrong place to ask these questions. if someone could point me in the right direction i would appreciate it. here is the url and code (minus the login info) http://www.broadcastatic.com ?php $db = mysql_connect(localhost, [loginnamehere], [passwdhere]); mysql_select_db([databasenamehere],$db); // display individual record if ($date) { $result = mysql_query(SELECT * FROM [tablenamehere] WHERE date= '$date' ,$db); $myrow = mysql_fetch_array($result); // do not use now printf(img src=\../images/icons/%s.gif\br\n, $myrow[date]); printf(hosted by %sbr\n, $myrow[dj]); printf(broadcast on %sbr\n, $myrow[date]); printf(%s\nbrbrbr, $myrow[location]); printf(-- %s\nbrbr, $myrow[entry]); printf(a href=\archive/mp3/$date.mp3\mp3 link/a\nbrbr, $myrow[date]); include(archive/index/$date.php); } else { // display list of shows by date $result = mysql_query(SELECT * FROM [tablenamehere] WHERE 1 ORDER BY 'date' DESC,$db); if ($myrow = mysql_fetch_array($result)) { // display list if there are records to display do { printf(div id=\col1\a href=\%s?date=%s\%s/a /div div id=\col2\img src=\archive/images/icon/%s.gif\ /div div id=\col3\b%s/bbr%s/divbr\n, $PHP_SELF, $myrow[date], $myrow[date], $myrow[date], $myrow[dj], $myrow[entry]); } while ($myrow = mysql_fetch_array($result)); } else { // no records to display echo Sorry, no records were found!; } } ? THANKS! tommy birchett http://www.broadcastatic.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] newbie question
On Fri, 13 Feb 2004, t wrote: hi, i am relatively new to php and new to this email list. i have what i think are fairly simple questions about using mysql and php. i have done some research and can't seem to find the answer i need. # 1. i want to set the date format to display dates in a format other than the standard mysql -mm-dd format. i have tried using the mysql DATE_FORMAT but i can's seem to get it to work... ideally i'd like to display dates as 2 digit date followed by three letter month abbreviation and leave the year off completely... example: 13 feb Use date() Documentation: http://php.net/date # 2. i want to hide entries that are newer than the current date AND hide entries older than 365 days. Limit your SQL to ... where datenow() and datedate_sub(now(), interval 365 day) ... if date is in datetime format If in unixtime format, convert to unixtime for those functions ... where dateunix_timestamp() and date(unix_timestamp()-(365*86400)) ... Documentation: http://mysql.com/date_sub (should redirect to http://www.mysql.com/doc/en/Date_and_time_functions.html) --- Peter Beckman Internet Guy [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] newbie question on data accumulation
Hi all: Curious as to what happens after data is repeatedly selected from a mysql table overtime. Does it accumulate as junk data, stored at some location and eventually slow down the database/program/server? Does any purging have to take place? Thanks J __ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Newbie Question - PHP and MSACCESS
//Place your request into a variable: $result = odbc_do($connection,select * from events where id=$id); $var = odbc_fetch_row($result); // Now you have an array to work on foreach($var as $line){ //Do your formatting thusly: echo ' trtd' . $line[0] . '?td td' . $line[1] . '/td ... /tr } Hi, Am using php to open a customer's msaccess file. First time for everything. It's a very small database of less then 25 rows, and will always be this small. Am needing to return all the rows to a web page using php at all times. Very simplistic. Am apparently set up correctly on the DSN, and am able to do an odbc_connect: $connection = odbc_connect(meetings,,); Am able to fetch rows, or so it seems: $result = odbc_do($connection,select * from events where id=$id); odbc_fetch_row($result); Am not understanding how to print() the fields in the rows, one after the next, on the same line, and then do the same with the next record, until all records have been presented. Sorry to be lame. Any help would be gratefully received. -Joe
[PHP-DB] Newbie Question - PHP and MSACCESS
Hi, Am using php to open a customer's msaccess file. First time for everything. It's a very small database of less then 25 rows, and will always be this small. Am needing to return all the rows to a web page using php at all times. Very simplistic. Am apparently set up correctly on the DSN, and am able to do an odbc_connect: $connection = odbc_connect(meetings,,); Am able to fetch rows, or so it seems: $result = odbc_do($connection,select * from events where id=$id); odbc_fetch_row($result); Am not understanding how to print() the fields in the rows, one after the next, on the same line, and then do the same with the next record, until all records have been presented. Sorry to be lame. Any help would be gratefully received. -Joe
RE: [PHP-DB] Newbie Question - PHP and MSACCESS
$cnx = odbc_connect( 'DSN' , 'USER', 'PASS' ); if (!$cnx) { ?Could not connect to ODBC? } $cur= odbc_exec( $cnx, SELECT Vehicle.Vehicle_ID, Vehicle.Cust_ID FROM Vehicle ); if (!$cur) { Error_handler( Error in odbc_exec( no cursor returned ) , $cnx ); } // fetch the succesive result rows while( odbc_fetch_row( $cur ) ) { $nbrow++; // Assign results names $Cust_Id= odbc_result($cur,2); $Vehicle_ID= odbc_result($cur,1); #code Here } -Original Message- From: J.M. Cocchini [mailto:[EMAIL PROTECTED]] Sent: Sunday, February 16, 2003 4:01 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Newbie Question - PHP and MSACCESS Hi, Am using php to open a customer's msaccess file. First time for everything. It's a very small database of less then 25 rows, and will always be this small. Am needing to return all the rows to a web page using php at all times. Very simplistic. Am apparently set up correctly on the DSN, and am able to do an odbc_connect: $connection = odbc_connect(meetings,,); Am able to fetch rows, or so it seems: $result = odbc_do($connection,select * from events where id=$id); odbc_fetch_row($result); Am not understanding how to print() the fields in the rows, one after the next, on the same line, and then do the same with the next record, until all records have been presented. Sorry to be lame. Any help would be gratefully received. -Joe -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Newbie-Question: What's that @?
hi there, i've got a general question about php-scripts: whats the difference between @mysql_query($query) and @mysql_query($query)? is it the same as in batch programming? like, ignore all return messages? thanks and greetings from germany, marcus -- ^v^ [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Newbie-Question: What's that @?
Well the only difference I see is the ? ... hehe... but if you are refering to the @ symbol then you are correct ... ignore errors... :-) Ryan -Original Message- From: Marcus Fleige [mailto:marcus.fleige;gmx.de] Sent: Wednesday, October 30, 2002 5:05 PM To: PHP-Mailinglist Subject: [PHP-DB] Newbie-Question: What's that @? hi there, i've got a general question about php-scripts: whats the difference between @mysql_query($query) and @mysql_query($query)? is it the same as in batch programming? like, ignore all return messages? thanks and greetings from germany, marcus -- ^v^ [EMAIL PROTECTED] -- 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] Newbie-Question: What's that @?
It suppresses error messages and warnings when you call a function, regardless of your level of error reporting. So yeah, it is like batch programming :) -- Josh -Original Message- From: Marcus Fleige [mailto:marcus.fleige;gmx.de] Sent: Wednesday, October 30, 2002 7:05 PM To: PHP-Mailinglist Subject: [PHP-DB] Newbie-Question: What's that @? hi there, i've got a general question about php-scripts: whats the difference between @mysql_query($query) and @mysql_query($query)? is it the same as in batch programming? like, ignore all return messages? thanks and greetings from germany, marcus -- ^v^ [EMAIL PROTECTED] -- 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] Newbie-Question: What's that @?
great! @ryan josh: thank you for the quick answers! :-) marcus -- ^v^ [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] ***Newbie Question***
I have an issue I need to see if I can resolve. I am and admin of a company website that uses MySql for the database, They are going to change the server to MSSql is there and easy way to convert on the existing Info over from MySql to MSSql any help would greatly be appreciated . TIA -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] newbie question: fetchrow or smth else ?
Could some one please check the following code and guesstimate where am I wrong ? (the only thing I got from browser is: Fatal error: Call to undefined function: fetchrow() pc_list.php on line 14, but on that line I have fetchRow() not fetchrow(). To make it worse even when I am replacing fetchRow() with FetchRow the same error is reported) PS. I used PEAR that comes with php-4.1.1 and php-4.0.4pl1. nothing changed :( --- require_once DB.php ; $db = DB::connect($db_type://$db_user:$db_pass@$db_host/$db_name, $db_pipe) ; $req = SELECT pc.hostname, m.logo, pc.mac, pc.ip FROM computer pc, mac m WHERE m.id = LEFT(pc.mac) ; $p_req = $db-prepare($req) ; $res = $db-execute($p_req) ; echo table border=1 \n ; echo tr th Hostname /th th Logo /th th MAC /th th IP /th /tr\n ; $counter = 0 ; while ( $arr=$res-fetchRow() ) { echo tr td $arr[0] /td td img src=\logos/$arr[1]\ /td ; echo td $arr[2] /td td $arr[3] /td /tr \n ; $counter++ ; } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] newbie question: request response
Does PHP have built-in support for using request and response objects? Thanks, -L -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Newbie question - other way than insert statement?
ok, thnx No, but SQL is your friend *lol* greez daniel -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Newbie question - other way than insert statement?
Hi I came from ASP and I'm sort of a newbie. I'm sure you'll see that after my question :-) I'm looking for a way to insert data in an mysql db but not with an insert into statement. Is there any way i can do some sort of: mydb.myfieldname = $myvalue ?? (same as in asp with recordsets: rs!fieldname = value) any way to do that in a similar manner? thanks for your help daniel -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Newbie question - other way than insert statement?
No, but SQL is your friend, and is actually easier than messing around with recordsets, once you get the hang of it. The exact form of your INSERT statement will depend a bit on the database are you using, but the following is typical. This is MySQL syntax, I believe PostgresSQL is similar. INSERT INTO tablename ( firstname, lastname, phone_number) VALUES ( '$strFirst', '$strLast', '$strPhoneNo' ) and if you are truly confident and believe your table structure will NEVER change, you could shorten it to INSERT tablename VALUES ( '$strFirst', '$strLast', '$strPhoneNo' ) Sometimes you just UPDATE UPDATE tablename SET firstname = '$strFirst', lastname = '$strLast', phone_number = '$strPhoneNo' WHERE primary_key_field = '$UniqueID' If any rows are returned by a SELECT statement determines whether you use an INSERT or an UPDATE, but then you have to do that to determine whether you .AddNew or .Edit. Hope this helps - Miles Thompson PS Of course _nothing_ beats the ease of use and clarity of FoxPro and its descendants. g At 11:00 PM 11/20/2001 +0100, Daniel Schwab wrote: Hi I came from ASP and I'm sort of a newbie. I'm sure you'll see that after my question :-) I'm looking for a way to insert data in an mysql db but not with an insert into statement. Is there any way i can do some sort of: mydb.myfieldname = $myvalue ?? (same as in asp with recordsets: rs!fieldname = value) any way to do that in a similar manner? thanks for your help daniel -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Newbie Question
Ok, I am still fairly new at PHP and MySQL also, so please bear with me. TASK: I have a client that wants to have job openings listed on their site and they want to be able to add, edit and delete the postings themselves. I would do this in flat-file format but there is the risk of that file size getting too large and slowing down the server. SOLUTION: I have created a MySQL database that will hold all the postings in a table called 'jobs' and have created a PHP form that will post this jobs into the db. PROBLEM: When I go to the PHP form and enter all of the pertinent job information, there is one specific field that will have to have carriage returns/line breaks in it between paragraphs. Everything is working except for this. Is there a way whenever the user presses ENTER, that either PHP/MySQL will convert this into a BR tag only when being displayed in a browser and not in the db?? Can anyone out there please help me with this? I am available off-list as well if it will be easier to pass code back and forth. Any assistance is greatly appreciated! Should you have any questions, comments or concerns, feel free to call me at 318-338-2034. Thank you for your time, Jay Fitzgerald, Design Director - CSBW-A, CPW-A, CWD-A, CEMS-A == Bayou Internet..(888) 30-BAYOUhttp://www.bayou.com Mississippi Internet...(800) MISSISSIPPI...http://www.mississippi.net Vicksburg Online..(800) MISSISSIPPIhttp://www.vicksburg.com == Tel: (318) 338-2034ICQ: 38823829 Fax: (318) 323-5053 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Newbie Question
Yes there is: Using a php function called: nl2br() When the data is called from the db and printed to the page use $textdata = nl2br($textdata) This will preserve the enter button being pressed. Regards: Russ On Thu, 08 Nov 2001 09:54:16 -0600 Jay Fitzgerald [EMAIL PROTECTED] wrote: Ok, I am still fairly new at PHP and MySQL also, so please bear with me. TASK: I have a client that wants to have job openings listed on their site and they want to be able to add, edit and delete the postings themselves. I would do this in flat-file format but there is the risk of that file size getting too large and slowing down the server. SOLUTION: I have created a MySQL database that will hold all the postings in a table called 'jobs' and have created a PHP form that will post this jobs into the db. PROBLEM: When I go to the PHP form and enter all of the pertinent job information, there is one specific field that will have to have carriage returns/line breaks in it between paragraphs. Everything is working except for this. Is there a way whenever the user presses ENTER, that either PHP/MySQL will convert this into a BR tag only when being displayed in a browser and not in the db?? Can anyone out there please help me with this? I am available off-list as well if it will be easier to pass code back and forth. Any assistance is greatly appreciated! Should you have any questions, comments or concerns, feel free to call me at 318-338-2034. Thank you for your time, Jay Fitzgerald, Design Director - CSBW-A, CPW-A, CWD-A, CEMS-A == Bayou Internet..(888) 30-BAYOUhttp://www.bayou.com Mississippi Internet...(800) MISSISSIPPI...http://www.mississippi.net Vicksburg Online..(800) MISSISSIPPIhttp://www.vicksburg.com == Tel: (318) 338-2034ICQ: 38823829 Fax: (318) 323-5053 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Newbie Question
Hi Kodrik: I just looked at your function and would like to use it myself, but shouldn't the ampersand line: $copy=eregi_replace (amp;, , $copy); look like this instead? So it matches the other lines that have a symbol replaced by HTML?? $copy=eregi_replace (, amp;, $copy); Cheers. Russ No, because the sign is needed to represent the ascii values. So I'm actually doing it to put it back where it got converted by htmlspecialchars. If you are going to use it for a forum, you might also be interested by hyperlinkor. It converts urls into links, however they are entered (with a www. or not, httpd or not...) http://zc8.com/zc8/ZC8news/shownews.php?articleid=108 You run your string through this function before displaying. and the links are anchored. Do not run it before entering a string in a database, only before echoing the string. My reply to you was bounced back, so I replied to your message on the list instead. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Newbie Question: Convert SELECT to DELETE statement in mysql
Hi! In MySQL-4.0.0 you can delete from several tables in a join: DELETE t1, t2 FROM t1, t2, t3 WHERE ...; But 4.0.0 is still alpha, and it will take some months for it to stabilize. No compact or defrag is normally needed with MySQL. Regards, Heikki http://www.innodb.com Shaun Honsvick wrote in message [EMAIL PROTECTED]... No, I am not trying to delete with a select statement. That was just there to show my tables, fields, etc. So if I understand what you are saying I can not do a delete statement with a join in it. I would have to query each individual row for the ID that need to be deleted, delete the row in the first table, then delete the row in the second table, third table, etc. Then loop for the next intance. Theres got to be a better way. Also, after this is done should I run some sort compact or defrag on the database that restore wasted space? Thanks, Shaun Rick Emery [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... Are you trying to delete records with a SELECT statement? That can't be done. To delete from two different tables, you must use two different DELETE statements. -Original Message- From: Shaun Honsvick [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 16, 2001 3:59 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Newbie Question: Convert SELECT to DELETE statement in mysql I am trying to run a delete on a mysql database. The delete query needs to delete from 2 tables. The select statement is: SELECT tinvoices.*, ttrackingnumbers.* FROM tinvoices LEFT JOIN ttrackingnumbers ON tinvoices.InvoiceID = ttrackingnumbers.InvoiceID WHERE Date '2001-08-01'; I can't seem to get a delete statement to work. (This is my first project) Thanks, Shaun -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Newbie Question: Convert SELECT to DELETE statement in mysql
No need to defrag/compact...MySQL will reuse the space. Since posting my original message, I've learned that version 4.0 (alpha) of MySQL was released on 15 October. In Paragraph 6.4.6 of the MySQL manual, we read: The multi table delete format is supported starting from MySQL 4.0.0. Bottom line: if you don't mind unstable, ever-changing, in-development application for mission-critical applications, you can use vers 4.0. Otherwise, you need to follow the algorithm you've laid out. Or, if your web-host has the option, investigate table of TYPE=INNODB. These tables support FOREIGN keys which may allow multi-table deletion. In version 3.23, your web-host must be running the MYSQLD-MAX binary. In version 4.0, INNODB support is in all binaries. -Original Message- From: Shaun Honsvick [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 18, 2001 6:35 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Newbie Question: Convert SELECT to DELETE statement in mysql No, I am not trying to delete with a select statement. That was just there to show my tables, fields, etc. So if I understand what you are saying I can not do a delete statement with a join in it. I would have to query each individual row for the ID that need to be deleted, delete the row in the first table, then delete the row in the second table, third table, etc. Then loop for the next intance. Theres got to be a better way. Also, after this is done should I run some sort compact or defrag on the database that restore wasted space? Thanks, Shaun Rick Emery [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... Are you trying to delete records with a SELECT statement? That can't be done. To delete from two different tables, you must use two different DELETE statements. -Original Message- From: Shaun Honsvick [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 16, 2001 3:59 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Newbie Question: Convert SELECT to DELETE statement in mysql I am trying to run a delete on a mysql database. The delete query needs to delete from 2 tables. The select statement is: SELECT tinvoices.*, ttrackingnumbers.* FROM tinvoices LEFT JOIN ttrackingnumbers ON tinvoices.InvoiceID = ttrackingnumbers.InvoiceID WHERE Date '2001-08-01'; I can't seem to get a delete statement to work. (This is my first project) Thanks, Shaun -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Newbie Question: Convert SELECT to DELETE statement in mysql
No, I am not trying to delete with a select statement. That was just there to show my tables, fields, etc. So if I understand what you are saying I can not do a delete statement with a join in it. I would have to query each individual row for the ID that need to be deleted, delete the row in the first table, then delete the row in the second table, third table, etc. Then loop for the next intance. Theres got to be a better way. Also, after this is done should I run some sort compact or defrag on the database that restore wasted space? Thanks, Shaun Rick Emery [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... Are you trying to delete records with a SELECT statement? That can't be done. To delete from two different tables, you must use two different DELETE statements. -Original Message- From: Shaun Honsvick [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 16, 2001 3:59 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Newbie Question: Convert SELECT to DELETE statement in mysql I am trying to run a delete on a mysql database. The delete query needs to delete from 2 tables. The select statement is: SELECT tinvoices.*, ttrackingnumbers.* FROM tinvoices LEFT JOIN ttrackingnumbers ON tinvoices.InvoiceID = ttrackingnumbers.InvoiceID WHERE Date '2001-08-01'; I can't seem to get a delete statement to work. (This is my first project) Thanks, Shaun -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Newbie question
I've gone thru everything I can find, and I'm sure I'm just missing it (it's happened before), but... at the end of my script, I run a set of closing and clean-up procedures.. what I would like to be able to do is that when a user bails out of the script by closing the browser or leaving the site/page, detect that they've gone, and then go ahead and run my closing procedures.. is this possible? I'd appreciate a point in the right direction, with or without an RTFM ... :) TIA ~BD~ http://www.bustdustr.net Home of Radio Free Bd -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Newbie question
In article 034101c0d3f3$0dd747e0$41041dd8@winbox, [EMAIL PROTECTED] (~BD~) wrote: at the end of my script, I run a set of closing and clean-up procedures.. what I would like to be able to do is that when a user bails out of the script by closing the browser or leaving the site/page, detect that they've gone, and then go ahead and run my closing procedures.. is this possible? http://php.net/manual/en/features.connection-handling.php http://php.net/register-shutdown-function -- CC -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Newbie question
EXACTLY what I was looking for... Thanks! http://www.bustdustr.net Home of Radio Free Bd - Original Message - From: CC Zona [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, May 03, 2001 1:42 PM Subject: Re: [PHP-DB] Newbie question In article 034101c0d3f3$0dd747e0$41041dd8@winbox, [EMAIL PROTECTED] (~BD~) wrote: at the end of my script, I run a set of closing and clean-up procedures.. what I would like to be able to do is that when a user bails out of the script by closing the browser or leaving the site/page, detect that they've gone, and then go ahead and run my closing procedures.. is this possible? http://php.net/manual/en/features.connection-handling.php http://php.net/register-shutdown-function -- CC -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Newbie Question - Importing a table
I'm new to MySQL and am having trouble importing a table. The table is a text file. Where I think I'm having trouble is on the options. The table has no text delimiter and uses "," as a field separator. Where I think I'm having problems is with the options. What I'm using is [-c, --columns= and then naming all the columns then the name of the database and the table I want it to create. Any help would be appreciated. Thanks, Mike Waters -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] newbie question
Hi Lisa, Can search engines index any HTML pages that have .php as its extension (any .php pages without a '?' or '' in the URL) ? For example: http://www.blablabla.com/blabla.php Thanks, Lisa E yes they can, but my experience is, that most search engine robots do _not_ index pages ending in .php and .php3 due to their dynamic nature (please correct me or give me a hint how to change this). We had to change the extensions to .html to avoid being not indexed by search engines. Hope this helps Victor -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] newbie question
Can search engines index any HTML pages that have .php as its extension (any .php pages without a '?' or '' in the URL) ? For example: http://www.blablabla.com/blabla.php Thanks, Lisa E -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] newbie question
Yes, It will index the page as any html page At 10:58 PM 1/27/01 +0700, Lisa Elita wrote: Can search engines index any HTML pages that have .php as its extension (any .php pages without a '?' or '' in the URL) ? For example: http://www.blablabla.com/blabla.php Thanks, Lisa E -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]