I need to make a simple car rental system for school.
I believe I have all the parts necessary, but the problem is, I don't know how to fetch data from the MySQL database.
I have done some research and found the snippet below .
to clarify , i want to use the specific price from the database and multiply it with the number of day
if ($modelname && $numday) {
if ($modelname = 'Jetta') {
$harga = mysql_query("SELECT price FROM carlist WHERE price = '13300'");
$tambah = mysql_fetch_row($harga);
$totalAll = $numday * $tambah;
$totalAll = number_format($totalAll, 2);
echo 'Total Price: RM<b>' . $totalAll . '</b>.';
}
}
Here is the error that I get:
Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\assignment2\orderform.php on line 109
Total Price: RM0.00.
Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\assignment2\orderform.php on line 231