Raymond,

What sort of error are you getting?

One of the most useful tools in your toolbox is the print() function. 
Try doing something like this:

$sSQL = "SELECT '$car' FROM varetabell WHERE carid='$carid'";
print ($sSQL);

$sql = mysql_query($sSQL);
$myrow = mysql_fetch_array($sql);
$x = $myrow["$car"];

This will let you see exactly what query is being passed to the 
database, and that alone will frequently tell you where the problem 
lies.  That is probably the best place to start.

FWIW, in almost all of my database interactions, I set the query as a 
separate string variable, just so that I can use this sort of debugging 
technique.


Raymond Lilleodegard wrote:

> Hi all!
> 
> I have this form with some choices:
> 
> <form>
> Enter how many cars you want:<input type="text" name="number" >
> <select size="1" name="car">
> <option selected>ford</option>
> <option>bmw</option>
> <option>mercedes</option>
> </select>
> 
> And then I am trying to get the price out of a table in my database with
> this code:
> 
> 
> $sql = mysql_query("SELECT '$car' FROM varetabell where carid='$carid' ");
> $myrow= mysql_fetch_array($sql);
> $x = $myrow["$car"];
> 
> $price = $x * $number;
> 
> 
> Shouldn't this work?  Or am I missing something here?
> 
> 
> 
> Best regards Raymond
> 
> 
> 
> 



-- 
Sliante,
Richard S. Crawford

mailto:[EMAIL PROTECTED] 
        http://www.mossroot.com
AIM:  Buffalo2K   ICQ: 11646404  Yahoo!: rscrawford
MSN:  [EMAIL PROTECTED]

"It is only with the heart that we see rightly; what is essential is 
invisible to the eye."  --Antoine de Saint Exupery

"Push the button, Max!"



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to