0

I'm quite new to PHP and not familiar at all with using databases, so bear with me if you can. I have a site filled with comparison tables that basically have 3 values per product:

$product + $delivery = 'price'

I'm familiar with making a simple function that sums and echos the variables, but I want something more specific.

Basically, for $product, I want to set the value on-page, but for $delivery, I want to pull the variable value from some sort of database, so it sort of looks like:

$15.00 + $delivery_company_one = 'price'

How would I go about doing this? What should I specifically look into and learn? Any references would be much appreciated.

3 Answers 3

3

First of all, you should learn basic PHP syntax. You can't say:

$var1 + $var2 = $var3;

PHP won't work like that. The leftside variable is assigned to the value of the rightside, but $var1 + $var2 is not a variable, nor something that can be defined.

If you want to learn how to pull things from a database, you should definitely look into an SQL database, possibly accessing it through PDO. This means that you'd have to learn OOP. You can search for all of these things using Google. Skip the result that has a URL of w3schools.com/* for best results.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the resources. I know $var1 + $var2 is not proper syntax, I was just displaying it like that to get across what I'm trying to do in the least characters possible.
1

It sounds like you might want to go through a couple MySQL tutorials. MySQL is a widely used and supported database that is fairly simple to start with but has extremely advanced and powerful features once you progress along.

Play around with the XAMPP stack for a quick start. http://www.apachefriends.org/en/xampp.html

Start with some MySQL tutorials to get an idea of how that works. http://net.tutsplus.com/tutorials/databases/sql-for-beginners/

Try to access it through PHP and PDO. http://net.tutsplus.com/tutorials/php/why-you-should-be-using-phps-pdo-for-database-access/

Comments

-1

Google search returns a tutorial http://www.phphaven.com/article.php?id=65 to teach you how to use php using the mysqli

DONT USE MYSQL!!!!! use mysqli

Hire me chacha

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.