Jump to content

letournp

New Members
  • Posts

    8
  • Joined

  • Last visited

letournp's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. yes I did. like I said I am a newby and did not know that i could not use php in a function, I also have never used functions before, learnt something new. thanks I have managed to get the values from the textboxes (used an alert to verify) that worked. now trying to calculate the time diff between time1 and time2 and return that to a hidden field so that I can insert into a table.
  2. No english is not my normal language!. I am learning an doing the best I can. thanks
  3. I have a form where users select a starttime and endtimes (via a timepicker). I am calling a function using the onchange event to get the time diff between these 2 times, But for some reason the function is not triggered (weel sort off) the funny thing is that to test, I just added an allert to the function and that works great but then I add the remainder of the code the function does not trigger. Code that tiggeres corretly is this; <script> function thours() { alert("Function triggered"); } </script> and when I add the rest of my code to the same fucntion like this, it does not trigger. <script> function thours() { alert("Function triggered"); $date1 = <?php echo $_POST['TimeStart'] ?>; $date2 = <?php echo $_POST['TimeEnd'] ?>; if ($date1 != "") && ($date2 != "") { $diff = $date2->diff($date1); $hours = $diff->h; $hours = $hours + ($diff->days*24); echo $hours; document.getElementsById("Hours").value = $hours; } } </script> I dont get it. help thanks
  4. Found it. The following row in my code was causing the issue. Not quite qure why it is there and what it does (no time right now to analyse) but when I change the number to 555 instead of 15 it wolved the issue and the page resizes properly. $maxRows_rsAss = 555;<--- this is the colprit. I really want to thank you for all your assistance. You solved my issue and i learned something new. Thank you soo much.
  5. did not think I had to. I have the same script on all my pages and I dont call it on any of them, but for some reason they work. I dont know what else to tell you.
  6. That is great thank you so much, One more thing, these pages are loaded into an Iframe. For some reason since I have made the changes the Iframe no longer re-sizes to fit the content that is loaded. Here is my code again. I do have a script in there, but for some reason it does not want to work. It works fine on all of my other pages but not on this one. <?php require_once('Connections/CQBLDATAB.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } mysql_select_db($database_CQBLDATAB, $CQBLDATAB); $query_rsChefsAss = "SELECT * FROM Users WHERE `Chefs ASS` = 'Y'"; $rsChefsAss = mysql_query($query_rsChefsAss, $CQBLDATAB) or die(mysql_error()); $row_rsChefsAss = mysql_fetch_assoc($rsChefsAss); $totalRows_rsChefsAss = mysql_num_rows($rsChefsAss); $maxRows_rsAss = 15; $pageNum_rsAss = 0; if (isset($_GET['pageNum_rsAss'])) { $pageNum_rsAss = $_GET['pageNum_rsAss']; } $startRow_rsAss = $pageNum_rsAss * $maxRows_rsAss; $secname_rsAss = "-1"; if (isset($_POST['CurSecteurs'])) { $secname_rsAss = $_POST['CurSecteurs']; } mysql_select_db($database_CQBLDATAB, $CQBLDATAB); $query_rsAss = sprintf("SELECT Name, Photo, TitreAss, Secteurs FROM Users WHERE ASS = 'Y' ORDER BY Secteurs ASC, Users.OrdreTriAss ASC"); $query_limit_rsAss = sprintf("%s LIMIT %d, %d", $query_rsAss, $startRow_rsAss, $maxRows_rsAss); $rsAss = mysql_query($query_limit_rsAss, $CQBLDATAB) or die(mysql_error()); $row_rsAss = mysql_fetch_assoc($rsAss); if (isset($_GET['totalRows_rsAss'])) { $totalRows_rsAss = $_GET['totalRows_rsAss']; } else { $all_rsAss = mysql_query($query_rsAss); $totalRows_rsAss = mysql_num_rows($all_rsAss); } $totalPages_rsAss = ceil($totalRows_rsAss/$maxRows_rsAss)-1; ?> <!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" /> <meta name="robots" content="index, follow" /> <meta property="og:image" content="http://clubquadbasseslaurentides.com/CQBL/Images/CQBL_logo3.jpg" /> <meta name="keywords" content="Club Quad Basses Laurentides' Club, Quad, Basses, Laurentides, Club Quad Basses Laurentides, CQBL," /> <meta property="og:type" content="website" /> <meta name="title" content="L'administration" /> <meta property="og:title" content="L'administration" /> <meta property="og:site_name" content="CQBL" /> <meta property="og:description" content="CQBL - Club Quad Basses Laurentides - Site officiel du club de VTT des Basses Laurentides" /> <meta name="description" content="CQBL - Club Quad Basses Laurentides - Site officiel du club de VTT des Basses Laurentides" /> <title>L'administration</title> <script type="text/javascript"> function resizeIframe(obj){ {obj.style.height = 0;}; {obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';} } </script> <style type="text/css"> .LesActivitesHeader {} .ReunionTxtFldHeader { font-weight: bold; } .user { display: inline-block; text-align: center; border: 0px solid #CCC; padding: 5px; margin: 5px; } .user img { display: block; margin-left:auto; margin-right:auto; } .user h4 { margin: 0; padding: 0; font-weight: normal; } .user .title { display: block; font-weight: normal; } .MainHeadTxt { font-size: xx-large; font-weight: bold; } </style> </head> <body> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center"><table width="100%" border="0" cellspacing="0" cellpadding="1"> <tr> <td align="center"><p class="MainHeadTxt">Superviseur(s) en chef </p> <table cellpadding="0" cellspacing="0" > <tr> <?php $rsChefsAss_endRow = 0; $rsChefsAss_columns = 3; // number of columns $rsChefsAss_hloopRow1 = 0; // first row flag do { if($rsChefsAss_endRow == 0 && $rsChefsAss_hloopRow1++ != 0) echo "<tr>"; ?> <td><table border="0" cellspacing="3" cellpadding="3"> <tr> <td align="center"><img src="<?php echo $row_rsChefsAss['Photo']; ?>" alt="" name="ChefAS" width="80" height="92" id="ChefAS" /></td> </tr> <tr> <td align="center" class="BoldTxt"><?php echo $row_rsChefsAss['Name']; ?></td> </tr> <tr> <td align="center" class="BoldTxt"><?php echo $row_rsChefsAss['TitreAss']; ?></td> </tr> </table></td> <?php $rsChefsAss_endRow++; if($rsChefsAss_endRow >= $rsChefsAss_columns) { ?> </tr> <?php $rsChefsAss_endRow = 0; } } while ($row_rsChefsAss = mysql_fetch_assoc($rsChefsAss)); if($rsChefsAss_endRow != 0) { while ($rsChefsAss_endRow < $rsChefsAss_columns) { echo("<td> </td>"); $rsChefsAss_endRow++; } echo("</tr>"); }?> </table></td> </tr> </table> <?php $prevRegion = ''; // loop over results of query while($row = mysql_fetch_assoc($rsAss)) { // if the region has changed from previous row if($prevRegion != $row['Secteurs']) { // then output a new region heading echo '<h1>' . $row['Secteurs'] . '</h1>'; $prevRegion = $row['Secteurs']; } // output the users picture? echo ' <div class="user"> <img src="'.$row['Photo']. '" height="92" width="80"/> <h4>' . $row['Name'] . '<span class="title">' . $row['TitreAss'] . '</span></h4>' ?> </div> <?php }?> </tr> <tr> <td align="center"> </tr> </table> </body> </html> <?php mysql_free_result($rsChefsAss); mysql_free_result($rsAss); ?>
  7. I understand that Dreamweaver might not be the best, but it has suited my needs util now. I am not a professional web developer. i just do it for fun and to learn. Your codes works great thanks, but now how do I get the user name and the user titles to ligne up centered underneath the user's picture.
  8. I am trying to build a php page that uses 2 Repreat Regions. I have a table called users that contains all the users info uncluding a region, and am picture file name and a title. I have a recordset that gets distinct regions from the users table and a recordset that has all the users What I need to do is show the picture with the name and title for every user that is in a region. for each region in the region recordset. I have been at this for days trying to figure this out, I know if must be something simple, I think I am close, but going in circles now. Here is my code <?php require_once('Connections/CQBLDATAB.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } mysql_select_db($database_CQBLDATAB, $CQBLDATAB); $query_rsChefsAss = "SELECT * FROM Users WHERE `Chefs ASS` = 'Y'"; $rsChefsAss = mysql_query($query_rsChefsAss, $CQBLDATAB) or die(mysql_error()); $row_rsChefsAss = mysql_fetch_assoc($rsChefsAss); $totalRows_rsChefsAss = mysql_num_rows($rsChefsAss); mysql_select_db($database_CQBLDATAB, $CQBLDATAB); $query_rsSecteurs = "SELECT DISTINCT Secteurs FROM Users WHERE ASS = 'Y' ORDER BY Secteurs ASC"; $rsSecteurs = mysql_query($query_rsSecteurs, $CQBLDATAB) or die(mysql_error()); $row_rsSecteurs = mysql_fetch_assoc($rsSecteurs); $totalRows_rsSecteurs = mysql_num_rows($rsSecteurs); $maxRows_rsAss = 15; $pageNum_rsAss = 0; if (isset($_GET['pageNum_rsAss'])) { $pageNum_rsAss = $_GET['pageNum_rsAss']; } $startRow_rsAss = $pageNum_rsAss * $maxRows_rsAss; $secname_rsAss = "-1"; if (isset($_POST['CurSecteurs'])) { $secname_rsAss = $_POST['CurSecteurs']; } mysql_select_db($database_CQBLDATAB, $CQBLDATAB); $query_rsAss = sprintf("SELECT * FROM Users WHERE ASS = 'Y' AND Users.Secteurs = %s ORDER BY TitreAss ASC", GetSQLValueString($secname_rsAss, "text")); $query_limit_rsAss = sprintf("%s LIMIT %d, %d", $query_rsAss, $startRow_rsAss, $maxRows_rsAss); $rsAss = mysql_query($query_limit_rsAss, $CQBLDATAB) or die(mysql_error()); $row_rsAss = mysql_fetch_assoc($rsAss); if (isset($_GET['totalRows_rsAss'])) { $totalRows_rsAss = $_GET['totalRows_rsAss']; } else { $all_rsAss = mysql_query($query_rsAss); $totalRows_rsAss = mysql_num_rows($all_rsAss); } $totalPages_rsAss = ceil($totalRows_rsAss/$maxRows_rsAss)-1; ?> <!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" /> <meta name="robots" content="index, follow" /> <meta property="og:image" content="http://clubquadbasseslaurentides.com/CQBL/Images/CQBL_logo3.jpg" /> <meta name="keywords" content="Club Quad Basses Laurentides' Club, Quad, Basses, Laurentides, Club Quad Basses Laurentides, CQBL," /> <meta property="og:type" content="website" /> <meta name="title" content="Les agents de sentiers" /> <meta property="og:title" content="Les agents de sentiers" /> <meta property="og:site_name" content="CQBL" /> <meta property="og:description" content="CQBL - Club Quad Basses Laurentides - Site officiel du club de VTT des Basses Laurentides" /> <meta name="description" content="CQBL - Club Quad Basses Laurentides - Site officiel du club de VTT des Basses Laurentides" /> <title>Les agents de sentiers</title> <script type="text/javascript"> function resizeIframe(obj){ {obj.style.height = 0;}; {obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';} } </script> <style type="text/css"> .LesActivitesHeader {} .ReunionTxtFldHeader { font-weight: bold; } .XXlargetxt { font-size: xx-large; } .BoldTxt { font-weight: bold; } </style> </head> <body> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="1"> <tr> <td align="center"><p class="XXlargetxt"><strong>Superviseur(s) en chef</strong></p> <table cellpadding="0" cellspacing="0" > <tr> <?php $rsChefsAss_endRow = 0; $rsChefsAss_columns = 3; // number of columns $rsChefsAss_hloopRow1 = 0; // first row flag do { if($rsChefsAss_endRow == 0 && $rsChefsAss_hloopRow1++ != 0) echo "<tr>"; ?> <td><table border="0" cellspacing="3" cellpadding="3"> <tr> <td align="center"><img src="<?php echo $row_rsChefsAss['Photo']; ?>" alt="" name="ChefAS" width="80" height="92" id="ChefAS" /></td> </tr> <tr> <td align="center" class="BoldTxt"><?php echo $row_rsChefsAss['Name']; ?></td> </tr> <tr> <td align="center" class="BoldTxt"><?php echo $row_rsChefsAss['TitreAss']; ?></td> </tr> </table></td> <?php $rsChefsAss_endRow++; if($rsChefsAss_endRow >= $rsChefsAss_columns) { ?> </tr> <?php $rsChefsAss_endRow = 0; } } while ($row_rsChefsAss = mysql_fetch_assoc($rsChefsAss)); if($rsChefsAss_endRow != 0) { while ($rsChefsAss_endRow < $rsChefsAss_columns) { echo("<td> </td>"); $rsChefsAss_endRow++; } echo("</tr>"); }?> </table></td> </tr> </table> <p> </p> <?php do { ?> <table width="100%" border="0" cellspacing="0" cellpadding="1"> <tr> <td class="BoldTxt"><form id="form1" name="form1" method="post" action=""> <input name="CurSecteurs" type="hidden" id="CurSecteurs" value="<?php echo $row_rsSecteurs['Secteurs']; ?>" /> Secteurs : <?php echo $row_rsSecteurs['Secteurs']; ?> sql: <?php echo $query_rsAss ?> </form></td> </tr> <tr> <td align="center"><table > <tr> <?php $rsAss_endRow = 0; $rsAss_columns = 3; // number of columns $rsAss_hloopRow1 = 0; // first row flag do { if($rsAss_endRow == 0 && $rsAss_hloopRow1++ != 0) echo "<tr>"; ?> <td><table border="0" cellspacing="3" cellpadding="3"> <tr> <td align="center"><img src="<?php echo $row_rsAss['Photo']; ?>" alt="" name="PhotoAss" width="80" height="92" id="PhotoAss" /></td> </tr> <tr> <td align="center" class="BoldTxt"><?php echo $row_rsAss['Name']; ?></td> </tr> <tr> <td align="center" class="BoldTxt"><?php echo $row_rsAss['TitreAss']; ?></td> </tr> </table></td> <?php $rsAss_endRow++; if($rsAss_endRow >= $rsAss_columns) { ?> </tr> <?php $rsAss_endRow = 0; } } while ($row_rsAss = mysql_fetch_assoc($rsAss)); if($rsAss_endRow != 0) { while ($rsAss_endRow < $rsAss_columns) { echo("<td> </td>"); $rsAss_endRow++; } echo("</tr>"); }?> </table> </tr> </table> <?php } while ($row_rsSecteurs = mysql_fetch_assoc($rsSecteurs)); mysql_data_seek($rsSecteurs, 0); //resets recordset pointer $row_rsSecteurs = mysql_fetch_assoc($rsSecteurs); //selects the first row of recordset ?></td> </tr> <tr> <td> </td> </tr> </table> <tr> <td><p> </p> </body> </html> <?php mysql_free_result($rsChefsAss); mysql_free_result($rsSecteurs); mysql_free_result($rsAss); ?> So the table should look something like this Region = Est User1 Picture User 2 Picture User 3 Picture User 1 name User 2 name User 2 name User 1 Title User 2 Title User 3 Title Region = West User1 Picture User 2 Picture User 3 Picture User 1 name User 2 name User 2 name User 1 Title User 2 Title User 3 Title next Region etc.... I hope this makes sense. Thanks in advance
×
×
  • 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.