Jump to content

craygo

Staff Alumni
  • Posts

    1,972
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by craygo

  1. query looks fine what is the problem with it?? Any errors??
  2. Absolutely no need for whoops my friend. At least you have explained the permissions a little more to Paul
  3. Can use that also, but my point is the 775 is the highest level most hosting companies will allow.
  4. there is a temp directory php uses. it is set in the php.ini file. You have to make sure the web user has access to this temp directory. Also try using move_uploaded_file() instead of copy. Also a lot of hosting companies don't allow chmod 777. even though it is set to 777 things don't work. try setting to 775 instead. Should still give you enough access. Ray
  5. try $start = $sent++; or $start = $sent+1; // nospaces Ray
  6. Nice catch, I always get those 2 mixed up for some reason. O well. Just make sure you use urlencode($Name) not urlencode($name) Ray
  7. Got the right idea, but since you are using single quotes, all variables inside are seen as they are not as the variable. You need to come out of the single quotes to get the value. <?php if ($a>1) { $p = $a-1; echo '<a href="'.$p.'.html">Previous</a><br />'; } $n = $a+1; echo '<a href="'.$n.'.html">Next</a><br />'; ?> Ray
  8. yes but make the name normal $Name = "$Name = "Abuse Counseling & Treatment (ACT)"; Ray
  9. use breaks echo "If this works, variable value here:<br />\n"; echo $a."<br />\n"; echo "And included page here: <br />\n"; include("$a.html"); Ray
  10. value="<?php echo $city; ?>" That should do the job, as long as $city is set otherwise try something like this. I assuming the value is coming from some form. I will use POST but if you are using GET then change it $city = isset($_POST['city']) ? $_POST['city'] : ""; then you can use the code above without getting any errors Ray
  11. After actually looking at your code, why are you using 2 queries?? Should only need one query to do this <?php session_start(); include($_SERVER['DOCUMENT_ROOT'] . '/new/includes/header.php'); include($_SERVER['DOCUMENT_ROOT'] . '/new/includes/access.inc'); echo '<h2 class="titles">Edit Vacancies</h2>'."\n"; echo '<p>Click a vacancy category below to edit archive and delete vacancies.</p>'."\n"; $SQL = mysql_query("SELECT VacCat, COUNT(VacTitle) AS VacCount FROM tblVac WHERE VacArchive='0' GROUP BY VacCat") or die (mysql_error()); if (mysql_num_rows($SQL) < 1) { echo "<p>Sorry there are no current vacancies.</p>"; } else { while ($row = mysql_fetch_array($SQL)) { echo '<div style="padding:5px 0; clear:both;">'."\n"; echo '<img src="/new/images/layout/close.gif" alt="arrow" /> '."\n"; echo '<a href="/new/admin/vacancies/edit_vac_list.php?CAT='.$row["VacCat"].' ">'.$row["VacCat"].' Vacancies</a> '.$row["VacCount"]."\n"; echo "</div>"."\n"; } } include($_SERVER['DOCUMENT_ROOT'] . '/new/includes/footer.php'); ?> Ray
  12. $COUNTSQL = mysql_query("SELECT VacCat, COUNT(VacTitle) as VacCount FROM tblVac GROUP BY VacCat") or die (mysql_error()); while ($count = mysql_num_rows($COUNTSQL)) { echo "Total ".$count['VacCat']." = ". $count["VacCount"]; } You may have to store the results of the count in an array first then while looping through the rows output the count in the array. You could also use one query to list everything and use php to total up each catagory. Ray
  13. just add the login variable to the form action <form action='".basename($_SERVER['SCRIPT_NAME'])."?p=login' method='post'> Also since login is included in the index file there is no need to check the $_SESSION['Logged'] value twice. You should actually check that and if it is not set then go to the login page. can also simplify some code $_SESSION['Logged'] = !isset($_SESSION['Logged']) ? 'No' : $_SESSION['Logged']; $p = !isset($_GET['p']) ? "" : $_GET['p']; $userID = !isset($_POST['userID']) ? '' : $_POST['userID']; //PASSWORD $userPass = !isset($_POST['userPass']) ? '' : $_POST['userPass']; Ray
  14. Sorry I took that out I figured you wanted all the booked items for the company. Glad it's working now
  15. In order to do something like that you would use the LIKE Function. Also you would need to add an end comma to you comma separated values. Reason for all this is quite simple. you have to look for "15," and not "15", because what happens when you get to issue 150?? Also you need the comma at the end because what if issue 15 is the last one?? It will be "15" not "15,". SELECT * FROM table WHERE issues LIKE '%15,%' Ray
  16. this works for me <?php session_start(); include ('../config.php'); include ('../opendb.php'); if(!isset($_SESSION['Login'])){ header ("location:../login.php"); } $record = $_GET['id']; $bf_record = $_GET['bf_id']; $query="SELECT * FROM contacts JOIN booking_form ON contacts_id = bf_company_id WHERE contacts_id = $record"; $result=mysql_query($query); if(!$result) { print("Query Error: ".mysql_error()); } // put all issues booked into a comma seperated string $iss = ''; while($row = mysql_fetch_assoc($result)){ $iss .= $row['bf_issues_booked']; $iss .= ','; } // Get rid of the last comma $iss = trim($iss, ","); // make an array out of the string $bf_issues_booked = explode(",", $iss); //get all the issues available $issues_query="SELECT * FROM issues WHERE issue_on_sale BETWEEN NOW() AND DATE_ADD(NOW(), INTERVAL 400 DAY)"; //echo $issues_query; $issues_result=mysql_query($issues_query); //echo mysql_num_rows($issues_result); if(!$issues_result) { echo("Query Error: ".mysql_error()); } // A loop used to populate my form with the checkboxes and issue name, number etc. This works fine while($irow=mysql_fetch_assoc($issues_result)) { // check to see if the issue is in the booked array $selected = in_array($irow['issue_number'], $bf_issues_booked) ? "checked=\"checked\"" : ""; $issues[] = '<input name="issue_number[]" type="checkbox" value="' .$irow['issue_number']. '" tabindex="11" ' . $selected . ' />Issue <strong>' .$irow['issue_number'] . '</strong> ' . $irow['issue_month'] . ' ' . $irow['issue_year'] ; } // A function set up to poulate a table with values returned from the above loop function issues_table($data, $details="") { $sret = "<table ".$details.">\n"; $all = count($data)-1; for($i=0; $i <= $all; $i++) { if(($i % 2)==0) { $sret .= "<tr><td>".$data[$i]."</td>"; } else { $sret .= "<td>".$data[$i]."</td></tr>\n"; } } // Catch if an odd cell if(($all % 2) == 0) { $sret .= "<td><br></td></tr>\n"; } $sret .= "</table>\n"; return $sret; } $data = $issues; echo issues_table($data, "border='0' width='100%'"); ?> </body> </html> Ray
  17. Ok gonna look. That is what I mean by linked, the contacts table is linked to the booking_form table through the contact_id = bf_company_id
  18. first thing I see is the ! in front of the parenthesis. remove the parenthesis. if (!mysql_connect("sql2.bravehost.com", "mecfix", "password")) Ray
  19. Also your database may be case sensitive. I always keep my fields in lower case and make sure I match up all field names. echo $r["cert_no"] . '<br />'; echo $r["first_name"]. ' '; echo $r["last_name"] . '<br />'; echo $r["address"] . '<br />'; echo $r["address_2"] . '<br />'; echo $r["city"] . '<br />'; echo $r["state"] . '<br />'; echo $r["zip"]; Ray
  20. if your table has a category field use that in a where clause. Example: in your news table there is a field called "category" you can set a category name or id and look for that $category = '1'; $result = dbquery("SELECT * FROM ".$db_prefix."news WHERE `category` = '$category' ORDER BY news_datestamp DESC LIMIT 0,10"); Ray
  21. may want to check and make sure the new server has GD installed on it. That will give you the 2 image errors. The header error could be because of the 2 errors. You will get that error if anything is outputted to the browser first, in this case it is the 2 errors which would not be there if the function worked correctly. Ray
  22. cool but could use some data from the tables. Also are the tables linked in any way. Because your first query $query="SELECT * FROM contacts, booking_form WHERE contacts_id = $record AND bf_id = $bf_record"; Doesn't really mean anything because there is no link between them. is the contact tables linked to the booking table??
  23. Actually I think changing the variables in your checks is what did the job. if (!isset($_POST['username']) || !isset($_POST['password'])) { header( "Location: http://localhost/test2/login.htm" ); } //check that the form fields are not empty, and redirect back to the login page if they are elseif (empty($_POST['username']) || empty($_POST['password'])) { header( "Location: http://localhost/test2/login.htm" ); } else{ Try moving just the session_start() to where it was and see what happens.
×
×
  • 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.