
dgiberson
Members-
Posts
87 -
Joined
-
Last visited
Never
Everything posted by dgiberson
-
i have to echo chronister's comments, using unixtimestamps to do the work makes it much much easier to work with dates and times
-
use $print_date = strftime('%Y-%m-%d', $today)
-
the way i did this was using an unixtimstamp and then adding to it... $today = time(); // 1209600 = # of seconds in a two week period $twoweeks_date = $today + 1209600; this will give you the date range you need, there are other ways to do this.... and it all depends on how you want to display your calendar, but at least this way you have your start & ending points btw, you will see posts that this method doesn't totally account for daylight savings, blah blah blah... which is true. however most of the time this will be sufficient.
-
you need to check the MIME type or $_FILES['type'] variable, create an array to hold the allowed types and then you can compare the upload against the array. there are additional checks you can perform, but this is the most basic. Here is a basic tutorial i found: http://php.about.com/od/advancedphp/ss/php_file_upload_2.htm Here is a link for MIME types: http://www.ltsw.se/knbase/internet/mime.htp
-
echo "<table><tr><td>Angle</td><td>Sin(x)</td></tr>"; for ($i=0;$i<=360;$i++) { $d = deg2rad($i); $sin = sin($d); echo "<tr><td>$i</td><td>$sin</td></tr>"; } echo "</table>";
-
hahaha, nice one jesirose.... was thinking that myself
-
[quote]my table is called krankdcontacts and by saying select * from krankd contacts it should search for all fields with anything in it right??[/quote] This statement will return all rows where the name field is like the $name variable provided. It will not search all of the columns in the table for this variable.
-
This should do it: [code] if ((!isset($_POST['name'])) && (!isset($_POST['target'])) && (!isset($_POST['Acutal']))) { // do something here } [/code]
-
Question 1: make sure you have quotes around your data & that info is right for the column you are inserting. Question 2: looks like you are missing a space between the table name and the table definition.
-
PHP doesn't understand me (Im telling it to do the wrong thing)
dgiberson replied to mattd8752's topic in PHP Coding Help
omg whats up with the varchars..... datatypes man! datatypes! -
try putting in an echo $query; then paste the line into phpMyAdmin or Query Browser, it will give you more information as to what is wrong vs. what php gives you..... PS did you misspell field on purpose or by accident? that could be your issue
-
PHP doesn't understand me (Im telling it to do the wrong thing)
dgiberson replied to mattd8752's topic in PHP Coding Help
your problem is you are concatenating the variable not making an addition. $usrid = 0; This: $usrid = $usrid + "1"; Should be: $usrid = $usrid + 1; or $usrid++; Same thing goes for the cars..... -
[SOLVED] How to load specific url on log on
dgiberson replied to scottreid1974's topic in PHP Coding Help
is this in the same browser window or a new window? -
You'll need to find the page where $HTTP_COOKIE_VARS["admin_log"] is actually set from the login script.
-
you might want to convert the two time vars into unix timestamps using mktime() function, then you can subtract the DOB from the current date, then use strftime() function to format the output. $unix_dob = mktime(0,0,0,$month,$day,$year); $today = time(); $diff = $today - $unix_dob; $age = strftime('%y-%j', $diff); would output something like 10 years - 122 days
-
is the password set in the database? if so did you just type it in i.e. password = phpfreaks, so you see phpfreaks next to the username? search the login page for md5 and see if it is trying to compare the password you type using a md5 hash..... if that is the case update the table (in phpMyAdmin or Query Browser) with something like: UPDATE users SET password = md5(phpfreaks) WHERE username = 'admin' now the password will look like a big jumble of numbers and letters.....
-
save it, then open up with notepad/pspad whatever....
-
<? $computer = $_POST['cboPC']; $q = "SELECT id, desc FROM table"; $result = mysql_query($q); $select = "<select name=cboPC>"; for ($i=0;$i<mysql_num_rows($result);$i++) { if (mysql_result($result,$i,"id") == $computer) { $select .= "<option value=".mysql_result($result,$i,"id")."selected>".mysql_result($result,$i,"desc")."</option>"; } else { $select .= "<option value=".mysql_result($result,$i,"id").">".mysql_result($result,$i,"desc")."</option>"; } } $select .= "</select>"; echo $select; ?>
-
pull all the records required in one query to and put them into a multidimensional array, then loop through the array as necessary...
-
Using PHP to create a MySQL data file
dgiberson replied to Bates Water Gardens's topic in PHP Coding Help
Im not really sure what you are trying to get at with a "data file"..... do you mean separate text files, separate tables in mysql.... this can be handled all in a couple tables in mysql tblstudent_questions sqid - unique primary key userid - relates to the student table (their unique identifier in the system) quesDesc - text for the questions tblstudent_answers said - unique identifier to allow multiple answers to the same question sqid - foreign key relating to the questions table quesAnswer - their answer to the question datetime - optional to see when they entered the answer..... You would have to expand this out to four tables if you wanted predefined questions and answers..... -
Using PHP to create a MySQL data file
dgiberson replied to Bates Water Gardens's topic in PHP Coding Help
will the students somehow be logging into this question / answer tool? -
[code]<?php $recNum = $_GET['rec_No']; $select = "SELECT * FROM clients where id=$recNum"; $export = mysql_query($select); $fields = mysql_num_fields($export); $header = "<table border=1><tr>"; for ($i = 0; $i < $fields; $i++) { $header .= "<td>".mysql_field_name($export, $i) . "<\td>"; } $header .= "</tr>"; while($row = mysql_fetch_row($export)) { $line = "<tr>"; foreach($row as $value) { if ((!isset($value)) OR ($value == "")) { $value = "<td> </td>"; } else { $value = str_replace('"', '""', $value); $value = '<td>"' . $value . '"' . "<\td>"; } $line .= $value; } $data .= trim($line)."</tr>"; } if ($data == "") { $data = "<tr><td colspan=$fields>(0) Records Found!<\td></tr>"; } $data .= "</table>"; header("Content-Disposition: attachment; filename=extraction.xls"); header("Pragma: no-cache"); header("Expires: 0"); print "$header\n$data"; header("Content-type: application/x-msdownload"); require_once("footer.php"); mysql_close($conn); [/code] I think that should work.... if not its pretty close
-
chmod on Windows..why's it gotta be a punk?
dgiberson replied to JKringen's topic in PHP Coding Help
you might not be able to CHMOD, because of a CHOWNissue