Re: [PHP] Re: show info from mysql db
On 06/10/2012 09:50 AM, Tim Dunphy wrote: You had been keeping the password secret, but it looks like you accidentally leaked it, so a replacement might be in order :) oh wow.. gotta hate when you do that!!! on it! Glad you got it fixed. Typos can be little buggers to find sometimes. me too.. fell back to the old 'echo hello' test strategy .. have to try to remember that strategy before i go running for help.. :) FYI: When developing, make sure to have error_reporting = E_ALL and display_errors = On or be sure to tail your error_log file. tim On Sun, Jun 10, 2012 at 12:15 PM, Adam Richardsonsimples...@gmail.com wrote: On Sun, Jun 10, 2012 at 8:25 AM, Tim Dunphybluethu...@gmail.com wrote: $dbc = mysqli_connect('127.0.0.1','admin',secret','trek_db') or die ('Could not connect to database'); used to be... $dbc = mysqli_conect('127.0.0.1','admin','Duk30fZh0u','trek_db') or die ('Could not connect to database'); You had been keeping the password secret, but it looks like you accidentally leaked it, so a replacement might be in order :) Glad you got it fixed. Typos can be little buggers to find sometimes. Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.com -- Jim Lucas http://www.cmsws.com/ http://www.cmsws.com/examples/ http://www.bendsource.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: show info from mysql db
wow! this fixed it.. $dbc = mysqli_connect('127.0.0.1','admin',secret','trek_db') or die ('Could not connect to database'); used to be... $dbc = mysqli_conect('127.0.0.1','admin','Duk30fZh0u','trek_db') or die ('Could not connect to database'); d'oh!! spelling counts!!! :) On Sun, Jun 10, 2012 at 1:15 AM, Tim Dunphy bluethu...@gmail.com wrote: hello list, I tried designing a very basic couple of web pages tonight that was solely meant to build some php chops. intentionally cheesy. I got half the way there by designing a page that grabs some info from an html form and puts that info into a mysql database. This part works. You can see that page here: html headtitleStarship Crew/title/head body bgcolor=black centerimg src=logo.jpg alt=Star Trek Logo / /center font size=3 color=white style .box{ font-family:Tahoma, Geneva, sans-serif; font-size:16px; text-align: center } /style pEnter your First Name, Last Name, Rank, Division,Ship and Email address./p form method=post action=addcrew.php trtdlabel for=firstnameFirst name:/label input type=text id=firstname name=firstname //td/trbr / trlabel for=lastnameLast name:/label input type=text id=lastname name=lastname //trbr / trlabel for=rankRank:/label input type=text id=rank name=rank /br //tr trlabel for=divisionDivision:/label input type=text id=division name=division /br //tr trlabel for=shipShip:/label input type=text id=ship name=ship /br //tr tr/trlabel for=emailEmail:/label input type=text id=email name=email /br //tr input type=submit name=Submit value=Submit / /form a href='showcrew.php'Show crew manifest/a centerimg src=enterprise.jpg alt=Enterprise / /center /font /body /html This is the one table in the database: mysql describe crew_manifest; ++-+--+-+-+---+ | Field | Type | Null | Key | Default | Extra | ++-+--+-+-+---+ | first_name | varchar(20) | YES | | NULL | | | last_name | varchar(20) | YES | | NULL | | | rank | varchar(10) | YES | | NULL | | | division | varchar(10) | YES | | NULL | | | ship | varchar(20) | YES | | NULL | | | email | varchar(20) | YES | | NULL | | ++-+--+-+-+---+ 6 rows in set (0.06 sec) and this is the corresponding php page that inputs the info: ?php $first_name = $_POST['firstname']; $last_name = $_POST['lastname']; $rank = $_POST['rank']; $division = $_POST['division']; $ship = $_POST['ship']; $email = $_POST['email']; $dbc = mysqli_connect('127.0.0.1','admin','secret','trek_db') or die('Error connecting to MySQL database'); $query = INSERT INTO crew_manifest VALUES ('$first_name','$last_name','$rank','$division','$ship','$email'); $result = mysqli_query($dbc,$query) or die('Error querying database'); echo crew member added; mysqli_close($dbc); ? But the page that reads the info is the problem: html head titleShow Crew/title /head body bgcolor=black centerimg src=ncc1701.jpg alt=NCC 1701 / /center font size=3 color=white style .box{ font-family:Tahoma, Geneva, sans-serif; font-size:16px; text-align: center } /style centerCrew Manifest/center ?php $dbc = mysqli_conect('127.0.0.1','admin','secret','trek_db') or die ('Could not connect to database'); $query = SELECT * FROM crew_manifest; $result = mysqli_query($dbc,$query); while ($row = mysqli_fetch_array($result)) { $first_name = $row['first_name']; $last_name = $row['last_name']; $rank = $row['rank']; $division = $row['division']; $ship = $row['ship']; $email = $row['email']; echo $rank . 'br /'; } mysqli_close($dbc); ? /font /html What I'd like to find out is why the while loop does not display info from the database? The page does show up, but not any info from the db. Thanks in advance. tim -- GPG me!! gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B -- GPG me!! gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: show info from mysql db
On Sun, Jun 10, 2012 at 8:25 AM, Tim Dunphy bluethu...@gmail.com wrote: $dbc = mysqli_connect('127.0.0.1','admin',secret','trek_db') or die ('Could not connect to database'); used to be... $dbc = mysqli_conect('127.0.0.1','admin','Duk30fZh0u','trek_db') or die ('Could not connect to database'); You had been keeping the password secret, but it looks like you accidentally leaked it, so a replacement might be in order :) Glad you got it fixed. Typos can be little buggers to find sometimes. Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: show info from mysql db
You had been keeping the password secret, but it looks like you accidentally leaked it, so a replacement might be in order :) oh wow.. gotta hate when you do that!!! on it! Glad you got it fixed. Typos can be little buggers to find sometimes. me too.. fell back to the old 'echo hello' test strategy .. have to try to remember that strategy before i go running for help.. :) tim On Sun, Jun 10, 2012 at 12:15 PM, Adam Richardson simples...@gmail.com wrote: On Sun, Jun 10, 2012 at 8:25 AM, Tim Dunphy bluethu...@gmail.com wrote: $dbc = mysqli_connect('127.0.0.1','admin',secret','trek_db') or die ('Could not connect to database'); used to be... $dbc = mysqli_conect('127.0.0.1','admin','Duk30fZh0u','trek_db') or die ('Could not connect to database'); You had been keeping the password secret, but it looks like you accidentally leaked it, so a replacement might be in order :) Glad you got it fixed. Typos can be little buggers to find sometimes. Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.com -- GPG me!! gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: show info from mysql db
On 06/10/2012 07:50 PM, Tim Dunphy wrote: Glad you got it fixed. Typos can be little buggers to find sometimes. me too.. fell back to the old 'echo hello' test strategy .. have to try to remember that strategy before i go running for help..:) I dont agree: If you used exceptions (with real meanings to messages) you would have saved time. Use exceptions. -- RMA. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php