Jump to content

jcbones

Staff Alumni
  • Posts

    2,653
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by jcbones

  1. The only thing I see wrong, is your are sending the index "flag" in the $_GET array, but checking for it in the $_POST array. You are also appending it to an query string, but should be using an ampersand(&) instead of another question mark(?).
  2. Hey, how did I miss the whole first part of the OP. It would accept dd-mm-yyyy or dd.mm.yy. Both of which could be fixed with a simple str_replace.
  3. Is $dayoff a proper unix timestamp? Because, that is what the second parameter of date requires. If you are using a formatted date, then you need to use strtotime on it. However, as has been stated, don't store your date in the database this way, as you will lose all functionality of working with dates in the database. You should just cast the date to your desired output via the correct database functions.
  4. If you want to make sure it returns images only, use: (using cmb's code). $dir = "path/to/directory/*.[pPjJgG][nNpPiI][gGfF]"; //case insensitive, gets only jpg, JPG, png, PNG, gif, GIF files. foreach(glob($dir) as $file){ //only displays files no subdirectorys echo "<a href='http://www.google.com' target='_blank'><img src='".$file."' width='570' height='270 alt='slide' /></a><br />"; }//close file check }//close foreach
  5. You can have queries in the page, you just can't echo the results. The results must be sent to the image generator. So, if you want the query in the data variable. $query = mysql_query(" SELECT domain, COUNT(domain) AS domaincount FROM domaindata WHERE email_sent_date = '' GROUP BY domain"); while($run = mysql_fetch_array($query)) { $data[] = $run['domaincount']; } is the date_email_sent really suppose to be blank?
  6. You cannot use an image header on any page you wish to echo text to. That must be done on a different page. When you send something with the header content as an image, then the whole document is treated and interpreted as an image. PHP's default header content type is 'text/html', that is why you don't have to set it for a regular page. If we had a clearer understanding of what you are trying to do, we could walk you through it.
  7. I'm glad that people told(tell) me when I was(am) doing things wrong. Coding issues seem non-existant now. The best things I have learned since being told "you're doing it wrong": Database Normalization, Relational Database Design, Logical Programming, and... wait for it... forum sarcasm!!!
  8. You could use a separate table for an admin password for a certain user(s) linked by a foreign key. It adds a little bit of security. Of course, you can have a column in the users table that specifies if the users have a certain level of access.
  9. if($stmt = $mysqli -> prepare("SELECT * FROM $tbl_name1 WHERE confirm_code=?")) { $stmt -> bind_param("s", $passkey); //bind param. $stmt -> execute(); //execute the query. $stmt->bind_result($temp_firstname,$temp_lastname,$temp_sex,$temp_phone); //bind results. $rows = $stmt->fetch(); //fetch results. $count=$stmt->num_rows; //count of rows. echo "\n".$count; // getting the value 1 which is correct if($count==1) //if count is equal to 1 { echo $temp_firstname . ', ' . $temp_lastname . ', ' . $temp_sex . ', ' . $temp_phone; //echo the bound variables. } This should work. (should as in this excerpt).
  10. I usually put one function per file, that is how I grab them out of my library. This causes more overhead with includes, but I can go right to the functions easily.
  11. There are a number of reasons this could happen. You need the users that it is happening to, to give you the exact details (page, what they click, etc), to trouble shoot this problem. It could be anything from data collision (hashes), or a database query, or lack of database normalization. But, this will require extensive testing to find what causes it.
  12. Normalized data will always give normal results. Abnormalized data, will always give abnormal results. Things you need to look at: Database Normalization Join queries Looking at your current table, it should probably be 3 tables.
  13. You need to line up the data, when it comes from the database, correctly. I would start with ordering it sorted by the parent ascending. Then I would sort that into an array, matching the id's to the parent. Finally, I would go through that array, and build the menu.
  14. I was simply showing how the array was built, and that you couldn't just output an implode to get your desired results. You should be looking at something along the lines of: <?php $player = array("Tim","Joe","Ben"); // The players who scored. $count = array("1","2","2"); // The number of trys the player had scored. $combine = array_combine($player, $count);//combine players to scores. foreach($combine as $names => $count) { //loop through the combined array. $store[] = $names . (($count > 1) ? '(' . $count . ')' : NULL ) . ' '; //optionally you could echo this line, but I stored it so I could add a comma with implode. } $result = implode(', ',$store); //implode the store array, using a comma and space as the glue. echo $result; //send it to the page. ?>
  15. Run this: <?php $player = array("Tim","Joe","Ben"); // The players who scored. $count = array("1","2","2"); // The number of trys the player had scored. $combine = array_combine($player, $count); $result = implode($combine); echo '<pre>' . print_r($combine,true) . '</pre>'; ?>
  16. You should probably be using mysqli::multi_query()
  17. So the table is really a calendar in a table format. You would need to check the database date against the display date, if it doesn't exist then you would write an empty row.
  18. Are you sure they are the same person? Try: $numbers = array(0,15,30,45,60); $actual_time = 16; foreach($numbers as $n) { if($n > $actual_time) { $time = $n; break; } }
  19. You should have a separate table in your database with your handouts info. This should also have a week number, and a group number. Then join the data together, and get the current handouts. <-it may not be real clear, I'm losing it lately -- -- Table structure for table `handouts` -- CREATE TABLE IF NOT EXISTS `handouts` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(20) NOT NULL, `img_location` varchar(20) NOT NULL, `group` varchar(5) NOT NULL, `week` int(11) NOT NULL, PRIMARY KEY (`id`) ) You can join this table to your user table with a query similar to this: $sql = "SELECT a.name AS handout_title FROM `handouts` AS a JOIN user AS b ON a.group = b.group AND a.week = b.week WHERE b.username = '$user_data[first_name]'"; You could take it a lot further than that, and your database should be normalized (or it WILL run into problems), as data shouldn't be redundant. It will lead to collisions and produce undesired results. Things you could do. Use a base time subtracted from the current time to automatically find the week number. If you stored the group numbers as class numbers (2013) instead of a varchar (grp13), then you could get rid of the redundant blocks you have written and change it to: <?php require_once('../../includes/logged_in/li_overall/li_mid.php'); ?> <!--Class Welcome Message...... --> <div id="right_middle"> <h1>Welcome y <?php echo $user_data['first_name'];?>!</h1> <p>You have been assigned to Class of <?php echo $user_data['group']; ?>....</p> </div> <?php require_once('../../includes/logged_in/li_overall/li_footer.php'); ?> I know I went beyond what you asked for, so if I confuse the situation, I apologize.
  20. Basic cross domain server calls is called HTTP request. You would handle it just like any other form submission. If it were me, and other people were calling my domain for specific requests (like you describe), I would write an API for the purpose. 1. User from site A submits form to site A 2. Site A request a check from site B 3. Site B validates request, and outputs status of request. 4. Site A checks response from B, and outputs desired results. You shouldn't need anything other than file_get_contents() if fopen wrappers are on, or cURL if you need more functionality. Then you need to debug the script, and find out why it does that. Hope this helps, if you give a little current code, I could probably be more helpful.
  21. Whats the question?
  22. Or, you could get it free from White Hat through their simpleImage class. Its a little dated, but works well.
  23. Good grief, I gave the answer in the first reply. Maybe it needs a repeat, and/or clarification. preg_match /*<===== if that is really in your script, you need to remove it...*/ if (preg_match('^' . $stored_referer . '$', $temp[2])) $found = true; Read the comment, look at where it is pointing. If that "preg_match" really resides as the first line of your IF clause, then remove it, it is invalid syntax as it is a function call without arguments.
  24. preg_match /*<-if that is really in your script, you need to remove it... */ if (preg_match('^' . $stored_referer . '$', $temp[2])) $found = true;
  25. Mine too, Psycho, mine too.
×
×
  • 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.