Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[SQl+PHP]Can you help me out on this one?

Newbie Spellweaver
Joined
Jan 11, 2009
Messages
6
Reaction score
0
Hello,
so.. i need to make a webshop for computer class using SQl and PHP.
we got the database up and running and we can search for products and display them.. but now, we want to show a list of books that aren't available. we got the SQL query and if we run it in phpmyadmin it shows what we want it to show. so we took this query and inserted it into php. (i will include the codes) and we expected that the webpage would show our result.

here is the SQl Query
Code:
SELECT b.nr, b.titel , r.boeknr, r.datum_reservering, r.datum_beschikbaar, r.status 
FROM boeken b LEFT JOIN reserveringen r ON r.boeknr = b.nr 
WHERE r.status is not null 
ORDER BY 'r.boeknr'

it shows the following: (i give the url.)


our current php code
Code:
<?php
ini_set('display_errors', 1); 
error_reporting(E_ALL);

$db_user = 'h09tsproet';     
$db_pass = 'ts06101993';          
$db_host = 'localhost'; 
$db_db =   'h09tsproet_bib';          

//connect to host
mysql_connect($db_host,$db_user,$db_pass) or die(mysql_error());
//connect to database
mysql_select_db($db_db) or trigger_error(mysql_error());
//Query
$result = mysql_query("SELECT b.nr, b.titel , r.boeknr, r.datum_reservering, r.datum_beschikbaar, r.status FROM boeken b LEFT JOIN reserveringen r ON r.boeknr = b.nr WHERE r.status is not null ORDER BY 'r.boeknr' limit 0, 131");

$i=0;
while ($i < $num) {
$titel=mysql_result($result, $i,"titel");
$datumres=mysql_result($result, $i, "datum_reservering");
$datumbeschik=mysql_result($result, $i, "datum_beschikbaar");
$status=mysql_result($result, $i, "status");

echo "$titel $datumres $datumbeschik $status";

$i++;
}
?>

our database
it is in dutch so you might not understand it.

hope you guys (girls) can help me out :)
 
Newbie Spellweaver
Joined
Jan 11, 2009
Messages
6
Reaction score
0
we tryed that out but then it did not show what we wanted it to show.
it only showed data from table reserveringen (reservations) and not from boeken. (books).

here is the diagram from our database setup (shows what columns exist in every table and how they are linked)

 
Newbie Spellweaver
Joined
Jan 11, 2009
Messages
6
Reaction score
0
Almoast seems like the plan we have in mind is impossible D:

:p
 
Infraction Baɴɴed
Loyal Member
Joined
Apr 9, 2008
Messages
1,416
Reaction score
169
nothing is impossible, just sometimes super hard to achieve so dont give up
 
Mother effin' clouds
Loyal Member
Joined
Apr 13, 2008
Messages
1,534
Reaction score
448
Let me point you to the right direction:
 
Back
Top