PDA

View Full Version : Can't get MySQL data to show up on php page locally



mrflume
July 12th, 2008, 06:00 PM
I just went through this tutorial by Lee Brimelow http://library.creativecow.net/articles/brimelow_lee/php_mysql/video-tutorial.php

I am using MAMP pro and followed everything step by step very carefully but when I go to view my products.php page locally nothing shows up on the page...nothing in the page source either. I'm not quite sure what exactly is wrong with what I did, I did use a blank php page in dreamweaver instead of his program that he used to write the php code but i feel like that shouldn't have anything to do with it. I used a different database name than he did..everything else seems to be the same. Only I'm using dreamweaver, MAMP Pro, and viewing it locally.

sekasi
July 12th, 2008, 06:15 PM
Kinda have to give us some more to go on than that buddy. Make sure your local php server compiles properly with hello world echos and then show the code! : )

mrflume
July 12th, 2008, 06:34 PM
Kinda have to give us some more to go on than that buddy. Make sure your local php server compiles properly with hello world echos and then show the code! : )

my bad, here's the code:


<?PHP

$link = mysql_connect("localhost","root","root");
mysql_select_db ("store");

$query = 'SELECT * FROM products';
$results = mysql_query($query);

echo "<?xml version=\"1.0\"?>\n";
echo = "<products>\n";

while($line = mysql_fetch_assoc($results)) {

echo "<item>" . $line["product"] . "</item>\n";
}

echo "</products\n";

mysql_close($link);

?>

How do i make sure it complies with hello world echos?

sekasi
July 12th, 2008, 06:40 PM
Make a php file that looks like this;




<?php

echo "HAY WORLD";

?>


See if you get anything from it ;)

In addition; there's a couple of typos in your code. Do you have any error reporting on? (error_reporting(E_ALL)) for example.

mrflume
July 12th, 2008, 06:56 PM
Make a php file that looks like this;




<?php

echo "HAY WORLD";

?>
See if you get anything from it ;)

In addition; there's a couple of typos in your code. Do you have any error reporting on? (error_reporting(E_ALL)) for example.


That worked..what typos do u notice?

sekasi
July 12th, 2008, 06:57 PM
Turn on error reporting and paste the error you get pls :o

mrflume
July 12th, 2008, 07:11 PM
Turn on error reporting and paste the error you get pls :o

i pasted (error_reporting(E_ALL)) in between the php tags in my products.php file. Still nothing showed up when i went to the page after i saved it.