cello10 Posted December 2, 2014 Share Posted December 2, 2014 So I have this script. I connected the database and verified a working connection to the base, password correct. As I save the script on my server it saved the changes and I view the file online. The resulting page is blank. Really need help completing this code as it's essential to my sites organization, have a look below and help me if possible. <?php //make connection mysql_connect('localhost', 'cello10_employees', 'brigite27'); //select db mysql_select_db('cello10_tutorials'); $sql="SELECT * FROM employees WHERE age='23'"; ?> Thanks Emanuel Quote Link to comment https://forums.phpfreaks.com/topic/292837-sql-display-using-where/ Share on other sites More sharing options...
requinix Posted December 2, 2014 Share Posted December 2, 2014 (edited) Did you upload it with a .php extension? Have you verified that your host supports PHP? Or maybe it requires an abnormal extension like .php5 or .cgi. [edit] Oh, and please don't post passwords Edited December 2, 2014 by requinix 1 Quote Link to comment https://forums.phpfreaks.com/topic/292837-sql-display-using-where/#findComment-1498259 Share on other sites More sharing options...
cello10 Posted December 2, 2014 Author Share Posted December 2, 2014 (edited) Uploaded with.php extension and verified with my host but let me try the php5 extension and such. EDIT: Under .cgi I experienced: Internal Server ErrorThe server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, webmaster@wandwbook.com and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. and with the php5 extension it's still the same. The could should generally work right? Edited December 2, 2014 by cello10 Quote Link to comment https://forums.phpfreaks.com/topic/292837-sql-display-using-where/#findComment-1498261 Share on other sites More sharing options...
Barand Posted December 2, 2014 Share Posted December 2, 2014 To get a page to show something you have to output something. All you are doing is defining a string variable. You also need to get into the habit of checking for errors. Quote Link to comment https://forums.phpfreaks.com/topic/292837-sql-display-using-where/#findComment-1498262 Share on other sites More sharing options...
QuickOldCar Posted December 2, 2014 Share Posted December 2, 2014 To elaborate what Barand said...do a mysql query and echo any results from it Quote Link to comment https://forums.phpfreaks.com/topic/292837-sql-display-using-where/#findComment-1498264 Share on other sites More sharing options...
QuickOldCar Posted December 2, 2014 Share Posted December 2, 2014 Isn't this the same issue as this post? http://forums.phpfreaks.com/topic/292820-connecting-to-database-and-displaying-the-row/ Quote Link to comment https://forums.phpfreaks.com/topic/292837-sql-display-using-where/#findComment-1498265 Share on other sites More sharing options...
cello10 Posted December 3, 2014 Author Share Posted December 3, 2014 OK but adding: echo $sql; doesn't work. It was placed before ?> on the line before that. Still not getting it. Quote Link to comment https://forums.phpfreaks.com/topic/292837-sql-display-using-where/#findComment-1498329 Share on other sites More sharing options...
cello10 Posted December 3, 2014 Author Share Posted December 3, 2014 Solved the issue, can someone close this topic and the other one? Quote Link to comment https://forums.phpfreaks.com/topic/292837-sql-display-using-where/#findComment-1498333 Share on other sites More sharing options...
mac_gyver Posted December 3, 2014 Share Posted December 3, 2014 the "Mark Solved" button is in the lower right-hand corner of each post in the thread. Quote Link to comment https://forums.phpfreaks.com/topic/292837-sql-display-using-where/#findComment-1498336 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.