woocha Posted December 21, 2007 Share Posted December 21, 2007 Hey Guys....I can seem to find anything wrong with this code, can someone tell me what I am missing please? <? require('db_connect.php'); $query = "select * from merchant where merchant = $merchadmin"; $result = "mysql_query( $query)"; if ($result){ while ($r = mysql_fetch_array($result)) { $siteid = $r['site_id']; $email = $r['email']; } $wang = $r['site_id']; echo "$wang"; echo "<br />"; echo "$merchantdir"; echo "<br />"; echo "$merchadmin"; echo "<br />"; echo date("F, d, Y @ g:iA"); echo "<br />"; //echo "$r['id']"; echo "<br />"; echo "$id"; echo "<br />"; echo "$siteid"; echo "<br />"; echo "$merch"; echo "<br />"; echo "$email"; echo "<br />"; echo "$item_numb"; } else{ echo "its busted yo"; } ?> Thank You Quote Link to comment Share on other sites More sharing options...
peranha Posted December 21, 2007 Share Posted December 21, 2007 where are you setting $merchadmin at ? Quote Link to comment Share on other sites More sharing options...
teng84 Posted December 21, 2007 Share Posted December 21, 2007 $result = "mysql_query( $query)"; should be $result= mysql_query( $query); Quote Link to comment Share on other sites More sharing options...
woocha Posted December 21, 2007 Author Share Posted December 21, 2007 its a global...that's why I have the echo statement at the bottom echo "$merchadmin"; I also was thinking about that and echoed to the screen to make sure it was global Quote Link to comment Share on other sites More sharing options...
woocha Posted December 21, 2007 Author Share Posted December 21, 2007 $result = "mysql_query( $query)"; should be $result= mysql_query( $query); I removing the quotes and now I am getting my home brew error message "its busted yo" Quote Link to comment Share on other sites More sharing options...
teng84 Posted December 21, 2007 Share Posted December 21, 2007 post here the error? Quote Link to comment Share on other sites More sharing options...
woocha Posted December 21, 2007 Author Share Posted December 21, 2007 No...I'm just not getting a $result, so the else statment executes and echos to this line runs else{ echo "its busted yo"; } Quote Link to comment Share on other sites More sharing options...
woocha Posted December 21, 2007 Author Share Posted December 21, 2007 Is there a way to check to connection of my file DB_connect.php? Some sort of if no connection give a certain error or something? Quote Link to comment Share on other sites More sharing options...
teng84 Posted December 21, 2007 Share Posted December 21, 2007 <? require('db_connect.php'); // also add a die on you connection $query = "select * from merchant where merchant = $merchadmin"; $result = mysql_query($query) or die(mysql_query()); if ($result){ while ($r = mysql_fetch_array($result)) { $siteid = $r['site_id']; $email = $r['email']; } $wang = $r['site_id']; echo "$wang"; echo "<br />"; echo "$merchantdir"; echo "<br />"; echo "$merchadmin"; echo "<br />"; echo date("F, d, Y @ g:iA"); echo "<br />"; //echo "$r['id']"; echo "<br />"; echo "$id"; echo "<br />"; echo "$siteid"; echo "<br />"; echo "$merch"; echo "<br />"; echo "$email"; echo "<br />"; echo "$item_numb"; } else{ echo "its busted yo"; } ?> Quote Link to comment Share on other sites More sharing options...
woocha Posted December 21, 2007 Author Share Posted December 21, 2007 ok...Thank you...It must be the connection to my db, cause I ran the srcipt and got a blank white screen.. Quote Link to comment Share on other sites More sharing options...
peranha Posted December 21, 2007 Share Posted December 21, 2007 What is in your db_connect.php page Quote Link to comment Share on other sites More sharing options...
teng84 Posted December 21, 2007 Share Posted December 21, 2007 i believe you have your error reporting of because if you cant connect to db you should get some warning!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.