PHP/ MYSQL help...
pobster - November 8, 2005 - 13:17
I'm scratching my head over why this won't work and I'd appreciate a helpful pointer or two... PLEASE! :o)
<?php
$result = db_query("SELECT * FROM vpl");
$fetch = db_fetch_object($result);
$rows = array ( 'data' => unserialize($fetch->data));
print theme('table', unserialize($fetch->header), $rows);
?>The vpl database has header and data tables in it, which have been cut and pasted from just doing a 'print serialize(...);' from the original table. In the above code the header is printed out nicely - it's the data which doesn't appear.
Please help! :o)
Thank you
Pobster

please read more on the concept tables and Database
You see mto get the idea "database" and "database table" wrong. PLease search a PHP (this is a Drupal, not a php helpdesk) tutorials about this.
Personally i like webmoney and evilwalrus. Try them.
---
if you dont like the choices being made for you, you should start making your own.
---
[Bèr Kessels | Drupal services www.webschuur.com]
Think you misunderstand
I'm not having any problems with creating and using the databases, the problem I'm having is being able to unserialize an array into Drupals theme('table'...) My only problem with databases is not knowing the correct terminology to get across what it is I want to do (not being a php or mysql programmer and all...)
I'd really appreciate some help please. I can unserialize the data and view it as an array - the problem is only that I can't seem to get Drupal to display it in its table theme. I don't want to just spout it out using html tables (which I can because I did that first off).
Pobster
not certain..but..
Hi Pobster,
I'm not a php expert..but you could check out the php snippets section of the Drupal handbook in case there is an example in there that you could adopt/copy for your purposes...
Dub
Nah there's nothing in there
Nah there's nothing in there and although I can find lots of info about serialize and unserialize, of course there's nothing available about specifically putting it into Drupal theme('table', ...
I give up, its not important anyway. I was only trying to see whether there was a cleaner way to do something I've already done. I'm trying to change all my code to work using Drupal themes and APIs - I guess this is one which will have to stay as it is!
Thanks
Pobster
HAHAHA!!!
Actually the code at the top ;o) It works fine! Just... Only for one row! ;o) Still at least I've got somewhere with it now!
The only other problem I have is that my £ sign is coming up as ?
Yikes! :o)
Pobster