Click here to Skip to main content
15,888,461 members
Home / Discussions / Linux, Apache, MySQL, PHP
   

Linux, Apache, MySQL, PHP

 
AnswerRe: PHP Pin
DeepthiTanguturi22-Jan-12 22:17
DeepthiTanguturi22-Jan-12 22:17 
QuestionWindows CE not running PHP Pin
MJsopo3-Jan-12 3:05
MJsopo3-Jan-12 3:05 
AnswerRe: Windows CE not running PHP Pin
Kevin Schaefer3-Jan-12 12:05
Kevin Schaefer3-Jan-12 12:05 
GeneralRe: Windows CE not running PHP Pin
MJsopo4-Jan-12 3:35
MJsopo4-Jan-12 3:35 
QuestionMy php and Msql problems Pin
hathyan2-Jan-12 13:43
hathyan2-Jan-12 13:43 
AnswerRe: My php and Msql problems Pin
Kevin Schaefer3-Jan-12 12:08
Kevin Schaefer3-Jan-12 12:08 
AnswerRe: My php and Msql problems Pin
hathyan3-Jan-12 13:52
hathyan3-Jan-12 13:52 
AnswerRe: My php and Msql problems Pin
cjoki4-Jan-12 5:57
cjoki4-Jan-12 5:57 
I debug sql queries by these methods...


1)
echo the sql to a browser so I can test in the Mysql Query Browser to make sure that all variables are set as expected and the query is good. I also include page, line # and the mysql error message in the die command. So if any query is bad you will know where and what and why (<--most of the time).

example:
$sql = "select uid from users where uname='".$user_name."'";
$rst = mysql_query($sql) or die("<br>PG: ".__FILE__."<br>LN: ".__LINE__."<br>ER: ".mysql_error()."<br>Q: ".$sql."<br>");


Note: I usually do this as a function call inside the die so I can set a value for local debug and a live production messages. This is because the above information should be used for the developer and not something a user should ever see. Users should have a simple error message if you can not recover from the error in code.

2)
if your code crashes out after the mysql_query, then find out what you query is returning...exactly.

example:
<?php
.. other code above
echo "<pre>";
while($row=mysql_fetch_assoc($rst))
{
   print_r($row);
}
echo "</pre>";
?>


That should give you more info.

Also keep in mind that if you develope on windows and move to linux you will see some error with the case of table and column names make sure you check that. Windows can be lax on case, while linux is not.
Chris J
www.redash.org

Questionwondering why about the site..jump..other site.. Pin
hack0042-Jan-12 2:19
hack0042-Jan-12 2:19 
AnswerRe: wondering why about the site..jump..other site.. Pin
Mohibur Rashid5-Jan-12 20:00
professionalMohibur Rashid5-Jan-12 20:00 
AnswerRe: wondering why about the site..jump..other site.. Pin
cjoki9-Jan-12 9:44
cjoki9-Jan-12 9:44 
QuestionHow do I write a callback function that calls to a function inside the executable? (linux) Pin
coffeenet30-Dec-11 4:54
coffeenet30-Dec-11 4:54 
AnswerRe: How do I write a callback function that calls to a function inside the executable? (linux) Pin
loctrice30-Dec-11 5:03
professionalloctrice30-Dec-11 5:03 
GeneralRe: How do I write a callback function that calls to a function inside the executable? (linux) Pin
coffeenet30-Dec-11 18:25
coffeenet30-Dec-11 18:25 
AnswerRe: How do I write a callback function that calls to a function inside the executable? (linux) Pin
Richard MacCutchan30-Dec-11 6:18
mveRichard MacCutchan30-Dec-11 6:18 
GeneralRe: How do I write a callback function that calls to a function inside the executable? (linux) Pin
coffeenet30-Dec-11 18:26
coffeenet30-Dec-11 18:26 
GeneralRe: How do I write a callback function that calls to a function inside the executable? (linux) Pin
Richard MacCutchan30-Dec-11 22:31
mveRichard MacCutchan30-Dec-11 22:31 
QuestionSELECTING OS Pin
mitul33126-Dec-11 21:05
mitul33126-Dec-11 21:05 
AnswerRe: SELECTING OS Pin
Kevin Schaefer3-Jan-12 12:33
Kevin Schaefer3-Jan-12 12:33 
AnswerRe: SELECTING OS Pin
arjo12913-Jan-12 15:57
arjo12913-Jan-12 15:57 
QuestionIs there a way to make a ssh connection without specifying an username Pin
aiming042026-Dec-11 18:45
aiming042026-Dec-11 18:45 
AnswerRe: Is there a way to make a ssh connection without specifying an username Pin
markkuk27-Dec-11 12:08
markkuk27-Dec-11 12:08 
GeneralRe: Is there a way to make a ssh connection without specifying an username Pin
aiming042027-Dec-11 15:35
aiming042027-Dec-11 15:35 
GeneralRe: Is there a way to make a ssh connection without specifying an username Pin
Richard MacCutchan27-Dec-11 21:50
mveRichard MacCutchan27-Dec-11 21:50 
GeneralRe: Is there a way to make a ssh connection without specifying an username Pin
aiming042028-Dec-11 19:43
aiming042028-Dec-11 19:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.