[snip]
I need to convert database values into php variables.
Let me explain:

i.e. 

select firstbase, secondbase, thirdbase, home from
allstars where firstbase = 122;

Now I want to use all those field names as variables
with the same record information they would have if
you just ran the above statement.

i.e 
$fb =  $firstbase
$sb = $secondbase
$tb = $thirdbase
[/snip]

Here is the code -->

<?php

$sql = "select firstbase, secondbase, thirdbase, home from allstars
where firstbase = '122'" ;
if(!($returnedData = mysql_query($sql, $yourDatabaseConnection))){
        echo mysql_error() . "\n";
        exit();
}

while($row = mysql_fetch_array($returnedData)){
        /* here are your variables */
        $fb = $row['firstbase'];
        $sb = $row['secondbase'];
        $tb = $row['thirdbase'];
        /* ...and so on ...*/
}
echo $fb . "<br>\n"; //print out to the screen
echo $sb . "<br>\n"; //print out to the screen
echo $tb . "<br>\n"; //print out to the screen

?>

My suggestion is that you work some basic PHP/MySQL tutorials and use
the PHP general list ([EMAIL PROTECTED]) for questions like
this. Make sure you have RTFM, STFA, and STFW before posting, those guys
can be merciless.


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to