Jump to content

Incessant-Logic

Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Incessant-Logic's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Using DW8, MySQL and PHP: I'm extracting three parts of a recordset. $row_query_fiction['fiction_title'] (story) $row_query_fiction['chapter_no'] (nothing) $row_query_fiction['chapter_title'] (A good start) I want to display the title folloed by the name of the chapter, then if thats empty by the chapter number and if thats empty nothing. <?php if { $row_query_fiction['chapter_title'] == "" { if $row_query_fiction['chapter_no'] == "" {} else {echo ': Chapter ', $row_query_fiction['chapter_no'];} else {echo ': ', $row_query_fiction['chapter_title'];} } ?> Would output: Story: A good start. But all I get is Parse error: parse error, expecting `'('' in D:\http\ilweb-v\fiction.php on line 126 (which is first line) What am I doing wrong?
  2. Okay just tried that, I get an Undefined variable: row_data_grab my code in a test page is as follows: (all done in DW) [!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--][span style=\"color:#0000BB\"]<?php [/span][span style=\"color:#007700\"]require_once([/span][span style=\"color:#DD0000\"]\'Connections/il_db.php\'[/span][span style=\"color:#007700\"]); [/span][span style=\"color:#0000BB\"]?> <?php mysql_select_db[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$database_il_db[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]$il_db[/span][span style=\"color:#007700\"]); [/span][span style=\"color:#0000BB\"]$query_blog [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#DD0000\"]\"SELECT blog_date, blog_title, blog_text, blog_author FROM blog WHERE blog_active = 1 ORDER BY blog_id DESC\"[/span][span style=\"color:#007700\"]; [/span][span style=\"color:#0000BB\"]$blog [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]mysql_query[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$query_blog[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]$il_db[/span][span style=\"color:#007700\"]) or die([/span][span style=\"color:#0000BB\"]mysql_error[/span][span style=\"color:#007700\"]()); [/span][span style=\"color:#0000BB\"]$row_blog [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]mysql_fetch_assoc[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$blog[/span][span style=\"color:#007700\"]); [/span][span style=\"color:#0000BB\"]$totalRows_blog [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]mysql_num_rows[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$blog[/span][span style=\"color:#007700\"]); function [/span][span style=\"color:#0000BB\"]builddatetime[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$date_time[/span][span style=\"color:#007700\"]) { [/span][span style=\"color:#0000BB\"]$year[/span][span style=\"color:#007700\"]=[/span][span style=\"color:#0000BB\"]substr[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$date_time[/span][span style=\"color:#007700\"],[/span][span style=\"color:#0000BB\"]0[/span][span style=\"color:#007700\"],[/span][span style=\"color:#0000BB\"]4[/span][span style=\"color:#007700\"]); [/span][span style=\"color:#0000BB\"]$month[/span][span style=\"color:#007700\"]=[/span][span style=\"color:#0000BB\"]substr[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$date_time[/span][span style=\"color:#007700\"],[/span][span style=\"color:#0000BB\"]4[/span][span style=\"color:#007700\"],[/span][span style=\"color:#0000BB\"]2[/span][span style=\"color:#007700\"]); [/span][span style=\"color:#0000BB\"]$day[/span][span style=\"color:#007700\"]=[/span][span style=\"color:#0000BB\"]substr[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$date_time[/span][span style=\"color:#007700\"],[/span][span style=\"color:#0000BB\"]6[/span][span style=\"color:#007700\"],[/span][span style=\"color:#0000BB\"]2[/span][span style=\"color:#007700\"]); [/span][span style=\"color:#0000BB\"]$hour[/span][span style=\"color:#007700\"]=[/span][span style=\"color:#0000BB\"]substr[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$date_time[/span][span style=\"color:#007700\"],[/span][span style=\"color:#0000BB\"]8[/span][span style=\"color:#007700\"],[/span][span style=\"color:#0000BB\"]2[/span][span style=\"color:#007700\"]); [/span][span style=\"color:#0000BB\"]$min[/span][span style=\"color:#007700\"]=[/span][span style=\"color:#0000BB\"]substr[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$date_time[/span][span style=\"color:#007700\"],[/span][span style=\"color:#0000BB\"]10[/span][span style=\"color:#007700\"],[/span][span style=\"color:#0000BB\"]2[/span][span style=\"color:#007700\"]); [/span][span style=\"color:#0000BB\"]$sec[/span][span style=\"color:#007700\"]=[/span][span style=\"color:#0000BB\"]substr[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$date_time[/span][span style=\"color:#007700\"],[/span][span style=\"color:#0000BB\"]12[/span][span style=\"color:#007700\"],[/span][span style=\"color:#0000BB\"]2[/span][span style=\"color:#007700\"]); [/span][span style=\"color:#0000BB\"]$str[/span][span style=\"color:#007700\"]=[/span][span style=\"color:#0000BB\"]date[/span][span style=\"color:#007700\"]([/span][span style=\"color:#DD0000\"]\"Y/m/d H:i:s\"[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]mktime[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$hour[/span][span style=\"color:#007700\"],[/span][span style=\"color:#0000BB\"]$min[/span][span style=\"color:#007700\"],[/span][span style=\"color:#0000BB\"]$sec[/span][span style=\"color:#007700\"],[/span][span style=\"color:#0000BB\"]$month[/span][span style=\"color:#007700\"],[/span][span style=\"color:#0000BB\"]$day[/span][span style=\"color:#007700\"],[/span][span style=\"color:#0000BB\"]$year[/span][span style=\"color:#007700\"])); return [/span][span style=\"color:#0000BB\"]$str[/span][span style=\"color:#007700\"]; } [/span][span style=\"color:#0000BB\"]?>[/span]<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> <html xmlns=\"http://www.w3.org/1999/xhtml\"> <head> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" /> <title>Untitled Document</title> </head> <body> [span style=\"color:#0000BB\"]<?php [/span][span style=\"color:#007700\"]do { [/span][span style=\"color:#0000BB\"]?> [/span] <p>[span style=\"color:#0000BB\"]<?php [/span][span style=\"color:#007700\"]echo [/span][span style=\"color:#0000BB\"]$row_blog[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'blog_title\'[/span][span style=\"color:#007700\"]]; [/span][span style=\"color:#0000BB\"]?>[/span]</p> <p>[span style=\"color:#0000BB\"]<?php [/span][span style=\"color:#007700\"]echo [/span][span style=\"color:#0000BB\"]$row_blog[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'blog_text\'[/span][span style=\"color:#007700\"]]; [/span][span style=\"color:#0000BB\"]?>[/span]</p> <p>[span style=\"color:#0000BB\"]<?php [/span][span style=\"color:#007700\"]echo [/span][span style=\"color:#0000BB\"]$row_blog[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'blog_author\'[/span][span style=\"color:#007700\"]]; [/span][span style=\"color:#0000BB\"]?>[/span]</p> <p>[span style=\"color:#0000BB\"]<?php $post_date_time [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$row_data_grab[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'post_date_time\'[/span][span style=\"color:#007700\"]]; if (!empty([/span][span style=\"color:#0000BB\"]$post_date_time[/span][span style=\"color:#007700\"])){ [/span][span style=\"color:#0000BB\"]$post_date_time2 [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]builddatetime[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$post_date_time[/span][span style=\"color:#007700\"]); echo [/span][span style=\"color:#0000BB\"]$post_date_time2[/span][span style=\"color:#007700\"]; } [/span][span style=\"color:#0000BB\"]?> [/span] </p> <hr width=\"80%\" align=\"center\" /> [span style=\"color:#0000BB\"]<?php [/span][span style=\"color:#007700\"]} while ([/span][span style=\"color:#0000BB\"]$row_blog [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]mysql_fetch_assoc[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$blog[/span][span style=\"color:#007700\"])); [/span][span style=\"color:#0000BB\"]?>[/span]</body> </html> [span style=\"color:#0000BB\"]<?php mysql_free_result[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$blog[/span][span style=\"color:#007700\"]); [/span][span style=\"color:#0000BB\"]?> [/span] [/span][!--PHP-Foot--][/div][!--PHP-EFoot--] Again any help appreciated. JC
  3. I'm in the process of creating a simple blog, partly as I want one and partly because I enjoy messing around. The blog is stored in a MySQL DB and each post has a timestamp field (column) blog_date I have used the basic DW connection and have inserted the timestamp field into my blog. This then displays as 20051019202020. How do I get that to display as 2005/10/19 20:20:20? I found an extension that will format a date, timestamp or mysql query(?) however I can't seem to work out how it finds the field. Also and on a slightly different topic, can you recommend a good site for free/cheap extensions?
  4. You may also want to check out this tutorial! I may be wrong but looking at the examples and the manual page, search for register_globals. It would seem that you could escape the pages that you wnat when you want.... IL
  5. Create a recordset for each repeat region. Thats what I do anyway, I haven't found a way round yet. IL
  6. There are tutorials on this site that cover this! If you want a written hard copy of the same subject I suggest a book by Eric Rosebrock that is advertised on this site, I bought it from amazon and it is really good. Creating Interactive Websites with PHP and Web Services (ISBN 0-7821-4279-6) It certainly covers creating a membership system! IL
  7. create a php file with the following in it: <?php phpinfo(); ?> save it and view it on your server, it should give you a whole load of info about your server, if it doesn't then your php is not working! If it does then I don't know! Its how I always test my server if php dosn't seem to be working. IL
  8. Or you can use a server behaviour, repeat region then recordset paging. Admitedly that won't get you page numbers directly thats a bit more involved. IL
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.