![]() |
|
|
#1 |
![]() Join Date: Jun 2008
Location: England
Posts: 990 (0.55/day)
Thanks: 166
Thanked 76 Times in 72 Posts
|
Extracting data from relational databases
Hi,
New to phpmyadmin, PHP, MySQL, etc - so please excuse me if the answer to the question is simple. I've built a database using XAMPP called "evidence db". Within that database, I have a table called "m cases". This table has 11 columns. I currently have the following code: Code:
<html>
<head>
<title>Search data</title>
</head>
<body>
<table>
<tr>
<td align="center">EMPLOYEES DATA</td>
</tr>
<tr>
<td>
<table border="1">
<tr>
<td>Case ID</td>
</tr>
<?
mysql_connect("localhost","root","");//database connection
mysql_select_db("evidence db");
$order = "SELECT * FROM m cases";
$result = mysql_query($order);
while($data = mysql_fetch_row($result)){
$field1= $row["Case ID"];
echo("$field1");
}
?>
</table>
</td>
</tr>
</table>
</body>
</html>
Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\helloworld.php on line 25 Thanks in advanced. PS - If anyone can recommend PHP/Phpmyadmin tutorials - i'd be interested in reading them. |
|
|
|
|
|
#2 |
![]() Join Date: May 2009
Location: In the mountains :) Adirondacks in NY (US)
Posts: 3,709 (2.49/day)
Thanks: 4,547
Thanked 1,449 Times in 1,040 Posts
|
i recommend checking out http://www.phpfreaks.com/, not to advert other forums but they are dedicated to php coding and will likely get you solved much faster than here, unless one of the few gurus happen to post.
also, all you ever need other than a forum is the manual pages http://php.net/manual/en/index.php more specifically, the man page for mysql_fetch_row(), here: http://php.net/manual/en/function.mysql-fetch-row.php as it says, it is recommend with current php versions to use a different mysql extension entirely, with good reason. you may want to consider that. good luck.
__________________
Donate to TPU TeamSpeak Server ![]() TPU TS: ts21.gameservers.com:9207 PSN / XBL / Steam = digibucc | Origin / BF3 = digibuc |
|
|
|
| The Following User Says Thank You to digibucc For This Useful Post: |
|
|
#3 |
![]() Join Date: Aug 2007
Location: Geneva, FL, USA
Posts: 3,010 (1.41/day)
Thanks: 567
Thanked 606 Times in 487 Posts
|
There's a space in that table name, so it needs to be escaped with backticks.
Code:
$order = "SELECT * FROM `m cases`"; Also, if you're just starting to learn, I'd suggest going with their PDO interface instead of the database specific functions. http://www.php.net/pdo Been meaning to put together a small intro to PDO for the forum, with the recent rise in PHP/database questions. Maybe I'll get around to doing it now that I said I would...
|
|
|
|
|
|
#4 |
![]() Join Date: Jun 2008
Location: England
Posts: 990 (0.55/day)
Thanks: 166
Thanked 76 Times in 72 Posts
|
Did put the backticks and have also updated the DB name to have no spaces - still no luck. Will have a better look at it tomorrow. Thanks for the input.
|
|
|
|
|
|
#5 |
|
Linux Advocate
Join Date: Nov 2006
Posts: 10,284 (4.27/day)
Thanks: 1,219
Thanked 2,789 Times in 1,801 Posts
|
just FYI, technically evidence db is a schema and not a database.
|
|
|
|
| The Following 2 Users Say Thank You to Easy Rhino For This Useful Post: |
|
|
#6 |
|
Moderato®™
Join Date: Apr 2009
Location: Statesville, NC
Posts: 3,887 (2.55/day)
Thanks: 4,379
Thanked 2,365 Times in 1,183 Posts
|
You don't have a password setup for "root"? I would set a password or actually go one step further and change the "root" user id to something else completely, but that's just me.
![]() EDIT: Nice catch Easy Rhino!
__________________
“As long as I feel the warmth from the sun and breathe precious air…. I must ask questions to feed the Mind!” Battletag: Mindweaver#1523 |
|
|
|
|
|
#7 | |
![]() Join Date: Jan 2012
Location: Dover, New Hampshire, USA
Posts: 4,505 (8.87/day)
Thanks: 1,441
Thanked 1,423 Times in 1,063 Posts
|
You need error checking, my friend.
Change this: PHP Code:
PHP Code:
Quote:
PHP Code:
__________________
MyHeat Last edited by Aquinus; Jul 12, 2012 at 10:16 PM. |
|
|
|
|
|
|
#8 |
![]() Join Date: Jun 2008
Location: England
Posts: 990 (0.55/day)
Thanks: 166
Thanked 76 Times in 72 Posts
|
Thanks for the input. It's now working
|
|
|
|
|
|
#9 |
![]() Join Date: Jun 2008
Location: England
Posts: 990 (0.55/day)
Thanks: 166
Thanked 76 Times in 72 Posts
|
Has anyone ever had problems with dreamweaver displaying the page layout differently to that shown on a web browser?
|
|
|
|
|
|
#10 |
|
Hardcore Monkey Moderator
Join Date: Feb 2007
Location: Cheeseland (Wisconsin, USA)
Posts: 12,254 (5.27/day)
Thanks: 591
Thanked 5,510 Times in 2,948 Posts
|
I haven't but that probably because I never used Dreamweaver.
![]() Okay, I'm not trolling. I've noticed that in several IDE environments that what the IDE shows is not always the same as when it runs in a browser or as an application. For instance, working with WPF in VS2010, what is shown in the IDE is not always the same as when you run the app outside of the IDE. Minor emulation differences I assume. Best to check everything in its final resting place (like in a browser) than count on the display in the tools to be accurate.
__________________
Cloud (noun, singular): A dynamic arrangement of multiple potential single points of failure, with a user at one end and their data at the other. Get more tech news on a wide variety of topics at NextPowerUp
|
|
|
|
|
|
#11 |
![]() Join Date: Jan 2012
Location: Dover, New Hampshire, USA
Posts: 4,505 (8.87/day)
Thanks: 1,441
Thanked 1,423 Times in 1,063 Posts
|
Dreamweaver has its own HTML render. You will find that with certain setting, they will look a little different between different browsers, be it Firefox, Chrome, IE, etc. When testing, you really should check all the different browsers that you're planning to support. That's the only way to make sure it works on all of them the way you have your HTML and CSS configured because two browsers might handle padding, margins, and borders differently depending on the settings.
My rule of thumb is: Don't use Dreamweaver.
__________________
MyHeat |
|
|
|
|
|
#12 |
![]() Join Date: Jun 2008
Location: England
Posts: 990 (0.55/day)
Thanks: 166
Thanked 76 Times in 72 Posts
|
Just out of interest - What do you guys use?
|
|
|
|
|
|
#13 |
|
Benevolent Dictator
Join Date: May 2004
Location: Stuttgart, Germany
Posts: 13,866 (4.17/day)
Thanks: 184
Thanked 10,448 Times in 3,216 Posts
|
|
|
|
|
|
|
#14 |
![]() Join Date: May 2009
Location: In the mountains :) Adirondacks in NY (US)
Posts: 3,709 (2.49/day)
Thanks: 4,547
Thanked 1,449 Times in 1,040 Posts
|
i use jetbrains phpstorm. if i were to use a wysiwyg it would be dreamweaver, but i don't do much real layout work, and stick to coding.
__________________
Donate to TPU TeamSpeak Server ![]() TPU TS: ts21.gameservers.com:9207 PSN / XBL / Steam = digibucc | Origin / BF3 = digibuc |
|
|
|
|
|
#15 |
![]() Join Date: Jan 2012
Location: Dover, New Hampshire, USA
Posts: 4,505 (8.87/day)
Thanks: 1,441
Thanked 1,423 Times in 1,063 Posts
|
I use vim to edit PHP, my database of choice is PostgreSQL. Even when I do layout, I usually write the CSS by hand and I use various browsers to test it. I prefer Chrome, but not everyone uses Chrome, so I keep Firefox and IE handy as the most commonly used.
__________________
MyHeat |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Extracting video BIOS from main BIOS | WaroDaBeast | Motherboards & Memory | 6 | Dec 25, 2011 12:40 AM |
| Online databases? | <<Onafets>> | Programming & Webmastering | 2 | Jan 3, 2011 07:59 AM |
| Extracting a swollen battery from a UPS | twilyth | General Hardware | 8 | Aug 10, 2010 07:48 PM |
| Extracting audio from youtube videos in Linux- Solution | crazy pyro | Linux / BSD / Mac OS X | 9 | Jul 31, 2009 05:55 PM |
| SQL Relational algebra | new_rez | Programming & Webmastering | 2 | Mar 18, 2008 06:02 PM |