Jump to content

jcbones

Staff Alumni
  • Posts

    2,653
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by jcbones

  1. I would suggest changing your runtime settings (common file) to E_ALL.
  2. Here is your script, showing the current month, and 5 in the future. In order to incorporate your database, you need to provide a database dump of your table structure, as well as some test data. <section id="content" class="planner"> <h2> <?php $date_db = strtotime("07/01/2011"); echo date("F Y", $date_db); ?> </h2> <?php $today = date("d", $date_db); // Current day $month = date("m", $date_db); // Current month $year = date("Y", $date_db); // Current year for($n = 0; $n < 5; $n++,$month++) { ?> <table class="month"> <tr class="days"> <td>Mon</td> <td>Tues</td> <td>Wed</td> <td>Thurs</td> <td>Fri</td> <td>Sat</td> <td>Sun</td> </tr> <?php //die($today); /* $today = date("d"); // Current day $month = date("m"); // Current month $year = date("Y"); // Current year */ $days = cal_days_in_month(CAL_GREGORIAN,$month,$year); // Days in current month $lastmonth = date("t", mktime(0,0,0,$month-1,1,$year)); // Days in previous month $start = date("N", mktime(0,0,0,$month,1,$year)); // Starting day of current month $finish = date("N", mktime(0,0,0,$month,$days,$year)); // Finishing day of current month $laststart = $start - 1; // Days of previous month in calander $counter = 1; $nextMonthCounter = 1; //if the start day is greater than a Friday; if it is, we have 6 rows, otherwise we have 5 if($start > 5){ $rows = 6; }else {$rows = 5; } //we then have a nested loop - one for the weeks, and one for the days in the weeks for($i = 1; $i <= $rows; $i++){ echo '<tr class="week">'."\n"; for($x = 1; $x <= 7; $x++){ if(($counter - $start) < 0){ $date = (($lastmonth - $laststart) + $counter); $class = 'class="blur"'; echo '<td '.$class.'><a class="date"></a></td>'."\n"; }else if(($counter - $start) >= $days){ $date = ($nextMonthCounter); $nextMonthCounter++; $class = 'class="blur"'; echo '<td '.$class.'><a class="date"></a></td>'."\n"; }else { $date = ($counter - $start + 1); if($today == $counter - $start + 1){ $class = 'class="today"'; } echo '<td '.$class.'><a class="date">'. $date . '</a></td>'."\n"; } $counter++; $class = ''; } echo '</tr>'."\n"; } ?> </table> <?php } ?> </section>
  3. I'll look over it, give me a bit.
  4. What happens when a link gets deleted, and the +1 id value doesn't exist? It is better to limit the query by the rows, than to blindly pull a row that may or may not exist.
  5. Your form element's opening tag looks something like this, doesn't it? <form enctype="multipart/form-data" action="uploader.php" method="post">
  6. $color1 = "#FF0000"; $color2 = "#808080"; $color = ($color == $color2) ? $color1 : $color2;
  7. WebStyles, looking at his code, I'm not sure he has an `id` field.
  8. rand() has it's problems, and is notoriously slow. Is there an auto-increment primary key by chance? This would be unique for each row in the database, and would make it much easier to track which rows had been selected, as well as making it easier to select a new row.
  9. Replace: echo $listproducts; with: echo str_replace('{{OPTIONS}}',implode('<br /> ',$options),$listproducts); Should have caught that on the first go around.
  10. You are calling a query on a query. Change $sql to this: $sql = "SELECT * FROM ava_games ORDER BY id desc LIMIT 5";
  11. You could use something along the lines of: <?php $_POST['ubmit10'] = true; $_POST['submit23'] = true; $_POST['submit40'] = true; $_POST['submit1'] = true; $keyExists = false; $postKeys = array_keys($_POST); for($i = 1; $i < 31; $i++) { if(in_array('submit'.$i,$postKeys)) { $keyExists = true; $keyCalled = 'submit' . $i; break; } } if($keyExists) { echo 'YES<br />' . $keyCalled . ' does exist!<br />'; } else { echo 'NO<br />No keys present<br />'; } echo '<pre>' . print_r($_POST,true) . '</pre>'; ?>
  12. json_decode() seems to have trouble with some json strings. Look in the user comments for some answers.
  13. Try it again with this: doesn't include your last post <?php include('_inc/productoverview_config.php'); include('_inc/listproducts_config.php'); if(isset($_GET['p'])) { $pageNum = $_GET['p']; settype($pageNum, 'integer'); } $offset = ($pageNum - 1) * $recordsPerPage; $query = "SELECT a.*,b.* FROM productdetails AS a JOIN productoptions AS b ON a.associate_id = b.associate_id WHERE a.category_id = '0002' ORDER BY a.category_id, a.product_id ASC LIMIT $offset, $recordsPerPage;"; $result = mysql_query($query) or die('Error retrieving product listings. Please <a href="contact.php">inform us of this issue</a>.'); $listproducts = '<div id="bagsandclothing">'; $last = NULL; while($row = mysql_fetch_assoc($result)) { $associateid = $row['associate_id']; $product_id = $row['product_id']; $categoryid = $row['category_id']; $row['product_image'] = $row['product_image']; $row['product_name'] = stripslashes($row['product_name']); $row['product_description'] = stripslashes($row['product_description']); $popid = $row["id"]; $associate_id = $row["associate_id"]; $product = $row["product"]; $product_option_description = $row["product_option_description"]; $product_option_price = $row["product_option_price"]; $product_option_status = $row["product_option_status"]; if($last != $row['associate_id']) { if(!empty($options)) { $listproducts = str_replace('{{OPTIONS}}',implode('<br /> ',$options),$listproducts); } $options = array(); $listproducts .= "\n \n<div id=\"productview\"> \n\t<table class=\"productname\"> \n\t<tr valign=\"middle\"> \n\t<td class=\"productname\"> \n\t$row[product_name] \n\t</td> \n\t</tr> \n\t</table> \n\t<table class=\"productoverview\"> \n\t<tr valign=\"top\"> \n\t<td class=\"productpicture\"> \n\t<img src=\"_productimages/_thumbs/$row[product_image]\" title=\"$row[product_name]\" border=\"0\" /> \n\t<p> \n\t<span class=\"enlargephoto\"><a id=\"showlargepic\" href=\"_productimages/$row[product_image]\" class=\"enlarge\">Enlarge Photograph</a></span> \n\t</td> \n\t<td class=\"productdetails\"> \n\t$row[product_description] \n\t<p>{{OPTIONS}} \n\t</td> \n\t</tr> \n\t</table> \n<p> \n</div>"; $last = $row['associate_id']; } $options[] = $row['product_option_description'] . ' £' . $row['product_option_price'] . ' ' . $row['product_option_status']; } $listproducts .= "\n</div>"; echo $listproducts; ?>
  14. Ah, OK, mis-understood you. I'm going to attempt to get the while loop right. Crude Attempt while($row = mysql_fetch_assoc($result)) { $options = $row['option_description'] . ' ' . $row['option_price'] . ' ' . $row['option_status'] . '<br />'; if($last != $row['associate_id']) { $listproducts .= "\n \n<div id=\"productview\"> \n\t<table class=\"productname\"> \n\t<tr valign=\"middle\"> \n\t<td class=\"productname\"> \n\t$row[product_name] \n\t</td> \n\t</tr> \n\t</table> \n\t<table class=\"productoverview\"> \n\t<tr valign=\"top\"> \n\t<td class=\"productpicture\"> \n\t<img src=\"_productimages/_thumbs/$row[product_image]\" title=\"$row[product_name]\" border=\"0\" /> \n\t<p> \n\t<span class=\"enlargephoto\"><a id=\"showlargepic\" href=\"_productimages/$row[product_image]\" class=\"enlarge\">Enlarge Photograph</a></span> \n\t</td> \n\t<td class=\"productdetails\"> \n\t$row[product_description] \n\t<p>"; } $listproducts .= $options; if($last != $row['associate_id']) { $listproducts .= " \n\t</td> \n\t</tr> \n\t</table> \n<p> \n</div>"; $last = $row['associate_id']; } }
  15. This is from the PCEL: PAM AUTH docs.
  16. Which release are you using?
  17. You have left out some code, there is more to this script, please post the whole script inside of the BBCode code brackets.
  18. Try: echo "This is the list of food at the store<br/>"; foreach ($foodPrices as $category=>$arr) { echo "$category <br/>";//this just puts out "array" a few times foreach($arr as $food=>price) { echo "$food: $price <br/>"; } }
  19. Try this instead: <?php $gallery_name = mysql_real_escape_string($_POST['galleryname']); $path="gallery/$gallery_name"; mkdir('$path', 0777); //Create the gallery php file $ourFileName = "$path.php"; $ourFileHandle = fopen($ourFileName, 'w') or die("can't open file"); fclose($ourFileHandle); //Write the upload form script to the gallery php file $myFile = "$path.php"; $fh = fopen($myFile, 'w') or die("can't open file"); $stringData = "Welcome to '$gallery_name'"; fwrite($fh, $stringData); $stringData.='<?php'; $stringData.='include('../storescripts/connect_to_mysql.php');'; $stringData.='$gallery='.$gallery_name; $stringData.='$query = mysql_query("SELECT image_path FROM images WHERE gallery_name =\'' . $gallery . '\'");'; $stringData.='while($row = mysql_fetch_array($query,MYSQL_ASSOC)){'; $stringData.='$image_path = $row[\"image_path\"];'; $stringData.='print \"<img src=$image_path /> <br />\";'; $stringData.='}'; $stringData.='?>'; fwrite($fh, $stringData); fclose($fh); ?> Use single quotes around variables that you do NOT want the current script to parse, doubles around those that you do.
  20. Have you ran the query I gave you in your database management software (phpMyAdmin), or the database console itself? Because, I re-created your tables, with your data, and get the expected results. associate_id product product_description product_image category_id associate_id option_description option_price option_status 1 Thermal Jacket Comfortable jacket.jpg 2 1 small 4.99 in stock 1 Thermal Jacket Comfortable jacket.jpg 2 1 medium 6.99 in stock
  21. "Invalid login" is not the error for duplicate data, is it? And I'm getting it when I submit login information, not registry information. Sorry, X out my whole post, as I didn't see "page 2". Oh, the eyes are getting to old.
  22. Study this: <?php $last = '0'; while ($row_programs = mysql_fetch_assoc($programs)) { if($row_programs['id'] != $last){ //the programs ID, will never match the programs NAME. echo '<b>' . $row_programs['pname'] . '</b><br>'; } echo $row_programs['sname'] . '<br>'; $last = $row_programs['pname']; } ?> Suggested fix. <?php $last = '0'; while ($row_programs = mysql_fetch_assoc($programs)) { if($row_programs['id'] != $last){ echo '<b>' . $row_programs['pname'] . '</b><br>'; } echo $row_programs['sname'] . '<br>'; $last = $row_programs['id']; } ?>
  23. Make sure there are no spaces before you opening <?php tag. That should take care of the header error. The other is because the db table's username column is set to a unique key. Which means it will only store a username IF it doesn't already exist. This is a good thing, because you don't want two people with the same name. If that error shows up, then it is because the database is working correctly.
  24. You did make sure that you fixed the link to point to your test script right? <?php $league_name = (isset($_GET['league_name'])) ? mysql_real_escape_string($_GET['league_name']) : NULL; //grab league name passed in the GET array. if(empty($league_name)) { exit('Un-authorized personnel only!!!'); } //if the name is null, then kill the page before database call. $query = "SELECT * FROM privateleague, user_leagues, login WHERE privateleague.privateleaguename = '$league_name' AND privateleague.privateleagueid = user_leagues.privateleagueid AND user_leagues.userid = login.userid"; $result = mysql_query($query); while($row = mysql_fetch_assoc($result)) { echo $row['login.teamname']; echo "<br />"; } ?>
  25. Short answer is: DO NOT run query loops inside of query loops. This will create MANY, MANY headaches. Which I'm sure that you are aware of now. Using this single query, you should get all the info that the two queries get. Try it, and let us know of any further problems. "SELECT a.*,b.* FROM productdetails AS a JOIN productoptions AS b ON a.associate_id = b.associate_id WHERE a.category_id = '0002' ORDER BY a.category_id, a.product_id ASC LIMIT $offset, $recordsPerPage;";
×
×
  • 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.