Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

General discussion

PHP and MySQL

Aug 16, 2007 4:52AM PDT

I am currently creating a dynamic website for a friend, and am having problems. Sad I am currently stuck at tables...I have created a Recordset within Dreamweaver, connected to my server and EVERYTHING...and don't know what to do. I am having problems getting data into the table. I am using PHP, and MySQL. If you want to look at the website, head on over to http://richard-escobedo.com/carena/alpha.php

Thanks!
Richard Escobedo

Discussion is locked

- Collapse -
re php and sql
Aug 28, 2007 10:00PM PDT

Are you trying to put data into the table from the page? Post your php code for more help

- Collapse -
Here ya go:
Aug 29, 2007 7:22AM PDT

<?php echo $row_Product_Info['Product']; ?>
<?php echo $row_Product_Info['Description']; ?>
<?php echo $row_Product_Info['Price']; ?>

For some reason, the PHP doesn't show up in the source code of the page. And I am not trying to put data into the table via the page, although that would be nice. Happy

- Collapse -
Which table is which....
Aug 29, 2007 7:37AM PDT

The PHP doesn't show up as it is server code that is run to generate the HTML that the browser will read. Assuming you are trying to go from the PHP into MySQL,i.e. from the page into the database, then where is the insert call to add to the database? If you are going the reverse, i.e. from the database into the page, then where is the select statement so that the row is initialized with the proper fields?

Regards,
JB

- Collapse -
Look for Tutorials
Aug 30, 2007 4:52AM PDT

Do a google search for PHP and MySQL tutorials and it should help. As noted in a previous answer, within your PHP you have to put in commands to connect to the database and then you have to put in a select statement to pull from the database before you start to echo the results.

If you want to put data into the database you will again connect to the database and then use an insert command. Make sure that if you do this that the page for input is password protected and/or you escape out any commands that would run against the database and possibly allow your site to be hacked.