InO Posted July 9, 2007 Share Posted July 9, 2007 let me explain. here is my code <?php $connection = mysql_connect("localhost","root","thetrap") or die ("couldn't connect to server"); $db = mysql_select_db("socialtemp",$connection) or die ("couldn't select database"); $query = "Select * FROM users"; $result = mysqli_query($query) or die("query failed :" . mysql_error()); echo "<TABLE BORDER='1'>"; echo "<TR>"; echo"<TH>Name</TH><TH>Number</TH>"; echo "</TR>"; while ($row = mysql_fetch_array($result)){ echo "<TR>"; echo "<TD>", $row['name'], "</TD><TD>", $row['number'],"</TD>"; echo "</TR>"; } echo "</TABLE>"; echo "hello"; mysql_close($connection); ?> the script will not return anything. no errors, nothing. however if i just write echo "working" working will display in the browser. I'm wondering if it's my configuration something in the code i don't know. Any help would be greatly appreciated. thanks Quote Link to comment Share on other sites More sharing options...
Yesideez Posted July 9, 2007 Share Posted July 9, 2007 First, surround code with [code] and [/code] tags to make it easier to read. Try your script again, right-click in some empty space on your browser and "View Source" Paste what you see here (using code tags!) and we'll go from there. Quote Link to comment Share on other sites More sharing options...
yzerman Posted July 9, 2007 Share Posted July 9, 2007 You need to decide whether you are going to use mysql or mysqli - this is your problem. Quote Link to comment Share on other sites More sharing options...
Yesideez Posted July 9, 2007 Share Posted July 9, 2007 You need to decide whether you are going to use mysql or mysqli - this is your problem. Whoops! Well spotted! Quote Link to comment Share on other sites More sharing options...
InO Posted July 9, 2007 Author Share Posted July 9, 2007 thanks for the responses, i changed mysqli but i have another problem as well. my php.ini is set to display errors off and i've been trying to change the setting, i've restarted apache, looked for multiple files and everything. this is why i can't get any errors returned. also what do you mean be by code tags, html tags? let me know and i'll do it. this is entire script <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?php $connection = mysql_connect("http://www.hotmail.com","","") or die ("couldn't connect to server"); $db = mysql_select_db("socialtemp",$connection) or die ("couldn't select database"); $query = "Select * FROM users"; $result = mysql_query($query) or die("query failed :" . mysql_error()); echo "<TABLE BORDER='1'>"; echo "<TR>"; echo"<TH>Name</TH><TH>Number</TH>"; echo "</TR>"; while ($row = mysql_fetch_array($result)){ echo "<TR>"; echo "<TD>", $row['name'], "</TD><TD>", $row['number'],"</TD>"; echo "</TR>"; echo "hello"; } echo "</TABLE>"; //echo "hello"; mysql_close($connection); ?> </body> </html> when i view the source code in the browser i get this <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> Quote Link to comment Share on other sites More sharing options...
InO Posted July 9, 2007 Author Share Posted July 9, 2007 reply also i changed $connection in the last example. i was just trying to get it to return something. Quote Link to comment Share on other sites More sharing options...
Yesideez Posted July 9, 2007 Share Posted July 9, 2007 First, surround code with [code] and [/code] tags to make it easier to read. Quote Link to comment Share on other sites More sharing options...
InO Posted July 9, 2007 Author Share Posted July 9, 2007 <?php $connection = mysql_connect("http://www.hotmail.com","","") or die ("couldn't connect to server"); $db = mysql_select_db("socialtemp",$connection) or die ("couldn't select database"); $query = "Select * FROM users"; $result = mysql_query($query) or die("query failed :" . mysql_error()); echo "<TABLE BORDER='1'>"; echo "<TR>"; echo"<TH>Name</TH><TH>Number</TH>"; echo "</TR>"; while ($row = mysql_fetch_array($result)){ echo "<TR>"; echo "<TD>", $row['name'], "</TD><TD>", $row['number'],"</TD>"; echo "</TR>"; echo "hello"; } echo "</TABLE>"; //echo "hello"; //mysql_close($connection); ?> Quote Link to comment Share on other sites More sharing options...
InO Posted July 9, 2007 Author Share Posted July 9, 2007 when i view the source code i get this <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> Quote Link to comment Share on other sites More sharing options...
per1os Posted July 9, 2007 Share Posted July 9, 2007 when i view the source code i get this <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> Generally means your error_reporting is set to too low or display_errors is turned off. www.php.net/init_set init_set('display_errors', 'on'); error_reporting(E_ALL); Add those to the top and see if an error comes out. Quote Link to comment Share on other sites More sharing options...
InO Posted July 9, 2007 Author Share Posted July 9, 2007 found out what the problem is. thanks for all the help. for one i was changing the display_errors in the php.ini in the wrong place i.e the description, also my version doesn't seem to have mysql support so i was getting Fatal error: Call to undefined function mysql_connect(). guess i'm going to have to reinstall. Quote Link to comment Share on other sites More sharing options...
Yesideez Posted July 9, 2007 Share Posted July 9, 2007 One thing I do is uplaoded my code straight to some web space I'm renting. Saves me having to install oodles of files on my PC although the big problem is that I have to be online while writing anything which isn't a problem for me. 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.