Call a PHP Script and MySQL Value?
I was wondering how I could do this.
I have a little test database in MySQL. I also have a couple little test pages that I'm using with PHP and MySQL. What I want to know is, can I create a single PHP script, call it, then use the values I have in my database to become the values for the stuff in my webpage when it loads?. I want a script that can be Like this:
<?php 'Call PHP Script' ?>
$'Variable' = 'MySQL Value';
*Not actual code.
I'm doing it this way because of a little lottery program I have and I want to just change values in my database and have them become the values of my page. I hope this isn't too confusing...I even confused myself, I just don't know how to word it better.
Edit: I kind of mean like an automatic php/mysql script that will load on the page startup/refresh.
Edit 2: I was also hoping I could pass some info through it so it picks up the correct value. Like calling a php script giving it the name of the value and having it return the value itself. Please stop me if I've lost you.
Re: Call a PHP Script and MySQL Value?
umm, do you want the page to generate random numbers, or are there already values you have in the database?
Re: Call a PHP Script and MySQL Value?
Basically I want a php script to get a mysql value and use that mysql value as the value for the variable in my page. Like say I have a little html random number generator. I want to be able to change the random number generators variables by changing values in my mysql database. So I have it set to get 3 numbers, then I can just change the variable on my mysql database and have it get 10 numbers without having to go inside the html.
Re: Call a PHP Script and MySQL Value?
well to get something from a database you use this code:
PHP Code:
$sql = "SELECT * FROM `mytable` WHERE row='something'";
$query = mysql_query($sql);
$row = mysql_fetch_array($query);
echo $row['column'];
to see more examples, click the link in my signature "MySQL Help"