close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Display full MySQL table

Thread began 1/17/2012 8:34 am by gary.brett434358 | Last modified 1/19/2012 6:16 am by gary.brett434358 | 3006 views | 13 replies |

gary.brett434358

Display full MySQL table

Hi, just starting out with DA so very possibly a simple question, please bare with me!

To start with I need a dynamic table that simply displays all records from my user table, this should have the option to update/add new record etc. Using DataAssist I don't seem to be able to create the primary display table, it creates pages for 'insert', 'update', 'details', 'search', 'results' but not the full table page, should it create this?

I have created a dynamic table within DW that does display the table but this leaves me with no options on each record to amend? Anyone have advice on how I can go about this?

Also I am using my own CSS for my site so don't need DA to provide the css, is this possible or should I just comment out the code it inserts on each page?

Kind regards

Sign in to reply to this post

Jason ByrnesWebAssist

the results page will show a row for each record in the table if you do not enter anything on the search page.

you can elect not to create a search page, and just open the results page directly, this will show a row for search record with the option to update or view the details page.

Sign in to reply to this post

gary.brett434358

Originally Said By: Jason Byrnes
  the results page will show a row for each record in the table if you do not enter anything on the search page.

you can elect not to create a search page, and just open the results page directly, this will show a row for search record with the option to update or view the details page.  



That's great Jason, will give it another try. Is there a reason why when I run the wizard and choose only 5 fields for results page it displays every single column [16]? I have tried this now 3 times ensuring on the results config I simply choose 5 columns to display?

I suppose I can manually remove just wondering why it would happen?

Thanks

Sign in to reply to this post

Jason ByrnesWebAssist

Not sure, I'm not able to reproduce the issue.

Open the results page and go to the server behaviors panel, in the server behaviors list, double click the Repeat Region server behavior to edit it. set the records to show to 5.

Sign in to reply to this post

gary.brett434358

Originally Said By: Jason Byrnes
  Not sure, I'm not able to reproduce the issue.

Open the results page and go to the server behaviors panel, in the server behaviors list, double click the Repeat Region server behavior to edit it. set the records to show to 5.  



Hi Jason, thanks again. All sorted now, I didn't realise I needed to remove all columns I didn't want in the wizard.

On another note, is there an easy way to format the date into UK format? I have been looking at the code created by DA, but not sure where exactly I need to try and change the format. MySQL table is yyyy-mm-dd but I need dd-mm-yyyy, am I able to change this in the queries created on each page in the header section?

I did find some code to achieve this but it fails when I add to the DA created insert pages? I added the below to the header section along with the DA created code & change 'column' to my column name which is ContactDOB.

<?php
function mysql2uk($date) {
return date('d-m-Y H:i:s',strtotime($date));
}
$sql ="select * from tblContacts";
$result = mysql_query($sql) or die();
$values = mysql_fetch_row($result);
echo mysql2uk($values['Column']);
?>

Thanks again Jason.

Sign in to reply to this post

gary.brett434358

php file attached if it helps?

Attached Files
WAtblcontacts_Update.zip
Sign in to reply to this post

Jason ByrnesWebAssist

change line 151:

php:
<td class="WADADataTableCell"><input type="text" name="ContactDOB" id="ContactDOB" value="<?php echo(str_replace('"''&quot;'$row_WADAtblcontacts['ContactDOB'])) ?>" size="32" /></td>



to:

php:
<td class="WADADataTableCell"><input type="text" name="ContactDOB" id="ContactDOB" value="<?php echo(date("d-m-Y"strtotime($row_WADAtblcontacts['ContactDOB']))) ?>" size="32" /></td>
Sign in to reply to this post

gary.brett434358

Originally Said By: Jason Byrnes
  change line 151:
php:
<td class="WADADataTableCell"><input type="text" name="ContactDOB" id="ContactDOB" value="<?php echo(str_replace('"''&quot;'$row_WADAtblcontacts['ContactDOB'])) ?>" size="32" /></td>


to:
php:
<td class="WADADataTableCell"><input type="text" name="ContactDOB" id="ContactDOB" value="<?php echo(date("d-m-Y"strtotime($row_WADAtblcontacts['ContactDOB']))) ?>" size="32" /></td>
  



Hi Jason, that does indeed allow me to add the date in UK format on the insert page but once 'update' is selected it writes it the the database as 0000-00-00, this then displays like that on the details page?

MySQL table format is 'Type = Date', 'Default=NULL'

Is it possible to store it in the DB as 31/01/12 so that displays on detail page?

Regards

Gary

Sign in to reply to this post

Jason ByrnesWebAssist

add the following code at line 1:

php:
<?php

if(isset($_POST['ContactDOB']) && $_POST['ContactDOB'] != "") {
    
$_POST['ContactDOB'] = date("Y-m-d"strtotime($_POST['ContactDOB']));
}
?>
Sign in to reply to this post

gary.brett434358

Originally Said By: Jason Byrnes
  add the following code at line 1:

php:
<?php
if(isset($_POST['ContactDOB']) && $_POST['ContactDOB'] != "") {
    
$_POST['ContactDOB'] = date("Y-m-d"strtotime($_POST['ContactDOB']));
}
?>
  



Hi Jason, thanks for the update that hasn't changed anything I'm afraid, I even change the above code to d-m-Y to match the earlier code sent across. Have attached the revised php file, I have ensured the code is being sent back by inserting data into another field on same form, that updates perfectly.

An odd thing does happen, when I view any record on update page the ContactDOB field always displays 01-01-1970, if I change to 17-03-1968 and select 'update' the details page & MySQL table shows 0000-00-00? If I then choose 'update' again it displays 01-01-1970 on update page!

Sorry to be a pain, really cant work this out!

Gary

Attached Files
WAtblcontacts_Update (2).zip
Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...